--- old/src/share/vm/opto/matcher.cpp 2013-10-22 15:44:48.871979120 +0200 +++ new/src/share/vm/opto/matcher.cpp 2013-10-22 15:44:48.763979124 +0200 @@ -2026,6 +2026,15 @@ if (m == NULL) continue; // Ignore NULLs uint mop = m->Opcode(); + // Only push the input of a FlagsProj if it only has the FlagsProj + // as output. Otherwise all inputs to the node that produces FlagsProj + // will be marked as shared. + if (n->is_FlagsProj()) { + if (m->outcnt() == 1) { + mstack.push(m, Visit); + } + continue; // for(int i = ...) + } // Must clone all producers of flags, or we will not match correctly. // Suppose a compare setting int-flags is shared (e.g., a switch-tree) // then it will match into an ideal Op_RegFlags. Alas, the fp-flags