8296912: C2: CreateExNode::Identity fails with assert(i < _max) failed: oob: i=1, _max=1

Reviewed-by: chagedorn, kvn
This commit is contained in:
Tobias Hartmann 2022-11-17 07:39:57 +00:00
parent 5795c760db
commit 502fa3eeea
2 changed files with 29 additions and 7 deletions

View File

@ -2782,9 +2782,8 @@ Node* CreateExNode::Identity(PhaseGVN* phase) {
// exception oop through.
CallNode *call = in(1)->in(0)->as_Call();
return ( in(0)->is_CatchProj() && in(0)->in(0)->in(1) == in(1) )
? this
: call->in(TypeFunc::Parms);
return (in(0)->is_CatchProj() && in(0)->in(0)->is_Catch() &&
in(0)->in(0)->in(1) == in(1)) ? this : call->in(TypeFunc::Parms);
}
//=============================================================================

View File

@ -23,17 +23,20 @@
/*
* @test
* @bug 8284358
* @bug 8284358 8296912
* @summary An unreachable loop is not removed, leading to a broken graph.
* @requires vm.compiler2.enabled
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1448005075
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
* compiler.c2.TestDeadDataLoop
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1922737097
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
* compiler.c2.TestDeadDataLoop
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=2472844645
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
* compiler.c2.TestDeadDataLoop
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
* compiler.c2.TestDeadDataLoop
*/
@ -216,10 +219,29 @@ public class TestDeadDataLoop {
}
}
static long l;
static void test11(boolean never) {
float f = 1;
boolean b;
for (int i = 0; i < 5; ++i) {
b = (never || l < 0);
l = notInlined2();
if (!never) {
f += i;
}
}
l += f;
}
public static boolean notInlined() {
return false;
}
public static int notInlined2() {
return 42;
}
public static void main(String[] args) {
// Make sure classes are initialized
Integer i = 42;
@ -234,6 +256,7 @@ public class TestDeadDataLoop {
test8();
test9();
test10();
test11(false);
}
}