[jdk20] RFR: 8298176: remove OpaqueZeroTripGuardPostLoop once main-loop disappears

Roland Westrelin roland at openjdk.org
Thu Dec 22 10:49:05 UTC 2022


On Wed, 21 Dec 2022 15:40:12 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> > I still believe it's risky to simply drop the OpaqueZeroTripGuard for
> > the post loop even if it can't constant fold at least because we
> > wouldn't want the zero trip guard to split thru phi.
> 
> Should we investigate this for JDK 21?

http://cr.openjdk.java.net/~roland/TestCountedLoop.java

is a test case that fails with the opaque node of the zero trip guard for the post loop removed (incorrect execution). It only fails with a 32 bit build because split if is prevented on 64 bits by a CastII (see merge_point_safe()). What happens is that right after PeelMainPost, split if pushes the post loop zero trip guard through the region that dominates. The copy of the zero trip guard that's now right after the main loop tests the same condition as the main loop exit and so is removed as redundant. The post loop becomes reachable only from the zero trip guard above the main loop (but that one folds after loop opts is done and then there's no more post loop). Unrolling then proceeds but there's no post loop to executed the remaining iterations once the main loop is done.

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

PR: https://git.openjdk.org/jdk20/pull/65


More information about the hotspot-compiler-dev mailing list