RFR: 8350988: Consolidate Identity of self-inverse operations

Hannes Greule hgreule at openjdk.org
Mon Mar 3 14:09:52 UTC 2025


On Mon, 3 Mar 2025 03:26:57 GMT, Chen Liang <liach at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/InvolutionIdentityTests.java line 118:
>> 
>>> 116: 
>>> 117:     @Test
>>> 118:     @IR(failOn = {IRNode.REVERSE_BYTES_I})
>> 
>> I'm not sure if this is fine as the ReverseBytes nodes depend on intrinsics. From my understanding, the methods are just seen as normal methods on platforms without reverseBytes support. In that case, the test would still pass, but it might be surprising that it passes. Is this fine or is there a better way here?
>
> Interesting question - expanding on that, could arbitrary methods be marked as self-inverse to be represented in the IR?

I don't think there are many such methods, and my knowledge of Ideal isn't good enough to judge whether that's possible.

But it might make sense to use the nodes even when the intrinsic isn't available, and "lower" it to the existing implementation (either a call or inlining) after optimizing the node itself.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23851#discussion_r1977576936


More information about the hotspot-compiler-dev mailing list