Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8291775: C2: assert(r != __null && r->is_Region()) failed: this phi must have a region #760

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hotspot/share/opto/stringopts.cpp
Expand Up @@ -294,10 +294,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 @@ -30,6 +30,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