Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 2315143002: Another round of GVN is sometimes worthwhile after code motion (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index f15dceba538109b5baf66911a00f60440c742aa2..553709b44c2878ee11e78a811a39c0a842c00b95 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -51,6 +51,7 @@ class SsaOptimizerTask extends CompilerTask {
ConstantSystem constantSystem = compiler.backend.constantSystem;
bool trustPrimitives = compiler.options.trustPrimitives;
Set<HInstruction> boundsChecked = new Set<HInstruction>();
+ SsaCodeMotion codeMotion;
measure(() {
List<OptimizationPhase> phases = <OptimizationPhase>[
// Run trivial instruction simplification first to optimize
@@ -74,7 +75,7 @@ class SsaOptimizerTask extends CompilerTask {
// After GVN, some instructions might need their type to be
// updated because they now have different inputs.
new SsaTypePropagator(compiler),
- new SsaCodeMotion(),
+ codeMotion = new SsaCodeMotion(),
new SsaLoadElimination(compiler),
new SsaRedundantPhiEliminator(),
new SsaDeadPhiEliminator(),
@@ -95,7 +96,7 @@ class SsaOptimizerTask extends CompilerTask {
SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(compiler, this);
runPhase(dce);
- if (dce.eliminatedSideEffects) {
+ if (codeMotion.movedCode || dce.eliminatedSideEffects) {
phases = <OptimizationPhase>[
new SsaTypePropagator(compiler),
new SsaGlobalValueNumberer(compiler),
@@ -1913,6 +1914,7 @@ class SsaGlobalValueNumberer implements OptimizationPhase {
class SsaCodeMotion extends HBaseVisitor implements OptimizationPhase {
final String name = "SsaCodeMotion";
+ bool movedCode = false;
List<ValueSet> values;
void visitGraph(HGraph graph) {
@@ -1949,6 +1951,7 @@ class SsaCodeMotion extends HBaseVisitor implements OptimizationPhase {
if (toRewrite != instruction) {
successor.rewriteWithBetterUser(toRewrite, instruction);
successor.remove(toRewrite);
+ movedCode = true;
}
}
}
@@ -1992,6 +1995,7 @@ class SsaCodeMotion extends HBaseVisitor implements OptimizationPhase {
} else {
block.rewriteWithBetterUser(current, existing);
block.remove(current);
+ movedCode = true;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698