RFR: 8364407: [REDO] Consolidate Identity of self-inverse operations
Hannes Greule
hgreule at openjdk.org
Mon Aug 18 15:57:56 UTC 2025
The previous approach was flawed for `short` and `char` as these are int-subtypes and truncate the result (see the backout issue https://bugs.openjdk.org/browse/JDK-8364409 for a reproducer).
This change now first ensures that the input type is small enough so no truncation gets lost when dropping the operations.
The previous implementation also used an `InvolutionNode` superclass with one `Identity(...)` implementation, but there were some reservations whether this is the right way to go. As we now have a `ReverseBytesNode`, there is also less benefit in having the supertype, as this covers 4 in 1 already.
I also added test cases on top of the original ones that ensure the nodes stay when we can't prove the input type is small enough.
-------------
Commit messages:
- redo with type check
- test
Changes: https://git.openjdk.org/jdk/pull/26823/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26823&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8364407
Stats: 271 lines in 4 files changed: 263 ins; 3 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/26823.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26823/head:pull/26823
PR: https://git.openjdk.org/jdk/pull/26823
More information about the hotspot-compiler-dev
mailing list