diff options
author | 2022-03-22 18:13:38 +0000 | |
---|---|---|
committer | 2022-03-23 09:45:58 +0000 | |
commit | 2f6af923eb00f15f9011b17d88ea5d240ed1a020 (patch) | |
tree | f1e89dd02adb91fa0bdffdeffa34028e37ce79c4 /compiler/optimizing | |
parent | ebeb86320ec5da975a4271d04fc6ef488a16741c (diff) |
Allow to sink code within its try block
Bug: 226143661
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: Ie1edc849d8b6db670987cca2206299ab5a4e9d01
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/code_sinking.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index 0f336a2b1d..c14ad9c95e 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -222,10 +222,14 @@ static HInstruction* FindIdealPosition(HInstruction* instruction, // 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; + + if (instruction->GetBlock()->IsTryBlock() && + instruction->GetBlock()->GetTryCatchInformation()->GetTryEntry().GetId() == + target_block->GetTryCatchInformation()->GetTryEntry().GetId()) { + // Sink within the same try block is allowed. + } else { + return nullptr; + } } // Find insertion position. No need to filter anymore, as we have found a |