ART: Enable more passes under try/catch
LICM, BCE, LSE are all safe under try/catch. Inliner and DCE
need updating and will be enabled in follow-up CLs.
Change-Id: I86db5f811257d5e765fea91666a2a2af0fb24ec3
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 3480265..4345d55 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1129,6 +1129,14 @@
}
void HInstruction::MoveBefore(HInstruction* cursor) {
+ if (kIsDebugBuild && CanThrowIntoCatchBlock()) {
+ // Make sure we are not moving a throwing instruction out of its try block.
+ DCHECK(cursor->GetBlock()->IsTryBlock());
+ const HTryBoundary& current_try = block_->GetTryCatchInformation()->GetTryEntry();
+ const HTryBoundary& cursor_try = cursor->GetBlock()->GetTryCatchInformation()->GetTryEntry();
+ DCHECK(cursor_try.HasSameExceptionHandlersAs(current_try));
+ }
+
next_->previous_ = previous_;
if (previous_ != nullptr) {
previous_->next_ = next_;