RFR: 8349032: C2: Parse Predicate refactoring in Loop Unswitching broke fix for JDK-8290850 [v2]

Christian Hagedorn chagedorn at openjdk.org
Fri Feb 21 22:31:15 UTC 2025


> In the refactoring for [JDK-8344035](https://bugs.openjdk.org/browse/JDK-8344035), the value passed for the `rewire_uncommon_proj_phi_inputs` parameter in `PhaseIdealLoop::create_new_if_for_predicate()` during Loop Unswitching was accidentally flipped. It should only be set to `true` when calling it for a false-path loop, which is the cloned loop. This is currently not the case and leads to a bad graph due to folding nodes wrongly:
> https://github.com/openjdk/jdk/blob/735805d9259037ae594eb4f75e96860d43feea5d/src/hotspot/share/opto/predicates.cpp#L84-L88
> 
> I fixed this by just flipping the parameter from `is_true_path_loop` to `is_false_path_loop` to avoid a negation. I added an additional comment to `PhaseIdealLoop::create_new_if_for_predicate()` about `rewire_uncommon_proj_phi_inputs`.
> 
> More background about why we need `rewire_uncommon_proj_phi_inputs` in the first place can be found in the corresponding fix for [JDK-8290850](https://bugs.openjdk.org/browse/JDK-8290850): https://github.com/openjdk/jdk/pull/11452, and additionally in https://github.com/openjdk/jdk/pull/5185
> 
> Thanks,
> Christian

Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:

  restore comment line length

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23712/files
  - new: https://git.openjdk.org/jdk/pull/23712/files/b225477e..8c0f57b3

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23712&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23712&range=00-01

  Stats: 6 lines in 1 file changed: 2 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/23712.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23712/head:pull/23712

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


More information about the hotspot-compiler-dev mailing list