Index: pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
index 9988f4724ea68fd59e8ee7567ff93ff64d214ae3..be5cc9c3a0df3efb84b023b8706cc9d0e887033c 100644 |
--- a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
+++ b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart |
@@ -246,8 +246,11 @@ class ShrinkingReducer extends Pass { |
} |
} |
-/// Returns true iff the bound primitive is unused. |
-bool _isDeadVal(LetPrim node) => !node.primitive.hasAtLeastOneUse; |
+/// Returns true iff the bound primitive is unused, and has no effects |
+/// preventing it from being eliminated. |
+bool _isDeadVal(LetPrim node) { |
+ return node.primitive.hasNoUses && node.primitive.isSafeForElimination; |
+} |
/// Returns true iff the continuation is unused. |
bool _isDeadCont(Continuation cont) { |