src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6984979 Sdiff src/share/vm/opto

src/share/vm/opto/loopTransform.cpp

Print this page




2430 
2431   if (store == NULL) {
2432     // No store in loop
2433     return false;
2434   }
2435 
2436   if (msg == NULL && head->stride_con() != 1) {
2437     // could handle negative strides too
2438     if (head->stride_con() < 0) {
2439       msg = "negative stride";
2440     } else {
2441       msg = "non-unit stride";
2442     }
2443   }
2444 
2445   if (msg == NULL && !store->in(MemNode::Address)->is_AddP()) {
2446     msg = "can't handle store address";
2447     msg_node = store->in(MemNode::Address);
2448   }
2449 







2450   // Make sure there is an appropriate fill routine
2451   BasicType t = store->as_Mem()->memory_type();
2452   const char* fill_name;
2453   if (msg == NULL &&
2454       StubRoutines::select_fill_function(t, false, fill_name) == NULL) {
2455     msg = "unsupported store";
2456     msg_node = store;
2457   }
2458 
2459   if (msg != NULL) {
2460 #ifndef PRODUCT
2461     if (TraceOptimizeFill) {
2462       tty->print_cr("not fill intrinsic candidate: %s", msg);
2463       if (msg_node != NULL) msg_node->dump();
2464     }
2465 #endif
2466     return false;
2467   }
2468 
2469   // Make sure the address expression can be handled.  It should be


2553   if (conv)  ok.set(conv->_idx);
2554 
2555   for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
2556     Node* n = lpt->_body.at(i);
2557     if (n->outcnt() == 0) continue; // Ignore dead
2558     if (ok.test(n->_idx)) continue;
2559     // Backedge projection is ok
2560     if (n->is_IfTrue() && n->in(0) == head->loopexit()) continue;
2561     if (!n->is_AddP()) {
2562       msg = "unhandled node";
2563       msg_node = n;
2564       break;
2565     }
2566   }
2567 
2568   // Make sure no unexpected values are used outside the loop
2569   for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
2570     Node* n = lpt->_body.at(i);
2571     // These values can be replaced with other nodes if they are used
2572     // outside the loop.
2573     if (n == store || n == head->loopexit() || n == head->incr()) continue;
2574     for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
2575       Node* use = iter.get();
2576       if (!lpt->_body.contains(use)) {
2577         msg = "node is used outside loop";
2578         // lpt->_body.dump();
2579         msg_node = n;
2580         break;
2581       }
2582     }
2583   }
2584 
2585 #ifdef ASSERT
2586   if (TraceOptimizeFill) {
2587     if (msg != NULL) {
2588       tty->print_cr("no fill intrinsic: %s", msg);
2589       if (msg_node != NULL) msg_node->dump();
2590     } else {
2591       tty->print_cr("fill intrinsic for:");
2592     }
2593     store->dump();


2698         head->init_trip() == _igvn.intcon(0)) {
2699       if (TraceOptimizeFill) {
2700         tty->print_cr("Eliminated zeroing in allocation");
2701       }
2702       alloc->maybe_set_complete(&_igvn);
2703     } else {
2704 #ifdef ASSERT
2705       if (TraceOptimizeFill) {
2706         tty->print_cr("filling array but bounds don't match");
2707         alloc->dump();
2708         head->init_trip()->dump();
2709         head->limit()->dump();
2710         length->dump();
2711       }
2712 #endif
2713     }
2714   }
2715 
2716   // Redirect the old control and memory edges that are outside the loop.
2717   Node* exit = head->loopexit()->proj_out(0);




2718   _igvn.replace_node(exit, result_ctrl);
2719   _igvn.replace_node(store, result_mem);
2720   // Any uses the increment outside of the loop become the loop limit.
2721   _igvn.replace_node(head->incr(), head->limit());
2722 
2723   // Disconnect the head from the loop.
2724   for (uint i = 0; i < lpt->_body.size(); i++) {
2725     Node* n = lpt->_body.at(i);
2726     _igvn.replace_node(n, C->top());
2727   }
2728 
2729   return true;
2730 }


2430 
2431   if (store == NULL) {
2432     // No store in loop
2433     return false;
2434   }
2435 
2436   if (msg == NULL && head->stride_con() != 1) {
2437     // could handle negative strides too
2438     if (head->stride_con() < 0) {
2439       msg = "negative stride";
2440     } else {
2441       msg = "non-unit stride";
2442     }
2443   }
2444 
2445   if (msg == NULL && !store->in(MemNode::Address)->is_AddP()) {
2446     msg = "can't handle store address";
2447     msg_node = store->in(MemNode::Address);
2448   }
2449 
2450   if (msg == NULL &&
2451       (!store->in(MemNode::Memory)->is_Phi() ||
2452        store->in(MemNode::Memory)->in(LoopNode::LoopBackControl) != store)) {
2453     msg = "store memory isn't proper phi";
2454     msg_node = store->in(MemNode::Memory);
2455   }
2456 
2457   // Make sure there is an appropriate fill routine
2458   BasicType t = store->as_Mem()->memory_type();
2459   const char* fill_name;
2460   if (msg == NULL &&
2461       StubRoutines::select_fill_function(t, false, fill_name) == NULL) {
2462     msg = "unsupported store";
2463     msg_node = store;
2464   }
2465 
2466   if (msg != NULL) {
2467 #ifndef PRODUCT
2468     if (TraceOptimizeFill) {
2469       tty->print_cr("not fill intrinsic candidate: %s", msg);
2470       if (msg_node != NULL) msg_node->dump();
2471     }
2472 #endif
2473     return false;
2474   }
2475 
2476   // Make sure the address expression can be handled.  It should be


2560   if (conv)  ok.set(conv->_idx);
2561 
2562   for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
2563     Node* n = lpt->_body.at(i);
2564     if (n->outcnt() == 0) continue; // Ignore dead
2565     if (ok.test(n->_idx)) continue;
2566     // Backedge projection is ok
2567     if (n->is_IfTrue() && n->in(0) == head->loopexit()) continue;
2568     if (!n->is_AddP()) {
2569       msg = "unhandled node";
2570       msg_node = n;
2571       break;
2572     }
2573   }
2574 
2575   // Make sure no unexpected values are used outside the loop
2576   for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
2577     Node* n = lpt->_body.at(i);
2578     // These values can be replaced with other nodes if they are used
2579     // outside the loop.
2580     if (n == store || n == head->loopexit() || n == head->incr() || n == store->in(MemNode::Memory)) continue;
2581     for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
2582       Node* use = iter.get();
2583       if (!lpt->_body.contains(use)) {
2584         msg = "node is used outside loop";
2585         // lpt->_body.dump();
2586         msg_node = n;
2587         break;
2588       }
2589     }
2590   }
2591 
2592 #ifdef ASSERT
2593   if (TraceOptimizeFill) {
2594     if (msg != NULL) {
2595       tty->print_cr("no fill intrinsic: %s", msg);
2596       if (msg_node != NULL) msg_node->dump();
2597     } else {
2598       tty->print_cr("fill intrinsic for:");
2599     }
2600     store->dump();


2705         head->init_trip() == _igvn.intcon(0)) {
2706       if (TraceOptimizeFill) {
2707         tty->print_cr("Eliminated zeroing in allocation");
2708       }
2709       alloc->maybe_set_complete(&_igvn);
2710     } else {
2711 #ifdef ASSERT
2712       if (TraceOptimizeFill) {
2713         tty->print_cr("filling array but bounds don't match");
2714         alloc->dump();
2715         head->init_trip()->dump();
2716         head->limit()->dump();
2717         length->dump();
2718       }
2719 #endif
2720     }
2721   }
2722 
2723   // Redirect the old control and memory edges that are outside the loop.
2724   Node* exit = head->loopexit()->proj_out(0);
2725   // Sometimes the memory phi of the head is used as the outgoing
2726   // state of the loop.  It's safe in this case to replace it with the
2727   // result_mem.
2728   _igvn.replace_node(store->in(MemNode::Memory), result_mem);
2729   _igvn.replace_node(exit, result_ctrl);
2730   _igvn.replace_node(store, result_mem);
2731   // Any uses the increment outside of the loop become the loop limit.
2732   _igvn.replace_node(head->incr(), head->limit());
2733 
2734   // Disconnect the head from the loop.
2735   for (uint i = 0; i < lpt->_body.size(); i++) {
2736     Node* n = lpt->_body.at(i);
2737     _igvn.replace_node(n, C->top());
2738   }
2739 
2740   return true;
2741 }
src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File