--- a/hotspot/src/share/vm/opto/loopPredicate.cpp Wed May 20 17:06:44 2015 +0200
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp Thu May 21 13:54:07 2015 +0200
@@ -437,7 +437,13 @@
}
}
if (all_inputs_invariant) {
- _invariant.set(n->_idx); // I am a invariant too
+ // If n's control is a predicate that was moved out of the
+ // loop, it was marked invariant but n is only invariant if
+ // it depends only on that test. Otherwise, unless that test
+ // is out of the loop, it's not invariant.
+ if (n->is_CFG() || n->depends_only_on_test() || n->in(0) == NULL || !_phase->is_member(_lpt, n->in(0))) {
+ _invariant.set(n->_idx); // I am a invariant too
+ }
}
} else { // process next input
_stack.set_index(idx + 1);