RFR: JDK-8289748: C2 compiled code crashes with SIGFPE with -XX:+StressLCM and -XX:+StressGCM [v3]
Tobias Holenstein
tholenstein at openjdk.org
Thu Jan 19 08:39:03 UTC 2023
> # Problem
>
> We have an outer strip-mined loop `207`/`205` with inner strip-mined loop `283`/`203`. `262` is the zero-trip guard and `157 ModI` has the trip count `284 Phi` in the divisor. The corresponding zero guard of `157 ModI` was removed because the divisor is guaranteed to always be non-zero.
>
> `PhaseIdealLoop::cast_incr_before_loop(..)` inserts a CastII to pin `284 Phi` to `262 if` but the following `igvn` phase removes the CastII again because it becomes a constant. Therefore, `284 Phi` loses its pin to `262 if`.
> 
>
> `IdealLoopTree::do_remove_empty_loop(..)` removes the loop `283`/`203` and replaces `284 Phi` with the final value of the last iteration. The problem is that the computation of final value (exact_limit - stride) floats above `262 if` - so now `157 ModI` is not guarded by `262 if` anymore: in our attached test case we get an `SIGFPE` because the modulo divides by zero at runtime.
>
> 
>
> # Solution
> The solution is to insert a `CastII` in `IdealLoopTree::do_remove_empty_loop(..)` to prevent final_iv (exact_limit - stride) to float above the zero trip guard.
>
> 
Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:
update comment
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11990/files
- new: https://git.openjdk.org/jdk/pull/11990/files/53ec94ed..13efabd1
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11990&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11990&range=01-02
Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/11990.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11990/head:pull/11990
PR: https://git.openjdk.org/jdk/pull/11990
More information about the hotspot-compiler-dev
mailing list