Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1619)

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 206553002: Prevent hoisting of certain check nodes, including [HTypeKnown]. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698