Index: pkg/compiler/lib/src/ssa/optimize.dart |
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart |
index 3b3a061c6f7eb8ad09f0a83da85e646e85455fd2..f3d934f18c4c48c49a45d3368b3507d855e02b5d 100644 |
--- a/pkg/compiler/lib/src/ssa/optimize.dart |
+++ b/pkg/compiler/lib/src/ssa/optimize.dart |
@@ -905,8 +905,6 @@ class SsaInstructionSimplifier extends HBaseVisitor |
return inputType.isInMask(checkedType, _closedWorld) ? input : node; |
} |
- HInstruction removeCheck(HCheck node) => node.checkedInput; |
- |
FieldEntity findConcreteFieldForDynamicAccess( |
HInstruction receiver, Selector selector) { |
TypeMask receiverType = receiver.instructionType; |
@@ -2201,6 +2199,17 @@ class SsaTypeConversionInserter extends HBaseVisitor |
DominatedUses dominatedUses = DominatedUses.of(input, dominator.first); |
if (dominatedUses.isEmpty) return; |
+ // Check to avoid adding a duplicate HTypeKnown node. |
+ if (dominatedUses.isSingleton) { |
+ HInstruction user = dominatedUses.single; |
+ if (user is HTypeKnown && |
+ user.isPinned && |
+ user.knownType == convertedType && |
+ user.checkedInput == input) { |
+ return; |
+ } |
+ } |
+ |
HTypeKnown newInput = new HTypeKnown.pinned(convertedType, input); |
dominator.addBefore(dominator.first, newInput); |
dominatedUses.replaceWith(newInput); |