RFR: 8342692: C2: long counted loop/long range checks: don't create loop-nest for short running loops [v5]
Roland Westrelin
roland at openjdk.org
Wed Dec 4 15:48:46 UTC 2024
On Thu, 28 Nov 2024 15:40:42 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 21 commits:
>>
>> - Merge branch 'master' into JDK-8342692
>> - whitespaces
>> - more
>> - merge
>> - more
>> - one more test
>> - Merge branch 'master' into JDK-8342692
>> - more
>> - more
>> - Merge branch 'master' into JDK-8342692
>> - ... and 11 more: https://git.openjdk.org/jdk/compare/3b21a298...74c38342
>
> I pushed an update that should fix all test failures except the one in `compiler/escapeAnalysis/TestMissingAntiDependency.java` (covered by JDK-8341976). A lot of them were caused by the following part of the change:
>> In the case of a long counted loop, the loop is transformed into a
> regular loop with a new limit and transformed range checks that's
> later turned into an in counted loop. The int counted loop doesn't
> need loop limit checks because of the way it's constructed. There's
> an assert that catches that we don't attempt to add one. I ran into
> test failures where, by the time the int counted loop is created,
> the fact that the number of iterations of the loop is small enough
> to not need a loop limit check gets lost. I added a cast to make
> sure the narrowed limit's type is not lost (I had to do something
> similar for loop nests). But then, I ran into the same issue again
> because the cast was pushed through a sub or add and the narrowed
> type was lost. I propose that pushing casts through sub/add be only
> done after loop opts are over (same as what's done for range check
> CastII).
>
> So I removed that part of the initial change and instead added some logic to pattern match the `CastLL` used by the loop nest for which the transformation of `(CastLL (AddL ...))` shouldn't be performed until the inner loop is turned into a counted loop.
> @rwestrel Would you mind changing the title to something more descriptive of your change? I'm thinking: "C2: Don't create loop-nest for short running loops".
Done.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21630#issuecomment-2517825359
More information about the hotspot-compiler-dev
mailing list