RFR: 8367967: C2: "fatal error: Not monotonic" with Mod nodes

Benoît Maillard bmaillard at openjdk.org
Mon Sep 22 13:26:51 UTC 2025


On Sun, 21 Sep 2025 06:11:11 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> Generally, we shouldn't return a wider type (ZERO) if there is a later case that would return a more narrow type (TOP) for the same input types. If the inputs are widened and the first case doesn't match anymore but the later one still does, the result is not monotonic with the previous result.
> 
> Please review :)

Looks good to me, I only have one minor comment.

test/hotspot/jtreg/compiler/c2/TestModValueMonotonic.java line 28:

> 26:  * @bug 8367967
> 27:  * @summary Ensure ModI/LNode::Value is monotonic with potential divison by 0
> 28:  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:CompileOnly=compiler.c2.TestModValueMonotonic::test*

You could probably add another `@run main ...` without flags to potentially catch other things in the future

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

PR Review: https://git.openjdk.org/jdk/pull/27408#pullrequestreview-3252765581
PR Review Comment: https://git.openjdk.org/jdk/pull/27408#discussion_r2368382691


More information about the hotspot-compiler-dev mailing list