1.1 --- a/src/share/vm/opto/loopPredicate.cpp Tue May 06 09:17:57 2014 +0200 1.2 +++ b/src/share/vm/opto/loopPredicate.cpp Wed Jun 03 14:22:57 2015 +0200 1.3 @@ -438,7 +438,13 @@ 1.4 } 1.5 } 1.6 if (all_inputs_invariant) { 1.7 - _invariant.set(n->_idx); // I am a invariant too 1.8 + // If n's control is a predicate that was moved out of the 1.9 + // loop, it was marked invariant but n is only invariant if 1.10 + // it depends only on that test. Otherwise, unless that test 1.11 + // is out of the loop, it's not invariant. 1.12 + if (n->is_CFG() || n->depends_only_on_test() || n->in(0) == NULL || !_phase->is_member(_lpt, n->in(0))) { 1.13 + _invariant.set(n->_idx); // I am a invariant too 1.14 + } 1.15 } 1.16 } else { // process next input 1.17 _stack.set_index(idx + 1);