RFR: 8319793: C2 compilation fails with "Bad graph detected in build_loop_late" after JDK-8279888 [v9]

Roland Westrelin roland at openjdk.org
Fri Jan 5 09:55:30 UTC 2024


On Thu, 4 Jan 2024 16:10:24 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/ifnode.cpp line 1958:
>> 
>>> 1956:         return nullptr;
>>> 1957:       }
>>> 1958: 
>> 
>> Why is it ok to delay this to post-loop-opts? Does it not prevent moving some CFG from being eliminated out of loops? Would be nice to have a little justification comment.
>
> Ah. Does this mean that if there are multiple RangeCheck in a loop, where some could be smeared, these are not smeared, and then we have more RangeChecks to eliminate out of the loop? Maybe in the end this all comes down to the same anyway. Just wondering.

> Why is it ok to delay this to post-loop-opts? Does it not prevent moving some CFG from being eliminated out of loops? Would be nice to have a little justification comment.

Maybe. With this fix, range check smearing requires pinning nodes. So running it early also has a drawback: it can cause nodes that would otherwise float to be pinned. The way I see it, range check smearing is a local optimization for cases where range checks can't be eliminated some other way so running it late should not make a difference. If the range check is in a loop and predication removes it then running RC smearing early doesn't make a difference. If the range check is part of a range check sequence that can only be optimized by RC smearing then having a longer range check sequence for the duration of loop opts probably makes no difference.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16886#discussion_r1442683646


More information about the hotspot-compiler-dev mailing list