RFR: 8371716: C2: Phi node fails Value()'s verification when speculative types clash [v3]

Roland Westrelin roland at openjdk.org
Thu Nov 20 16:59:55 UTC 2025


On Thu, 20 Nov 2025 10:53:03 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Additionally, in the test case, the speculative type being empty is correct, the path is speculatively unreachable, maybe we can use that information to cut off the branches, simplify the CFG for better compilation?

Attached is another test case that reproduces the same issue. 
[TestSpeculativeTypes.java](https://github.com/user-attachments/files/23659130/TestSpeculativeTypes.java)

I run that one with:

$ for i in `seq 100`; do java -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileOnly=TestSpeculativeTypes::test2 -XX:CompileOnly=TestSpeculativeTypes::inlined3  -XX:CompileCommand=quiet -XX:TypeProfileLevel=200 -XX:+AlwaysIncrementalInline -XX:VerifyIterativeGVN=10 -XX:CompileCommand=dontinline,TestSpeculativeTypes::notInlined1 -XX:+StressIncrementalInlining TestSpeculativeTypes || break; done

It usually fails after a few runs. That one has conflicting profile data but no dead path. What you're suggesting has some risk and unclear benefits so I think would need to be investigated separately.

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

PR Comment: https://git.openjdk.org/jdk/pull/28331#issuecomment-3559087312


More information about the hotspot-compiler-dev mailing list