summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2018-03-21 14:07:12 -0700
committer Aart Bik <ajcbik@google.com> 2018-03-22 09:14:34 -0700
commit071d43576b4a9ede8ef2a4289c5d79b1ae612c7a (patch)
tree741006d5bbff1ff2c84ff1aa69ffa20cc819f4fc /compiler/optimizing
parent9ec1e24ebc683b15bb9c6db5554ac2ff9458adae (diff)
Code sinking bug fix.
Rationale: Don't move an instruction that can throw into a block that may catch. Bug: b/75971227 Test: test-art-host Change-Id: I29b8f32854aa83e2fb5018d77b9ee12787efbef3
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_sinking.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc
index f4760d661f..2e31d35584 100644
--- a/compiler/optimizing/code_sinking.cc
+++ b/compiler/optimizing/code_sinking.cc
@@ -214,6 +214,11 @@ static HInstruction* FindIdealPosition(HInstruction* instruction,
DCHECK(target_block != nullptr);
}
+ // Bail if the instruction can throw and we are about to move into a catch block.
+ if (instruction->CanThrow() && target_block->GetTryCatchInformation() != nullptr) {
+ return nullptr;
+ }
+
// Find insertion position. No need to filter anymore, as we have found a
// target block.
HInstruction* insert_pos = nullptr;