RFR: 8369898: C2 SuperWord: assert(has_ctrl(i)) failed: should be control, not loop
Emanuel Peter
epeter at openjdk.org
Mon Oct 20 12:57:05 UTC 2025
In `PhaseIdealLoop::create_new_if_for_multiversion`, we replace `multiversion_slow_proj` with the new `region` that merges the `new_multiversion_slow_proj` and `new_if_false`. Using `igvn.replace_node` moves all the control inputs of the outputs of the old `multiversion_slow_proj` to the new `region`. This is sufficient during IGVN, but not during loop-opts: the "controllees" of `multiversion_slow_proj` (the nodes that used to answer to `get_ctrl` with `multiversion_slow_proj`) should now be "controllees" of `region` (answer `region` for `get_ctrl`).
This is what `lazy_replace` is for:
- It puts a "forwarding" in the `_loop_and_ctrl` table: instead of mapping `multiversion_slow_proj` to its loop, it now points to the new ctrl node `region`.
- When we call `get_ctrl` on a "controllee" of the old `multiversion_slow_proj`, we then skip over `multiversion_slow_proj` via the "forwarding" to the new `region`.
I'm proposing a PR to improve the documentation and some renamings around `get_ctrl` and `lazy_replace`:
https://github.com/openjdk/jdk/pull/27892
A previous PR that used `lazy_replace`, in case you want to understand more:
https://github.com/openjdk/jdk/pull/15720
-------------
Commit messages:
- JDK-8369898
Changes: https://git.openjdk.org/jdk/pull/27889/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27889&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8369898
Stats: 99 lines in 2 files changed: 98 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/27889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27889/head:pull/27889
PR: https://git.openjdk.org/jdk/pull/27889
More information about the hotspot-compiler-dev
mailing list