RFR: 8318049: C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
Jasmine Karthikeyan
jkarthikeyan at openjdk.org
Tue Oct 17 10:39:11 UTC 2023
This patch fixes [JDK-8318049](https://bugs.openjdk.org/browse/JDK-8318049) by informing XorI and XorL nodes in addition to sub and phi nodes when Cast nodes are updated during IGVN.
The bug manifests when loop optimizations change the IR:

To the following form:

XorI nodes check for that form in their `Value` call, to do the `x ^ x => 0` transformation, checking through casts. As the cast node didn't inform the Xor when it changes, the transformation doesn't have a chance to run.
https://github.com/openjdk/jdk/blob/5bd10521eb5e51e76b20e955addd45f76abba6f7/src/hotspot/share/opto/addnode.cpp#L947-L950
I've attached a reduced version of the test found in the bug. Reviews would be appreciated!
-------------
Commit messages:
- Notify Xor when changing constraint casts
Changes: https://git.openjdk.org/jdk/pull/16214/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16214&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8318049
Stats: 59 lines in 2 files changed: 57 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/16214.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16214/head:pull/16214
PR: https://git.openjdk.org/jdk/pull/16214
More information about the hotspot-compiler-dev
mailing list