8276455: C2: iterative EA

Reviewed-by: iveresov, neliasso, roland
This commit is contained in:
Vladimir Kozlov 2021-12-14 19:24:13 +00:00
parent de65230d71
commit a1dfe57249
10 changed files with 561 additions and 34 deletions

View file

@ -499,6 +499,12 @@ void Compile::print_compile_messages() {
tty->print_cr("** Bailout: Recompile without escape analysis **");
tty->print_cr("*********************************************************");
}
if (do_iterative_escape_analysis() != DoEscapeAnalysis && PrintOpto) {
// Recompiling without iterative escape analysis
tty->print_cr("*********************************************************");
tty->print_cr("** Bailout: Recompile without iterative escape analysis**");
tty->print_cr("*********************************************************");
}
if ((eliminate_boxing() != EliminateAutoBox) && PrintOpto) {
// Recompiling without boxing elimination
tty->print_cr("*********************************************************");
@ -2161,27 +2167,37 @@ void Compile::Optimize() {
if (major_progress()) print_method(PHASE_PHASEIDEAL_BEFORE_EA, 2);
if (failing()) return;
}
ConnectionGraph::do_analysis(this, &igvn);
if (failing()) return;
// Optimize out fields loads from scalar replaceable allocations.
igvn.optimize();
print_method(PHASE_ITER_GVN_AFTER_EA, 2);
if (failing()) return;
if (congraph() != NULL && macro_count() > 0) {
TracePhase tp("macroEliminate", &timers[_t_macroEliminate]);
PhaseMacroExpand mexp(igvn);
mexp.eliminate_macro_nodes();
igvn.set_delay_transform(false);
igvn.optimize();
print_method(PHASE_ITER_GVN_AFTER_ELIMINATION, 2);
bool progress;
do {
ConnectionGraph::do_analysis(this, &igvn);
if (failing()) return;
}
int mcount = macro_count(); // Record number of allocations and locks before IGVN
// Optimize out fields loads from scalar replaceable allocations.
igvn.optimize();
print_method(PHASE_ITER_GVN_AFTER_EA, 2);
if (failing()) return;
if (congraph() != NULL && macro_count() > 0) {
TracePhase tp("macroEliminate", &timers[_t_macroEliminate]);
PhaseMacroExpand mexp(igvn);
mexp.eliminate_macro_nodes();
igvn.set_delay_transform(false);
igvn.optimize();
print_method(PHASE_ITER_GVN_AFTER_ELIMINATION, 2);
if (failing()) return;
}
progress = do_iterative_escape_analysis() &&
(macro_count() < mcount) &&
ConnectionGraph::has_candidates(this);
// Try again if candidates exist and made progress
// by removing some allocations and/or locks.
} while (progress);
}
// Loop transforms on the ideal graph. Range Check Elimination,