[jdk17] RFR: 8269820: C2 PhaseIdealLoop::do_unroll get wrong opaque node

Roland Westrelin roland at openjdk.java.net
Tue Jul 27 08:47:29 UTC 2021


On Sun, 25 Jul 2021 04:43:52 GMT, Hui Shi <hshi at openjdk.org> wrote:

> In normal case, opaque1 has only 1 input, it cannot split more than one time. In special case, opaque1 has two limit inputs, extra one is original loop limit for range check. But this step(IdealLoopTree::iteration_split) happens after split if, so there will not be cases opaque1 behind a chain of Phis in my own understanding. .

It's not that obvious to me. Couldn't split thru phi cause Opaque1 to be split several times thru several Regions?

> Not understand how https://github.com/openjdk/jdk17/blob/master/src/hotspot/share/opto/loopnode.cpp#L5356 cause this bug.
> Are you suggesting skipping split if wit Opaque1 in tree as discussed in ealier PR? Skipping must be a safer and conservertive fix, I can submit a new fix if safer fix is perfer now.

Here is the fix I suggest:
https://github.com/rwestrel/jdk17/commit/15f515a56777517493aee378616c0a0cda294a16

Opaque1 is split thru Phi because its control is set to the Region that dominates the predicates. The code I pointed to causes the control to be set that way. But I don't think that logic applies to Opaque1 nodes.

-------------

PR: https://git.openjdk.java.net/jdk17/pull/255


More information about the hotspot-compiler-dev mailing list