Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

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

Backport-of: 32d675c
  • Loading branch information
TobiHartmann committed Sep 27, 2022
1 parent a8ca05c commit e8a134a
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

1 comment on commit e8a134a

@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.