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

Unified Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10084002: Add the first phi's input as possible generate-at-use-site. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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: 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 cb2239659f0727c25595a285e87cfe79262b6bab..171953546c2fa33b8c1c0775e53559eccca425db 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -24,7 +24,7 @@ class SsaInstructionMerger extends HBaseVisitor {
bool usedOnlyByPhis(instruction) {
for (HInstruction user in instruction.usedBy) {
- if (user is !HPhi) return false;
+ if (user is! HPhi) return false;
}
return true;
}
@@ -35,7 +35,8 @@ class SsaInstructionMerger extends HBaseVisitor {
for (HInstruction input in instruction.inputs) {
if (!generateAtUseSite.contains(input)
&& !input.isCodeMotionInvariant()
- && input.usedBy.length == 1) {
+ && input.usedBy.length == 1
+ && input is! HPhi) {
expectedInputs.add(input);
}
}
@@ -96,13 +97,32 @@ class SsaInstructionMerger extends HBaseVisitor {
HInstruction nextInput = expectedInputs.removeLast();
assert(!generateAtUseSite.contains(nextInput));
assert(nextInput.usedBy.length == 1);
- if (nextInput == instruction) {
+ if (nextInput === instruction) {
return true;
}
}
return false;
}
+ for (HBasicBlock successor in block.successors) {
+ // Only add the input of the first phi. Making inputs of
+ // later phis generate-at-use-site would make them move
+ // accross the assignment of the first phi, and we need
+ // more analysis before we can do that.
+ HPhi phi = successor.phis.first;
+ if (phi != null) {
+ int index = successor.predecessors.indexOf(block);
+ HInstruction input = phi.inputs[index];
+ if (!generateAtUseSite.contains(input)
+ && !input.isCodeMotionInvariant()
+ && input.usedBy.length == 1
+ && input is! HPhi) {
+ expectedInputs.add(input);
+ }
+ break;
+ }
+ }
+
block.last.accept(this);
for (HInstruction instruction = block.last.previous;
instruction !== null;
« frog/tests/leg/src/TypeInferenceTest.dart ('K') | « frog/tests/leg/src/TypeInferenceTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698