Skip to content

Commit

Permalink
8296912: C2: CreateExNode::Identity fails with assert(i < _max) faile…
Browse files Browse the repository at this point in the history
…d: oob: i=1, _max=1

Backport-of: 502fa3eeea849cfcc50436602be1654695ef4e26
  • Loading branch information
GoeLin committed Jan 9, 2023
1 parent d784aae commit ad04159
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/hotspot/share/opto/cfgnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2717,9 +2717,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);
}

//=============================================================================
Expand Down
31 changes: 27 additions & 4 deletions test/hotspot/jtreg/compiler/c2/TestDeadDataLoop.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down Expand Up @@ -216,10 +219,29 @@ static void test10() {
}
}

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;
Expand All @@ -234,6 +256,7 @@ public static void main(String[] args) {
test8();
test9();
test10();
test11(false);
}
}

1 comment on commit ad04159

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.