8143307: Crash in C2 local code motion
authorgoetz
Thu, 19 Nov 2015 12:53:33 +0100
changeset 34210 2dafc56da253
parent 34209 abe570308c14
child 34211 d25c2fc1e248
8143307: Crash in C2 local code motion Reviewed-by: kvn
hotspot/src/share/vm/opto/lcm.cpp
--- a/hotspot/src/share/vm/opto/lcm.cpp	Mon Nov 23 15:16:19 2015 +0100
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Thu Nov 19 12:53:33 2015 +0100
@@ -498,9 +498,13 @@
       continue;
 
     // Schedule IV increment last.
-    if (e->is_Mach() && e->as_Mach()->ideal_Opcode() == Op_CountedLoopEnd &&
-        e->in(1)->in(1) == n && n->is_iteratively_computed())
-      continue;
+    if (e->is_Mach() && e->as_Mach()->ideal_Opcode() == Op_CountedLoopEnd) {
+      // Cmp might be matched into CountedLoopEnd node.
+      Node *cmp = (e->in(1)->ideal_reg() == Op_RegFlags) ? e->in(1) : e;
+      if (cmp->req() > 1 && cmp->in(1) == n && n->is_iteratively_computed()) {
+        continue;
+      }
+    }
 
     uint n_choice  = 2;