RFR: 8323220: Reassociate loop invariants involved in Cmps and Add/Subs [v2]
Emanuel Peter
epeter at openjdk.org
Thu Jan 18 08:29:17 UTC 2024
On Wed, 17 Jan 2024 19:28:36 GMT, Joshua Cao <duke at openjdk.org> wrote:
>> Another suboptimal idea: you wrap the add / sub in a method, and then ensure that this method is inlined. It might still keep the annotation of being part of that inner method, and you could use regex to check for it.
>>
>> Or maybe we could also have some sort of relative line offset mechanism in the IR framework, that allows you to specify that you want something that is let's say 7 lines down from the IR rule.
>
> Some sort of pattern matcher could work. It would be able nice to match something like `a ADD_I b CMP_LT c`. In java this could look something like
>
>
> @IR(counts = {IRNode.CMP_LT[IRNode.ANY, IRNode.SUB_I, IRNode.ANY], "1"}
>
>
> The arguments in the `[]` are the inputs. `IRNode.ANY` matches any node. (The zero'th node is ANY because its the region node).
>
> Anyway, I think a `lt` test is not super-required for the coverage for this PR. The current machinery does not provide a convenient way to test it. I'd prefer to avoid something hacky. I think this work can be done separately.
I agree with you there, don't do anything hacky here.
But yes, I've also been wondering what kind of improvements to the IR framework would help us to do these sorts of graph-matching verifications.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17375#discussion_r1457085232
More information about the hotspot-compiler-dev
mailing list