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

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

Issue 10566021: Reapply change to GVN all HFieldGet instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index af319b4b597f770c952586141180811c68b5f503..79deacf0a2e6a60de79240522fd98b00cfc158dd 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -711,12 +711,11 @@ class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
final String name = "SsaDeadCodeEliminator";
static bool isDeadCode(HInstruction instruction) {
- // TODO(ngeoffray): the way we handle side effects is not right
- // (e.g. branching instructions have side effects).
return !instruction.hasSideEffects()
&& instruction.usedBy.isEmpty()
&& instruction is !HCheck
- && instruction is !HTypeGuard;
+ && instruction is !HTypeGuard
+ && !instruction.isControlFlow();
}
void visitGraph(HGraph graph) {
@@ -904,13 +903,16 @@ class SsaGlobalValueNumberer implements OptimizationPhase {
void visitBasicBlock(HBasicBlock block, ValueSet values) {
HInstruction instruction = block.first;
+ if (block.isLoopHeader()) {
+ int flags = loopChangesFlags[block.id];
+ values.kill(flags);
+ }
while (instruction !== null) {
HInstruction next = instruction.next;
int flags = instruction.getChangesFlags();
- if (flags != 0) {
- assert(!instruction.useGvn());
- values.kill(flags);
- } else if (instruction.useGvn()) {
+ assert(flags == 0 || !instruction.useGvn());
+ values.kill(flags);
+ if (instruction.useGvn()) {
HInstruction other = values.lookup(instruction);
if (other !== null) {
assert(other.gvnEquals(instruction) && instruction.gvnEquals(other));
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698