src/share/vm/opto/loopTransform.cpp

changeset 2168
c77e8f982901
parent 2140
5e4f03302987
child 2199
75588558f1bf
     1.1 --- a/src/share/vm/opto/loopTransform.cpp	Thu Sep 16 16:48:40 2010 -0700
     1.2 +++ b/src/share/vm/opto/loopTransform.cpp	Wed Sep 15 20:25:37 2010 -0700
     1.3 @@ -2447,6 +2447,13 @@
     1.4      msg_node = store->in(MemNode::Address);
     1.5    }
     1.6  
     1.7 +  if (msg == NULL &&
     1.8 +      (!store->in(MemNode::Memory)->is_Phi() ||
     1.9 +       store->in(MemNode::Memory)->in(LoopNode::LoopBackControl) != store)) {
    1.10 +    msg = "store memory isn't proper phi";
    1.11 +    msg_node = store->in(MemNode::Memory);
    1.12 +  }
    1.13 +
    1.14    // Make sure there is an appropriate fill routine
    1.15    BasicType t = store->as_Mem()->memory_type();
    1.16    const char* fill_name;
    1.17 @@ -2570,7 +2577,7 @@
    1.18      Node* n = lpt->_body.at(i);
    1.19      // These values can be replaced with other nodes if they are used
    1.20      // outside the loop.
    1.21 -    if (n == store || n == head->loopexit() || n == head->incr()) continue;
    1.22 +    if (n == store || n == head->loopexit() || n == head->incr() || n == store->in(MemNode::Memory)) continue;
    1.23      for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
    1.24        Node* use = iter.get();
    1.25        if (!lpt->_body.contains(use)) {
    1.26 @@ -2715,6 +2722,10 @@
    1.27  
    1.28    // Redirect the old control and memory edges that are outside the loop.
    1.29    Node* exit = head->loopexit()->proj_out(0);
    1.30 +  // Sometimes the memory phi of the head is used as the outgoing
    1.31 +  // state of the loop.  It's safe in this case to replace it with the
    1.32 +  // result_mem.
    1.33 +  _igvn.replace_node(store->in(MemNode::Memory), result_mem);
    1.34    _igvn.replace_node(exit, result_ctrl);
    1.35    _igvn.replace_node(store, result_mem);
    1.36    // Any uses the increment outside of the loop become the loop limit.

mercurial