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

Joshua Cao duke at openjdk.org
Tue Jan 16 17:47:21 UTC 2024


On Tue, 16 Jan 2024 17:18:39 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/loopopts/InvariantCodeMotionReassociateCmp.java line 191:
>> 
>>> 189:     @Arguments({Argument.NUMBER_42, Argument.NUMBER_42})
>>> 190:     @IR(failOn = {IRNode.SUB_I})
>>> 191:     public void leDontReassociate(int inv1, int inv2) {
>> 
>> I added DontReassociate tests for `le`, `gt`, and `ge`. For `lt`, C2 generates a second `SUB_I` as part of other transformations.
>> 
>> IR matching for ADD/SUB is pretty hard in general. They commonly are created as part of other transformations. Any suggestions on how I can test this better is appreciated.
>
> You could always use a simple regex with the linenumber I guess. But that is a bit nasty too.

Yeah, it would work for this patch. But people working on future unrelated changes may have to change the line number. Seems more pain than its worth.

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

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


More information about the hotspot-compiler-dev mailing list