RFR: 8361140: Missing OptimizePtrCompare check in ConnectionGraph::reduce_phi_on_cmp

hanguanqiang duke at openjdk.org
Fri Jul 4 02:55:27 UTC 2025


When running with `-XX:-OptimizePtrCompare` (which disables pointer comparison optimization), the compiler may hit an assertion failure in debug builds because `optimize_ptr_compare` is still being called. This violates the intended usage of the flag and leads to unexpected crashes.

This patch adds an early return to `reduce_phi_on_cmp` when `OptimizePtrCompare` is false. Since the optimization relies on `optimize_ptr_compare` for static reasoning about comparisons, there's no benefit in proceeding with `reduce_phi_on_cmp` when this flag is disabled.

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

Commit messages:
 - 8361140: Missing OptimizePtrCompare check in ConnectionGraph::reduce_phi_on_cmp

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

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


More information about the hotspot-compiler-dev mailing list