RFR: 8323429: Missing C2 optimization for FP min/max when both inputs are same

Galder Zamarreño galder at openjdk.org
Thu Apr 11 12:15:58 UTC 2024


Added C2 identity optimization for min/max calls, whereby if both inputs are the same, either is returned.

It includes an IR test to verify that the optimization gets applied. The optimization applies not only to floating points, but also long and ints. The test includes tests for all of those.

`BasicDoubleOpTest.vectorMax_8322090` has also been adjusted to match expectations after implementing the optimization.

I've run hotspot compiler tests successfully on x86_64.

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

Commit messages:
 - Added int/long min/max optimization tests and renamed test
 - Adjust to coding style
 - Override MaxNode::Identity to detect optimize same nodes
 - MAX nodes should be 0 after optimization has been applied
 - Only apply optimization to mix/max nodes
 - Adjust test expectations following optimization
 - Add Identity optimization for when the inputs are the same
 - Adjust test to pass in same parameter to both sides
 - Added IR test for how the current code works

Changes: https://git.openjdk.org/jdk/pull/18738/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18738&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8323429
  Stats: 132 lines in 5 files changed: 131 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/18738.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18738/head:pull/18738

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


More information about the hotspot-compiler-dev mailing list