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

Unified Diff: pkg/compiler/lib/src/cps_ir/octagon.dart

Issue 1479193002: dart2js cps: Add more constraint rules to bounds-check elimination. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years 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/cps_ir/bounds_checker.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/octagon.dart
diff --git a/pkg/compiler/lib/src/cps_ir/octagon.dart b/pkg/compiler/lib/src/cps_ir/octagon.dart
index 34a9ab580bf516c8cff0c68ddc387bc2aa6c002f..691c15d9caa97f55d00b56584ed8cfd81dcefbdb 100644
--- a/pkg/compiler/lib/src/cps_ir/octagon.dart
+++ b/pkg/compiler/lib/src/cps_ir/octagon.dart
@@ -179,13 +179,15 @@ class Octagon {
// Do a single-source shortest paths reaching out from (-v2).
updateDistance(constraint.v2.negated, 0);
iterateWorklist();
- int distanceToV2 = distance[constraint.v2];
- if (distanceToV2 != null) {
- // Allow one use of the B edge.
- // This must be done outside fixpoint iteration as an infinite loop
- // would arise when an negative-weight cycle using only B exists.
- updateDistance(constraint.v1.negated, distanceToV2 + constraint.bound);
- iterateWorklist();
+ if (constraint.v1 != constraint.v2) {
+ int distanceToV2 = distance[constraint.v2];
+ if (distanceToV2 != null) {
+ // Allow one use of the B edge.
+ // This must be done outside fixpoint iteration as an infinite loop
+ // would arise when an negative-weight cycle using only B exists.
+ updateDistance(constraint.v1.negated, distanceToV2 + constraint.bound);
+ iterateWorklist();
+ }
}
// Get the distance to (v1) and check if the A edge would complete a cycle.
int distanceToV1 = distance[constraint.v1];
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/bounds_checker.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698