RFR: 8357726: C2 fails to recognize the counted loop when induction variable range is changed multiple times
Emanuel Peter
epeter at openjdk.org
Tue Jun 3 07:24:52 UTC 2025
On Tue, 3 Jun 2025 01:48:47 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
>> test/micro/org/openjdk/bench/vm/compiler/CountedLoopCastIV.java line 54:
>>
>>> 52: Random r = new Random();
>>> 53: start = r.nextInt(LEN >> 2);
>>> 54: limit = r.nextInt(LEN >> 1, LEN - 3);
>>
>> Does this not mean that we use a different seed every time, and therefore the loop has different lengths, and so the results can be influenced accordingly?
>
> Yes, I just want to make sure the loop length is different with each time running, so that it will not be influenced by some profiling related optimizations.
I see. Did you have any direct issues with profiling here?
I'm worried that the trip count is really very variant here. We could have:
start = 0 and limit = LEN - 3 -> count ~ LEN
start = LEN/4 and limit = LEN/2 -> count = LEN/4
That is a 4x variance, am I right? Can you run the benchmark a few times, and see what the error term looks like?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25539#discussion_r2122954605
More information about the hotspot-compiler-dev
mailing list