Same as JDK-8367245, but now also in mainline.
java -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileOnly=TestSpeculativeTypes::test1 -XX:CompileCommand=quiet -XX:TypeProfileLevel=222 -XX:+AlwaysIncrementalInline -XX:VerifyIterativeGVN=10 -XX:CompileCommand=dontinline,TestSpeculativeTypes::notInlined1 TestSpeculativeTypes.java
Missed Value optimization:
dist dump
---------------------------------------------
1 83 ConP === 0 [[ 52 ]] #null
1 116 CheckCastPP === 111 108 [[ 52 ]] #java/lang/Object * (speculative=TestSpeculativeTypes$C2:NotNull:exact * (inline_depth=3)) Oop:java/lang/Object * (speculative=TestSpeculativeTypes$C2:NotNull:exact * (inline_depth=3)) !orig=[80] !jvms: TestSpeculativeTypes::inlined2 @ bci:12 (line 25) TestSpeculativeTypes::inlined1 @ bci:5 (line 16) TestSpeculativeTypes::test1 @ bci:2 (line 11)
1 48 Region === 48 111 60 [[ 48 52 49 50 42 39 ]] !jvms: TestSpeculativeTypes::test1 @ bci:2 (line 11)
0 52 Phi === 48 116 83 [[ 39 ]] #java/lang/Object * Oop:java/lang/Object * !jvms: TestSpeculativeTypes::test1 @ bci:2 (line 11)
Current type:
java/lang/Object *
Optimized type:
java/lang/Object * (speculative=TestSpeculativeTypes$C2:exact *)
In short: in the case where PhiNode::_type and the meet of the inputs of the PhiNode have incompatible opinion on speculative types, PhiNode::Value will filter both and drop speculative type becoming the new PhiNode::_type. During verification, the same filter gives a different result since the new _type doesn't contain speculative types, so there is no clash, and no need to drop it.
Reproducer was found by Roland, see the discussion in the PR of JDK-8367245.
java -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileOnly=TestSpeculativeTypes::test1 -XX:CompileCommand=quiet -XX:TypeProfileLevel=222 -XX:+AlwaysIncrementalInline -XX:VerifyIterativeGVN=10 -XX:CompileCommand=dontinline,TestSpeculativeTypes::notInlined1 TestSpeculativeTypes.java
Missed Value optimization:
dist dump
---------------------------------------------
1 83 ConP === 0 [[ 52 ]] #null
1 116 CheckCastPP === 111 108 [[ 52 ]] #java/lang/Object * (speculative=TestSpeculativeTypes$C2:NotNull:exact * (inline_depth=3)) Oop:java/lang/Object * (speculative=TestSpeculativeTypes$C2:NotNull:exact * (inline_depth=3)) !orig=[80] !jvms: TestSpeculativeTypes::inlined2 @ bci:12 (line 25) TestSpeculativeTypes::inlined1 @ bci:5 (line 16) TestSpeculativeTypes::test1 @ bci:2 (line 11)
1 48 Region === 48 111 60 [[ 48 52 49 50 42 39 ]] !jvms: TestSpeculativeTypes::test1 @ bci:2 (line 11)
0 52 Phi === 48 116 83 [[ 39 ]] #java/lang/Object * Oop:java/lang/Object * !jvms: TestSpeculativeTypes::test1 @ bci:2 (line 11)
Current type:
java/lang/Object *
Optimized type:
java/lang/Object * (speculative=TestSpeculativeTypes$C2:exact *)
In short: in the case where PhiNode::_type and the meet of the inputs of the PhiNode have incompatible opinion on speculative types, PhiNode::Value will filter both and drop speculative type becoming the new PhiNode::_type. During verification, the same filter gives a different result since the new _type doesn't contain speculative types, so there is no clash, and no need to drop it.
Reproducer was found by Roland, see the discussion in the PR of JDK-8367245.
- relates to
-
JDK-8367245 [lworld] C2 compilation fails with "Missed optimization opportunity in PhaseIterGVN"
-
- In Progress
-