Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8291775: C2: assert(r != __null && r->is_Region()) failed: this phi m…
…ust have a region

Reviewed-by: thartmann, kvn
  • Loading branch information
chhagedorn committed Aug 18, 2022
1 parent 0d96546 commit 32d675c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hotspot/share/opto/stringopts.cpp
Expand Up @@ -261,10 +261,12 @@ void StringConcat::eliminate_unneeded_control() {
Node* cmp = bol->in(1);
assert(cmp->is_Cmp(), "unexpected if shape");
if (cmp->in(1)->is_top() || cmp->in(2)->is_top()) {
// This region should lose its Phis and be optimized out by igvn but there's a chance the if folds to top first
// which then causes a reachable part of the graph to become dead.
// This region should lose its Phis. They are removed either in PhaseRemoveUseless (for data phis) or in IGVN
// (for memory phis). During IGVN, there is a chance that the If folds to top before the Region is processed
// which then causes a reachable part of the graph to become dead. To prevent this, set the boolean input of
// the If to a constant to nicely let the diamond Region/If fold away.
Compile* C = _stringopts->C;
C->gvn_replace_by(n, iff->in(0));
C->gvn_replace_by(iff->in(1), _stringopts->gvn()->intcon(0));
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/hotspot/jtreg/compiler/c2/Test7179138_1.java
Expand Up @@ -31,6 +31,9 @@
* compiler.c2.Test7179138_1
* @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN compiler.c2.Test7179138_1
* @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:+AlwaysIncrementalInline
* compiler.c2.Test7179138_1
*
* @author Skip Balk
*/
Expand Down

3 comments on commit 32d675c

@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 32d675c Sep 30, 2022

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 32d675c Sep 30, 2022

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-32d675ca 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 32d675ca from the openjdk/jdk repository.

The commit being backported was authored by Christian Hagedorn on 18 Aug 2022 and was reviewed by Tobias Hartmann 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-32d675ca:GoeLin-backport-32d675ca
$ git checkout GoeLin-backport-32d675ca
# 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-32d675ca

Please sign in to comment.