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

Reviewed-by: chagedorn, kvn
  • Loading branch information
TobiHartmann committed Nov 17, 2022
1 parent 5795c76 commit 502fa3e
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 @@ -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);
}

//=============================================================================
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);
}
}

3 comments on commit 502fa3e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 502fa3e Jan 4, 2023

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 502fa3e Jan 4, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch GoeLin-backport-502fa3ee in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 502fa3ee from the openjdk/jdk repository.

The commit being backported was authored by Tobias Hartmann on 17 Nov 2022 and was reviewed by Christian Hagedorn and Vladimir Kozlov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-502fa3ee:GoeLin-backport-502fa3ee
$ git checkout GoeLin-backport-502fa3ee
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-502fa3ee

Please sign in to comment.