RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v42]

Johannes Graham duke at openjdk.org
Mon Mar 24 17:54:20 UTC 2025


On Mon, 24 Mar 2025 15:40:53 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/XorINodeIdealizationTests.java line 385:
>> 
>>> 383:     public int testRandomLimits(int x, int y) {
>>> 384:         x = RANGE_1.clamp(x);
>>> 385:         y = RANGE_2.clamp(y);
>> 
>> Question:
>> did you verify that this `RANGE_1` with its clamp values are really detected as constants by C2, and not seen as loads? Maybe that works, but I've never tried it myself.
>
> I  just hope that the abstraction here does not invalidate our intent to have constant min/max bounds for the clamping ;)

It does the right thing with the constants - `testFoldableRange` would fail otherwise.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r2010671641


More information about the hotspot-compiler-dev mailing list