RFR: 8324517: C2: crash in compiled code because of dependency on removed range check CastIIs [v2]

Roland Westrelin roland at openjdk.org
Fri May 3 10:20:54 UTC 2024


On Mon, 22 Apr 2024 11:44:27 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> `Op_ModI` and `Op_ModL` are missing here.

Good catch! I added test cases for `Op_ModI` and `Op_ModL` , the unsigned variants and the also the DivMod variants. I also fixed the patch so it handles all of them.

>  And isn't this too strong in cases where we can prove that the operand is non-zero?

I don't think it's too string. The operand can be non zero because of a range check `CastII` somewhere along the subgraph that starts at the node's second input. In that case, `PhaseIterGVN::no_dependent_zero_check` would return true but removing the range `CastII` would cause the bugs that are triggered by the test case.

> Looking at `PhaseIterGVN::no_dependent_zero_check`, I noticed that `UDiv[I/L]Node` and `UMod[I/L]Node` are not handled but I think they should. I think this was missed when these nodes where added by [JDK-8282221](https://bugs.openjdk.org/browse/JDK-8282221). One can probably extend @chhagedorn's test from [JDK-8259227](https://bugs.openjdk.org/browse/JDK-8259227) to trigger the same issue.

That seems like a different problem that out of the scope of this particular issue.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18377#discussion_r1589017668


More information about the hotspot-compiler-dev mailing list