RFR: 8373134: C2: Min/Max users of Min/Max uses should be enqueued for GVN [v2]

Galder Zamarreño galder at openjdk.org
Mon Jan 12 09:55:18 UTC 2026


On Thu, 18 Dec 2025 23:17:06 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Galder Zamarreño has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:
>> 
>>  - Merge branch 'master' into topic.uses-min-max
>>  - Test Float16
>>  - Only apply to uses that match original IR node
>>  - Merge branch 'master' into topic.uses-min-max
>>  - Use is_MinMax() instead of spelling out individual Min/Max opcodes
>>  - Refactor MaxNode to MinMaxNode and add is_MinMax() query
>>  - Add max(a, max(b, c)) patterns to add users of use
>>  - Add templated test
>>  - Remove exclude or Min/Max in verify identity
>
> src/hotspot/share/opto/phaseX.cpp line 2609:
> 
>> 2607:     for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
>> 2608:       Node* u = use->fast_out(i2);
>> 2609:       if (u->Opcode() == use->Opcode()) {
> 
> So there are no Min(Max()) or Max(Min()) patterns we need to worry about?  I was expecting this line to be
> 
> if (u->is_MinMax()) {

I've been looking at this PR again, having seen the issue in [JDK-8374896](https://bugs.openjdk.org/browse/JDK-8374896), and that scenario is exactly the one @dean-long mentions. I think fixing [JDK-8374896](https://bugs.openjdk.org/browse/JDK-8374896) can be done in the PR for that issue, and the fix is likely the one @dean-long suggests above. Agree @TobiHartmann @dean-long?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28895#discussion_r2681543378


More information about the hotspot-compiler-dev mailing list