Merge
authornever
Thu, 31 Mar 2011 15:30:12 -0700
changeset 8886 ede3202e00e0
parent 8885 eed0ba1d011b (current diff)
parent 8884 9e2b81253ef9 (diff)
child 8887 1e9e60a225a6
Merge
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 31 14:00:41 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 31 15:30:12 2011 -0700
@@ -432,6 +432,12 @@
     return false;
   }
 
+  // Currently we don't have policy to optimize one iteration loops.
+  // Maximally unrolling transformation is used for that:
+  // it is peeled and the original loop become non reachable (dead).
+  if (trip_count == 1)
+    return true;
+
   // Do not unroll a loop with String intrinsics code.
   // String intrinsics are large and have loops.
   for (uint k = 0; k < _body.size(); k++) {
--- a/hotspot/src/share/vm/opto/memnode.cpp	Thu Mar 31 14:00:41 2011 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Thu Mar 31 15:30:12 2011 -0700
@@ -2628,12 +2628,16 @@
 Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) {
   if (remove_dead_region(phase, can_reshape)) return this;
 
-  Node* mem = phase->transform(in(MemNode::Memory));
-  // If transformed to a MergeMem, get the desired slice
-  uint alias_idx = phase->C->get_alias_index(adr_type());
-  mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem;
-  if (mem != in(MemNode::Memory))
-    set_req(MemNode::Memory, mem);
+  if (can_reshape) {
+    Node* mem = phase->transform(in(MemNode::Memory));
+    // If transformed to a MergeMem, get the desired slice
+    uint alias_idx = phase->C->get_alias_index(adr_type());
+    mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem;
+    if (mem != in(MemNode::Memory)) {
+      set_req(MemNode::Memory, mem);
+      return this;
+    }
+  }
   return NULL;
 }