RFR: 8350329: C2: Div looses dependency on condition that guarantees divisor not zero in counted loop after peeling [v2]
Roland Westrelin
roland at openjdk.org
Fri May 16 12:45:16 UTC 2025
> This is an issue similar to 8349139: the type of the iv phi of a
> counted loop is narrowed down so a `Div` node doesn't need a control
> input. The loop is then peeled. The `Div` in the loop body is
> guaranteed to be non zero only if it is actually executed so the `Div`
> is implicitly dependent on the zero trip guard. Then the loop looses
> its backedge and the `Div` freely floats. The `Div` instruction is
> scheduled above the zero trip guard and faults. Had the `Div` been
> control dependent on the zero trip guard, it wouldn't have
> executed. The fix, similar to 8349139 is to add a `CastII` on peeling
> to make the dependency between what's in the loop body and relies on
> the narrowed down type of the iv phi and the zero trip guard explicit.
Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
review
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/25262/files
- new: https://git.openjdk.org/jdk/pull/25262/files/eb3a13b3..f5069b5e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=25262&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=25262&range=00-01
Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/25262.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25262/head:pull/25262
PR: https://git.openjdk.org/jdk/pull/25262
More information about the hotspot-compiler-dev
mailing list