Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
#include "opto/opcodes.hpp"
#include "opto/output.hpp"
#include "opto/parse.hpp"
#include "opto/phase.hpp"
#include "opto/phaseloadfolding.hpp"
#include "opto/phaseX.hpp"
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
Expand Down Expand Up @@ -2402,6 +2404,19 @@ void Compile::Optimize() {

if (failing()) return;

{
// This phase is much faster than EA, so doing it before EA reduces the work of EA by reducing
// the number of loads. It also helps EA terminate sooner because folded loads may expose
// further EA opportunities, and it is better if an EA opportunity is revealed from the
// beginning than if it is only revealed after some rounds of EA.
TracePhase tp(_t_loadFolding);
PhaseLoadFolding load_folding(igvn);
load_folding.optimize();
if (failing()) {
return;
}
}

if (has_loops()) {
print_method(PHASE_BEFORE_LOOP_OPTS, 2);
}
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/opto/phase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void Phase::print_timers() {
tty->print_cr (" Conn Graph: %7.3f s", timers[_t_connectionGraph].seconds());
tty->print_cr (" Macro Eliminate: %7.3f s", timers[_t_macroEliminate].seconds());
}
tty->print_cr (" Load Folding: %7.3f s", timers[_t_loadFolding].seconds());
tty->print_cr (" GVN 1: %7.3f s", timers[_t_iterGVN].seconds());

{
Expand Down Expand Up @@ -100,6 +101,7 @@ void Phase::print_timers() {

double other = timers[_t_optimizer].seconds() -
(timers[_t_escapeAnalysis].seconds() +
timers[_t_loadFolding].seconds() +
timers[_t_iterGVN].seconds() +
timers[_t_incrInline].seconds() +
timers[_t_vector].seconds() +
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/opto/phase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Phase : public StackObj {
Remove_Useless_And_Renumber_Live, // First, remove useless nodes from the graph. Then, renumber live nodes.
Optimistic, // Optimistic analysis phase
GVN, // Pessimistic global value numbering phase
LoadFolding, // Aggressively look through loads
Ins_Select, // Instruction selection phase
CFG, // Build a CFG
BlockLayout, // Linear ordering of blocks
Expand All @@ -73,6 +74,7 @@ class Phase : public StackObj {
f( _t_escapeAnalysis, "escapeAnalysis") \
f( _t_connectionGraph, "connectionGraph") \
f( _t_macroEliminate, "macroEliminate") \
f( _t_loadFolding, "loadFolding") \
f( _t_iterGVN, "iterGVN") \
f( _t_incrInline, "incrementalInline") \
f( _t_incrInline_ideal, "incrementalInline_ideal") \
Expand Down
Loading