RFR: 8350329: C2: Div looses dependency on condition that guarantees divisor not zero in counted loop after peeling
Roland Westrelin
roland at openjdk.org
Fri May 16 08:33:33 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.
-------------
Commit messages:
- test
- fix
Changes: https://git.openjdk.org/jdk/pull/25262/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25262&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8350329
Stats: 62 lines in 2 files changed: 60 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