RFR: 8367483: C2 crash in PhaseValues::type: assert(t != nullptr) failed: must set before get - missing notification for CastX2P(SubL(x, y))

Christian Hagedorn chagedorn at openjdk.org
Fri Sep 12 08:44:26 UTC 2025


On Fri, 12 Sep 2025 08:18:40 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> `CastX2PNode::Ideal` optimizes cases:
> 
> CastX2P(AddX(x, y)) -> AddP(CastX2P(x), y)
> CastX2P(SubL(x, y)) -> AddP(CastX2P(x), SubL(0, y))
> 
> 
> But the notification code `PhaseIterGVN::add_users_of_use_to_worklist` only adds `CastX2P` to the worklist for the `AddX` and not the `SubX` cases.
> 
> ---------------------------------------
> 
> A little brag: this is the second (unrelated, i.e. non aliasing) bug that `TestAliasingFuzzer.java` found. Fuzzing access to native MemorySegment seems to trigger new/rare patterns.

Otherwise, looks good!

test/hotspot/jtreg/compiler/c2/gvn/MissedOptimizationWithCastX2PSubX.java line 1:

> 1: /*

There is a `compiler/igvn` test folder. I think this suits better than `c2/gvn`.

test/hotspot/jtreg/compiler/c2/gvn/MissedOptimizationWithCastX2PSubX.java line 34:

> 32:  *           -XX:-TieredCompilation
> 33:  *           -XX:+IgnoreUnrecognizedVMOptions
> 34:  *           -XX:+UnlockDiagnosticVMOptions

These are not required:
Suggestion:

 *           -XX:CompileCommand=compileonly,compiler.c2.gvn.MissedOptimizationWithCastX2PSubX::test
 *           -XX:-TieredCompilation
 *           -XX:+IgnoreUnrecognizedVMOptions

test/hotspot/jtreg/compiler/c2/gvn/MissedOptimizationWithCastX2PSubX.java line 37:

> 35:  *           -XX:VerifyIterativeGVN=1110
> 36:  *           compiler.c2.gvn.MissedOptimizationWithCastX2PSubX
> 37:  * @run driver compiler.c2.gvn.MissedOptimizationWithCastX2PSubX

Should be `main` to allow additional flags to be passed in.
Suggestion:

 * @run main compiler.c2.gvn.MissedOptimizationWithCastX2PSubX

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27249#pullrequestreview-3215370623
PR Review Comment: https://git.openjdk.org/jdk/pull/27249#discussion_r2343421069
PR Review Comment: https://git.openjdk.org/jdk/pull/27249#discussion_r2343415661
PR Review Comment: https://git.openjdk.org/jdk/pull/27249#discussion_r2343416742


More information about the hotspot-compiler-dev mailing list