src/hotspot/share/c1/c1_LIRGenerator.cpp
changeset 54200 af3f568cbd2d
parent 54125 70a818b1d9db
child 58273 08a5148e7c4e
child 58678 9cf78a70fa4f
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp	Wed Mar 20 08:33:33 2019 +0000
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp	Wed Mar 20 11:51:43 2019 +0300
@@ -3279,7 +3279,14 @@
 
 void LIRGenerator::increment_backedge_counter_conditionally(LIR_Condition cond, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info, int left_bci, int right_bci, int bci) {
   if (compilation()->count_backedges()) {
+#if defined(X86) && !defined(_LP64)
+    // BEWARE! On 32-bit x86 cmp clobbers its left argument so we need a temp copy.
+    LIR_Opr left_copy = new_register(left->type());
+    __ move(left, left_copy);
+    __ cmp(cond, left_copy, right);
+#else
     __ cmp(cond, left, right);
+#endif
     LIR_Opr step = new_register(T_INT);
     LIR_Opr plus_one = LIR_OprFact::intConst(InvocationCounter::count_increment);
     LIR_Opr zero = LIR_OprFact::intConst(0);