RFR: 8323220: Reassociate loop invariants involved in Cmps and Add/Subs [v9]

Emanuel Peter epeter at openjdk.org
Fri Feb 16 07:49:59 UTC 2024


On Fri, 16 Feb 2024 01:17:00 GMT, Joshua Cao <duke at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/loopopts/InvariantCodeMotionReassociateCmp.java line 37:
>> 
>>> 35:  */
>>> 36: public class InvariantCodeMotionReassociateCmp {
>>> 37:     private static final int size = 500;
>> 
>> You could even randomize size in a `@Setup` method, and pass it as another argument.
>
> If I have a random size input, the loop is actually not a `CountedLoop`, and this transformation only applies to `CountedLoop`. I don't know all the details of `CountedLoop`, but this feels like a miss. Maybe `CountedLoop` can only handle loops with multiple exits of the limit is a constant.

Ha, yes, this would be a heavy miss. Can you post a small `Test.java` where such a loop does not get turned into a `CountedLoop`? I'd like to investigate.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17375#discussion_r1492044277


More information about the hotspot-compiler-dev mailing list