RFR: 8281322: irTests/TestLongRangeChecks.java fails with strip mining off
Christian Hagedorn
chagedorn at openjdk.java.net
Tue Feb 8 10:08:16 UTC 2022
On Mon, 7 Feb 2022 08:53:41 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> Some of the long range check transformations take advantage of the
> safepoint captured by loop strip mining to extract jvm state (in order
> to add back empty predicates to the inner loop of a loop nest). As a
> consequence, irTests/TestLongRangeChecks.java fails with strip mining
> off and users might experience performance anomalies where changing
> GCs affect purely computational code.
>
> The strip mined loop nest creation is a 2 step process:
>
> 1- when a CountedLoop is created, an OuterStripMinedLoop is also added
> but it's not fully constructed
>
> 2- at macro expansion time, the OuterStripMinedLoop is turned into an
> actual loop by adding Phis and a proper exit condition
>
> I propose always doing 1- whether loop strip mining is enabled or
> not. This causes the safepoint to always be captured. Loop strip ming
> is not expected to get in the way of loop transformations so this
> change in itself should be performance neutral. Then at 2-, if loop
> strip mining is not enabled, the OuterStripMinedLoop can be removed
> and the safepoint moved back into the loop in case
> LoopStripMiningIter=1 or simply removed too.
That looks reasonable. I'll submit some testing.
src/hotspot/share/opto/loopnode.cpp line 2574:
> 2572:
> 2573: // make counted loop exit test always fail to
> 2574: igvn->replace_input_of(cle, 1, outer_test);
Might be clearer to directly use `igvn->intcon(0)` instead of `outer_test`.
src/hotspot/share/opto/loopnode.cpp line 2582:
> 2580: // make the outer loop go away
> 2581: igvn->replace_input_of(this, LoopBackControl, igvn->C->top());
> 2582: igvn->C->print_method(PHASE_DEBUG, 2);
Probably a left-over and can be removed.
-------------
Marked as reviewed by chagedorn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7364
More information about the hotspot-compiler-dev
mailing list