diff options
author | 2017-04-20 15:19:46 +0100 | |
---|---|---|
committer | 2017-04-20 16:39:43 +0100 | |
commit | 13445e7176d67098a5d94754a9d3cd2928616bd8 (patch) | |
tree | 1a2279af45211b5398cf261e71b8700f51bc80b9 /compiler/optimizing/code_sinking.cc | |
parent | 25009fdd7a5dccc957afc8178ca5d3733f899147 (diff) |
Handle catch phis in code sinking.
When the user of an instruction we want to sink is a catch
phi, we should not look at predecessors (which don't map 1-1
for catch phis), but can only look at its dominator.
bug:37247890
Test: 647-sinking-catch
Change-Id: Ib64bd6f95d3ef45c394137e76819fa8d7d3d960a
Diffstat (limited to 'compiler/optimizing/code_sinking.cc')
-rw-r--r-- | compiler/optimizing/code_sinking.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index dc3d378e75..0b4dcd30a1 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -161,9 +161,15 @@ static HInstruction* FindIdealPosition(HInstruction* instruction, for (const HUseListNode<HInstruction*>& use : instruction->GetUses()) { HInstruction* user = use.GetUser(); if (!(filter && ShouldFilterUse(instruction, user, post_dominated))) { - finder.Update(user->IsPhi() - ? user->GetBlock()->GetPredecessors()[use.GetIndex()] - : user->GetBlock()); + HBasicBlock* block = user->GetBlock(); + if (user->IsPhi()) { + // Special case phis by taking the incoming block for regular ones, + // or the dominator for catch phis. + block = user->AsPhi()->IsCatchPhi() + ? block->GetDominator() + : block->GetPredecessors()[use.GetIndex()]; + } + finder.Update(block); } } for (const HUseListNode<HEnvironment*>& use : instruction->GetEnvUses()) { |