7107042: assert(no_dead_loop) failed: dead loop detected

Use dead nodes elimination code in PhaseIdealLoop before executing EA.

Reviewed-by: never, twisti
This commit is contained in:
Vladimir Kozlov 2011-11-09 07:25:51 -08:00
parent dc1f4fe50e
commit 09b7902e14
9 changed files with 57 additions and 23 deletions

View file

@ -346,15 +346,15 @@ void Compile::identify_useful_nodes(Unique_Node_List &useful) {
// Disconnect all useless nodes by disconnecting those at the boundary.
void Compile::remove_useless_nodes(Unique_Node_List &useful) {
uint next = 0;
while( next < useful.size() ) {
while (next < useful.size()) {
Node *n = useful.at(next++);
// Use raw traversal of out edges since this code removes out edges
int max = n->outcnt();
for (int j = 0; j < max; ++j ) {
for (int j = 0; j < max; ++j) {
Node* child = n->raw_out(j);
if( ! useful.member(child) ) {
assert( !child->is_top() || child != top(),
"If top is cached in Compile object it is in useful list");
if (! useful.member(child)) {
assert(!child->is_top() || child != top(),
"If top is cached in Compile object it is in useful list");
// Only need to remove this out-edge to the useless node
n->raw_del_out(j);
--j;
@ -362,7 +362,14 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) {
}
}
if (n->outcnt() == 1 && n->has_special_unique_user()) {
record_for_igvn( n->unique_out() );
record_for_igvn(n->unique_out());
}
}
// Remove useless macro and predicate opaq nodes
for (int i = C->macro_count()-1; i >= 0; i--) {
Node* n = C->macro_node(i);
if (!useful.member(n)) {
remove_macro_node(n);
}
}
debug_only(verify_graph_edges(true/*check for no_dead_code*/);)
@ -719,6 +726,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
while (_late_inlines.length() > 0) {
CallGenerator* cg = _late_inlines.pop();
cg->do_late_inline();
if (failing()) return;
}
}
assert(_late_inlines.length() == 0, "should have been processed");
@ -1691,13 +1699,20 @@ void Compile::Optimize() {
// Perform escape analysis
if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
if (has_loops()) {
// Cleanup graph (remove dead nodes).
TracePhase t2("idealLoop", &_t_idealLoop, true);
PhaseIdealLoop ideal_loop( igvn, false, true );
if (major_progress()) print_method("PhaseIdealLoop before EA", 2);
if (failing()) return;
}
TracePhase t2("escapeAnalysis", &_t_escapeAnalysis, true);
ConnectionGraph::do_analysis(this, &igvn);
if (failing()) return;
igvn.optimize();
print_method("Iter GVN 3", 2);
print_method("Iter GVN after EA", 2);
if (failing()) return;