RFR: 8332920: C2: Partial Peeling is wrongly applied for CmpU with negative limit [v2]

Christian Hagedorn chagedorn at openjdk.org
Wed Jun 5 15:18:13 UTC 2024


On Wed, 5 Jun 2024 12:38:46 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Updated comments, improved proofs, improved motivation and idea at method comment
>
> src/hotspot/share/opto/loopopts.cpp line 3057:
> 
>> 3055: //    dummy-if      |
>> 3056: //     /  |         |
>> 3057: // other  |         |
> 
> what is this?

This dummy-if is created with `insert_region_before_proj()` such that we can have a region between the exit projection (`exit-proj`) of the original unsigned loop exit test and the If node while keeping both the If and the exit-proj. Also see:

https://github.com/openjdk/jdk/blob/cbb6747e6b9ce7e2b9e0ffb0a1f9499f7e0e13b0/src/hotspot/share/opto/loopopts.cpp#L2934-L2960

> test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java line 270:
> 
>> 268:         check(MIN_VALUE + 2001); // MAX_VALUE + 2002 iterations
>> 269:         testWhileLTDecr(MIN_VALUE + 2000, MIN_VALUE + 2001);
>> 270:         check(MIN_VALUE + 2001); // MAX_VALUE + 2002 iterations
> 
> Could you also add a randomized input test here, that plays close to the boundaries? Just to make sure we would catch things like some off-by one errors.

Good idea, I've added some random test and computed the number of iteration that I expect. I only did it for the interesting cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19522#discussion_r1627811507
PR Review Comment: https://git.openjdk.org/jdk/pull/19522#discussion_r1627977241


More information about the hotspot-compiler-dev mailing list