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

Side by Side 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: Inline before-check 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/tests/leg_only/regression_2913_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Instead of emitting each SSA instruction with a temporary variable 6 * Instead of emitting each SSA instruction with a temporary variable
7 * mark instructions that can be emitted at their use-site. 7 * mark instructions that can be emitted at their use-site.
8 * For example, in: 8 * For example, in:
9 * t0 = 4; 9 * t0 = 4;
10 * t1 = 3; 10 * t1 = 3;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 // All binary operators (excluding assignment) are left associative. 433 // All binary operators (excluding assignment) are left associative.
434 int get precedence() => left; 434 int get precedence() => left;
435 } 435 }
436 436
437 class PhiEquivalator { 437 class PhiEquivalator {
438 final Equivalence<HPhi> equivalence; 438 final Equivalence<HPhi> equivalence;
439 final Map<HPhi, String> logicalOperations; 439 final Map<HPhi, String> logicalOperations;
440 PhiEquivalator(this.equivalence, this.logicalOperations); 440 PhiEquivalator(this.equivalence, this.logicalOperations);
441 441
442 void analyzeGraph(HGraph graph) { 442 void analyzeGraph(HGraph graph) {
443 graph.blocks.forEach((HBasicBlock block) => analyzeBlock(block)); 443 graph.blocks.forEach(analyzeBlock);
444 } 444 }
445 445
446 void analyzeBlock(HBasicBlock block) { 446 void analyzeBlock(HBasicBlock block) {
447 for (HPhi phi = block.phis.first; phi !== null; phi = phi.next) { 447 for (HPhi phi = block.phis.first; phi !== null; phi = phi.next) {
448 if (!logicalOperations.containsKey(phi) && 448 if (!logicalOperations.containsKey(phi) &&
449 phi.usedBy.length == 1 && 449 phi.usedBy.length == 1 &&
450 phi.usedBy[0] is HPhi) { 450 phi.usedBy[0] is HPhi &&
451 phi.block.id < phi.usedBy[0].block.id) {
451 equivalence.makeEquivalent(phi, phi.usedBy[0]); 452 equivalence.makeEquivalent(phi, phi.usedBy[0]);
452 } 453 }
453 } 454 }
454 } 455 }
455 } 456 }
456 457
457 458
458 /** 459 /**
459 * Try to figure out which phis can be represented by the same temporary 460 * Try to figure out which phis can be represented by the same temporary
460 * variable, to avoid creating a new variable for each phi. 461 * variable, to avoid creating a new variable for each phi.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // improving the performance of future lookups. 493 // improving the performance of future lookups.
493 T root = getRepresentative(parent); 494 T root = getRepresentative(parent);
494 if (root !== parent) representative[element] = root; 495 if (root !== parent) representative[element] = root;
495 return root; 496 return root;
496 } 497 }
497 498
498 bool areEquivalent(T a, T b) { 499 bool areEquivalent(T a, T b) {
499 return getRepresentative(a) === getRepresentative(b); 500 return getRepresentative(a) === getRepresentative(b);
500 } 501 }
501 } 502 }
OLDNEW
« 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