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

Unified Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10375048: Don't allow phi equivalences along back-edges. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test. Updated other tests. Simplified isPhiBefore. Created 8 years, 7 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 | « frog/tests/leg_only/regression_2913_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen_helpers.dart
diff --git a/lib/compiler/implementation/ssa/codegen_helpers.dart b/lib/compiler/implementation/ssa/codegen_helpers.dart
index 64453d782273bd701cbabf7e79d867a67e8296ff..44f071cb9c8f6a6d7376292f3549e4a7eb648892 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -440,14 +440,22 @@ class PhiEquivalator {
PhiEquivalator(this.equivalence, this.logicalOperations);
void analyzeGraph(HGraph graph) {
- graph.blocks.forEach((HBasicBlock block) => analyzeBlock(block));
+ graph.blocks.forEach(analyzeBlock);
+ }
+
+ static bool isPhiBeforeUse(HPhi phi1) {
+ assert(phi1.usedBy.length == 1);
+ HPhi phi2 = phi1.usedBy[0];
+ // A phi can never be used in another phi in the same block.
ngeoffray 2012/05/08 09:13:01 That you could assert here.
Lasse Reichstein Nielsen 2012/05/08 09:17:14 I'll just inline it all in the test that already t
+ return phi1.block.id < phi2.block.id;
ngeoffray 2012/05/08 09:13:01 If that is true, maybe also assert that phi2 is a
Lasse Reichstein Nielsen 2012/05/08 09:17:14 Not sure it's necessary. If it's an invariant, it'
}
void analyzeBlock(HBasicBlock block) {
for (HPhi phi = block.phis.first; phi !== null; phi = phi.next) {
if (!logicalOperations.containsKey(phi) &&
phi.usedBy.length == 1 &&
- phi.usedBy[0] is HPhi) {
+ phi.usedBy[0] is HPhi &&
+ isPhiBeforeUse(phi)) {
equivalence.makeEquivalent(phi, phi.usedBy[0]);
}
}
« no previous file with comments | « frog/tests/leg_only/regression_2913_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698