diff options
author | 2022-03-21 12:46:10 +0000 | |
---|---|---|
committer | 2022-03-22 10:27:50 +0000 | |
commit | 9e701b1918ccb50908c8dbdb987103284db16a73 (patch) | |
tree | d9fa1a746e5dd2d93999bc889b680ce370d0ef40 /compiler/optimizing/code_sinking.cc | |
parent | cff8f563810b5f4f5de0422d5cd57e5db024c6d1 (diff) |
Allow to sink code to catch blocks
We now allow to sink code to catch blocks, while blocking moving it
to blocks that would throw into catch blocks.
Bug: 75971227
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: Iaf5ea647e96170cbfb95c4286c5c37c991cb2113
Diffstat (limited to 'compiler/optimizing/code_sinking.cc')
-rw-r--r-- | compiler/optimizing/code_sinking.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index 2b56c88c25..0f336a2b1d 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -217,8 +217,14 @@ 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) { + // Bail if the instruction would throw into a catch block. + if (instruction->CanThrow() && target_block->IsTryBlock()) { + // TODO(solanes): Here we could do something similar to the loop above and move to the first + // dominator, which is not a try block, instead of just returning nullptr. If we do so, we have + // to also make sure we are not in a loop. + // TODO(solanes): Alternatively, we could split the try block at the try boundary having two + // blocks: A and B. Block B would have the try boundary (and xhandler) and therefore block A + // would be the target block available to move the instruction. return nullptr; } |