Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
index b5757726f6a670514de7a9b3c6baa4368aafa454..2957676c99fabc99062e6b000c32821ff4046837 100644 |
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
@@ -1243,7 +1243,7 @@ class SsaGlobalValueNumberer implements OptimizationPhase { |
&& loopHeader.successors[0] == block); |
while (instruction != null) { |
HInstruction next = instruction.next; |
- if (instruction.useGvn() |
+ if (instruction.useGvn() && instruction.isMovable |
&& (!instruction.canThrow() || firstInstructionInLoop) |
&& !instruction.sideEffects.dependsOn(dependsFlags)) { |
bool loopInvariantInputs = true; |
@@ -1465,11 +1465,7 @@ class SsaCodeMotion extends HBaseVisitor implements OptimizationPhase { |
HInstruction current = instruction; |
instruction = instruction.next; |
- |
- // TODO(ngeoffray): this check is needed because we currently do |
- // not have flags to express 'Gvn'able', but not movable. |
- if (current is HCheck) continue; |
- if (!current.useGvn()) continue; |
+ if (!current.useGvn() || !current.isMovable) continue; |
if (current.sideEffects.dependsOn(dependsFlags)) continue; |
bool canBeMoved = true; |
@@ -1504,14 +1500,15 @@ class SsaTypeConversionInserter extends HBaseVisitor |
} |
// Update users of [input] that are dominated by [:dominator.first:] |
- // to use [newInput] instead. |
+ // to use [newInput] instead. As the type information depends on the |
+ // control flow, we mark the inserted [HTypeKnown] nodes as non-movable. |
void changeUsesDominatedBy(HBasicBlock dominator, |
floitsch
2014/03/20 16:07:25
Nit: we should change the name. It's not just chan
herhut
2014/03/20 16:25:11
It is now called [insertTypePropagationForDominate
|
HInstruction input, |
TypeMask convertedType) { |
Setlet<HInstruction> dominatedUsers = input.dominatedUsers(dominator.first); |
if (dominatedUsers.isEmpty) return; |
- HTypeKnown newInput = new HTypeKnown(convertedType, input); |
+ HTypeKnown newInput = new HTypeKnown.pinned(convertedType, input); |
dominator.addBefore(dominator.first, newInput); |
dominatedUsers.forEach((HInstruction user) { |
user.changeUse(input, newInput); |