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

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

Issue 2839223003: Use sourceElement when eliminating Phis (Closed)
Patch Set: dartfmt Created 3 years, 8 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 | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | 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 b15ef7b0c1cc32754d03aa7f9b53ecb988affe54..49c0059cfb8c9c964e5dc2d79d3c67c4195eee66 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -235,12 +235,8 @@ class SsaInstructionSimplifier extends HBaseVisitor
// If the replacement instruction does not know its
// source element, use the source element of the
// instruction.
- if (replacement.sourceElement == null) {
- replacement.sourceElement = instruction.sourceElement;
- }
- if (replacement.sourceInformation == null) {
- replacement.sourceInformation = instruction.sourceInformation;
- }
+ replacement.sourceElement ??= instruction.sourceElement;
+ replacement.sourceInformation ??= instruction.sourceInformation;
if (!replacement.isInBasicBlock()) {
// The constant folding can return an instruction that is already
// part of the graph (like an input), so we only add the replacement
@@ -1760,6 +1756,11 @@ class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
if (replacement.dominates(phi)) {
block.rewrite(phi, replacement);
block.removePhi(phi);
+ if (replacement.sourceElement == null &&
+ phi.sourceElement != null &&
+ replacement is! HThis) {
+ replacement.sourceElement = phi.sourceElement;
+ }
}
});
}
@@ -1965,6 +1966,11 @@ class SsaRedundantPhiEliminator implements OptimizationPhase {
}
phi.block.rewrite(phi, candidate);
phi.block.removePhi(phi);
+ if (candidate.sourceElement == null &&
+ phi.sourceElement != null &&
+ candidate is! HThis) {
+ candidate.sourceElement = phi.sourceElement;
+ }
}
}
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698