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

Unified Diff: pkg/compiler/lib/src/ssa/codegen_helpers.dart

Issue 1913843003: Revert "Fix for issue 26243 - illegal motion of assignments in instruction merging" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen_helpers.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index 681056f6ce29c694a6765c1b4b8a75f95c323d1d..254e577a31f6141119a0e9d6f9c1fd77a60370a7 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -353,7 +353,7 @@ class SsaInstructionMerger extends HBaseVisitor {
input is! HPhi &&
input is! HLocalValue &&
!input.isJsStatement()) {
- if (isEffectivelyPure(input)) {
+ if (input.isPure()) {
// Only consider a pure input if it is in the same loop.
// Otherwise, we might move GVN'ed instruction back into the
// loop.
@@ -382,25 +382,6 @@ class SsaInstructionMerger extends HBaseVisitor {
}
}
- // Some non-pure instructions may be treated as pure. HLocalGet depends on
- // assignments, but we can ignore the initializing assignment since it will by
- // construction always precede a use.
- bool isEffectivelyPure(HInstruction instruction) {
- if (instruction is HLocalGet) return !isAssignedLocal(instruction.local);
- return instruction.isPure();
- }
-
- bool isAssignedLocal(HLocalValue local) {
- // [HLocalValue]s have an initializing assignment which is guaranteed to
- // precede the use, except for [HParameterValue]s which are 'assigned' at
- // entry.
- int initializingAssignmentCount = (local is HParameterValue) ? 0 : 1;
- return local.usedBy
- .where((user) => user is HLocalSet)
- .skip(initializingAssignmentCount)
- .isNotEmpty;
- }
-
void visitInstruction(HInstruction instruction) {
// A code motion invariant instruction is dealt before visiting it.
assert(!instruction.isCodeMotionInvariant());
@@ -500,7 +481,7 @@ class SsaInstructionMerger extends HBaseVisitor {
// Pop instructions from expectedInputs until instruction is found.
// Return true if it is found, or false if not.
bool findInInputsAndPopNonMatching(HInstruction instruction) {
- assert(!isEffectivelyPure(instruction));
+ assert(!instruction.isPure());
while (!expectedInputs.isEmpty) {
HInstruction nextInput = expectedInputs.removeLast();
assert(!generateAtUseSite.contains(nextInput));
@@ -523,7 +504,7 @@ class SsaInstructionMerger extends HBaseVisitor {
markAsGenerateAtUseSite(instruction);
continue;
}
- if (isEffectivelyPure(instruction)) {
+ if (instruction.isPure()) {
if (pureInputs.contains(instruction)) {
tryGenerateAtUseSite(instruction);
} else {
@@ -569,7 +550,7 @@ class SsaInstructionMerger extends HBaseVisitor {
// push expected-inputs from left-to right, and the `pure` function
// invocation is "more left" (i.e. before) the first argument of `f`.
// With that approach we end up with:
- // t3 = pure(foo());
+ // t3 = pure(foo();
// f(bar(), t3);
// use(t3);
//
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698