RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v7]
Johannes Graham
duke at openjdk.org
Mon Jan 27 19:40:01 UTC 2025
On Mon, 27 Jan 2025 07:54:17 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Johannes Graham has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - formatting
>> - simplified version of bounds check
>> - tests for xor hi=power of 2
>
> test/hotspot/jtreg/compiler/c2/irTests/XorINodeIdealizationTests.java line 273:
>
>> 271: private static int forceMinMax(int value){
>> 272: // equivalent to Math.min(CONST_POW_2, Math.max(value, 1))
>> 273: return 1 + (value & (CONST_POW_2 - 1));
>
> Why do you chose the complicated way here? What's wrong with using `min / max`? I'm afraid that the XOR gets folded through the ADD or AND here.... I think that would be less likely with `min / max`, right?
Surprisingly the min/max bounds do not get propagated on longs. Once I found a pattern that worked there I used it for ints as well, though min/max is ok there.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1931087492
More information about the hotspot-compiler-dev
mailing list