| 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 4344721da0b14d7f8ad8f767a296dbf9ed10fc3e..0659f46db9ef31cee7fc2aeb8853d25326a1a1a2 100644
|
| --- a/lib/compiler/implementation/ssa/codegen_helpers.dart
|
| +++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
|
| @@ -52,16 +52,26 @@ class SsaInstructionMerger extends HBaseVisitor {
|
| // they would not be alive.
|
| void visitTypeGuard(HTypeGuard instruction) {}
|
|
|
| - // If an equality operation is builtin it must not have its input generated at
|
| - // use site, because it's using it multiple times (because of null/undefined).
|
| + // If an equality operation is builtin it must only have its inputs generated
|
| + // at use site if it does not require an expression with repeated uses
|
| + // (because of null / undefined).
|
| void visitEquals(HEquals instruction) {
|
| if (!instruction.builtin) super.visitEquals(instruction);
|
| - // Otherwise do nothing.
|
| + if (singleIdentityComparison(instruction.left, instruction.right) != null) {
|
| + super.visitEquals(instruction);
|
| + }
|
| + // Do nothing.
|
| }
|
|
|
| - // Identity operations must not have its input generated at use site, because
|
| - // it's using it multiple times (because of null/undefined).
|
| - void visitIdentity(HIdentity instruction) {}
|
| + // An identity operation must only have its inputs generated at use site if
|
| + // does not require an expression with multiple uses (because of null /
|
| + // undefined).
|
| + void visitIdentity(HIdentity instruction) {
|
| + if (singleIdentityComparison(instruction.left, instruction.right) != null) {
|
| + super.visitIdentity(instruction);
|
| + }
|
| + // Do nothing.
|
| + }
|
|
|
| void visitTypeConversion(HTypeConversion instruction) {
|
| if (!instruction.isChecked) {
|
|
|