summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_simplifier_arm64.h
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2016-03-29 13:54:53 -0700
committer Aart Bik <ajcbik@google.com> 2016-03-30 11:10:45 -0700
commit968056faf5c2cf118321871ebf234fe70db1c3c8 (patch)
tree2f7a6a13a80adfa2b552bf3e3f76919ac4c9ee0a /compiler/optimizing/instruction_simplifier_arm64.h
parent6f51d7756a9c66007fe7666b19399e1f60ff6092 (diff)
Fix arm64 simplifier bug that tries to remove same statement twice.
With fail-before/pass-after test (on arm64). Rationale: This visitor removes statement "forward", which is a bit unusual, and exposes a bug if statement is revisited and qualifies for removal again. BUG=27851582 Change-Id: Ia8cddba32b4dfe9fd480852deb358eaa977f0e1f
Diffstat (limited to 'compiler/optimizing/instruction_simplifier_arm64.h')
-rw-r--r--compiler/optimizing/instruction_simplifier_arm64.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_simplifier_arm64.h b/compiler/optimizing/instruction_simplifier_arm64.h
index 338120bbbc..da269980e8 100644
--- a/compiler/optimizing/instruction_simplifier_arm64.h
+++ b/compiler/optimizing/instruction_simplifier_arm64.h
@@ -51,6 +51,22 @@ class InstructionSimplifierArm64Visitor : public HGraphVisitor {
return TryMergeIntoShifterOperand(use, bitfield_op, true);
}
+ /**
+ * This simplifier uses a special-purpose BB visitor.
+ * (1) No need to visit Phi nodes.
+ * (2) Since statements can be removed in a "forward" fashion,
+ * the visitor should test if each statement is still there.
+ */
+ void VisitBasicBlock(HBasicBlock* block) OVERRIDE {
+ // TODO: fragile iteration, provide more robust iterators?
+ for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
+ HInstruction* instruction = it.Current();
+ if (instruction->IsInBlock()) {
+ instruction->Accept(this);
+ }
+ }
+ }
+
// HInstruction visitors, sorted alphabetically.
void VisitAnd(HAnd* instruction) OVERRIDE;
void VisitArrayGet(HArrayGet* instruction) OVERRIDE;