| 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];
|
|
|