RFR: 8347645: C2: XOR bounded value handling blocks constant folding

Johannes Graham duke at openjdk.org
Wed Jan 15 21:38:51 UTC 2025


C2 does not eliminate XOR nodes with constant arguments. This has a noticeable effect on `Long.expand` with a constant mask, on architectures that don't have instructions equivalent  to `PDEP` to be used in an intrinsic.

This patch demonstrates a potential fix to the problem, but there might well be better ways to do it.

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

Commit messages:
 - move logic from Value to add_node XorL
 - move logic from Value to add_node XorI
 - format, copyright date
 - xor const folding
 - test for xor const folding

Changes: https://git.openjdk.org/jdk/pull/23089/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23089&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8347645
  Stats: 145 lines in 2 files changed: 109 ins; 27 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/23089.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23089/head:pull/23089

PR: https://git.openjdk.org/jdk/pull/23089


More information about the hotspot-compiler-dev mailing list