RFR: 8367967: C2: "fatal error: Not monotonic" with Mod nodes [v3]
Christian Hagedorn
chagedorn at openjdk.org
Fri Sep 26 08:43:30 UTC 2025
On Thu, 25 Sep 2025 22:15:47 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> I don't see a better alternative except just ignoring 0 divisor case
That probably also works. It seems that for `DivI/L`, we already ignore this case as well.
The question is: What is better when the zero check is not folded but we observe zero for the divisor: Having top to possibly corrupt the graph or just possibly risking miscompilation/div by zero crashes at runtime when the zero check is really off - but not folding the zero check does not necessarily mean it's wrong at runtime. The former is probably easy to catch when it happens while the latter seems more robost but when the zero check is off, it's probably harder to detect/trace back.
> Alternatively, to improve robustness, a dead ModI/ModL can kill dependent control akin to what Roland did for Type nodes with JDK-8349479.
Could be an option. We then should probably also extend it to Div nodes. Might be worth to investigate separately.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27408#discussion_r2381407218
More information about the hotspot-compiler-dev
mailing list