diff options
Diffstat (limited to 'compiler/optimizing/select_generator.cc')
-rw-r--r-- | compiler/optimizing/select_generator.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/compiler/optimizing/select_generator.cc b/compiler/optimizing/select_generator.cc index 07065efbb7..54eac54c01 100644 --- a/compiler/optimizing/select_generator.cc +++ b/compiler/optimizing/select_generator.cc @@ -46,7 +46,9 @@ static bool IsSimpleBlock(HBasicBlock* block) { } else if (instruction->CanBeMoved() && !instruction->HasSideEffects() && !instruction->CanThrow()) { - if (instruction->IsSelect() && instruction->AsSelect()->GetCondition()->GetBlock() == block) { + if (instruction->IsSelect() && + // TODO: Remove "OrNull". + instruction->AsSelectOrNull()->GetCondition()->GetBlock() == block) { // Count one HCondition and HSelect in the same block as a single instruction. // This enables finding nested selects. continue; @@ -75,7 +77,8 @@ static HPhi* GetSinglePhi(HBasicBlock* block, size_t index1, size_t index2) { HPhi* select_phi = nullptr; for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HPhi* phi = it.Current()->AsPhi(); + // TODO: Remove "OrNull". + HPhi* phi = it.Current()->AsPhiOrNull(); if (select_phi == nullptr) { // First phi found. select_phi = phi; @@ -90,7 +93,8 @@ static HPhi* GetSinglePhi(HBasicBlock* block, size_t index1, size_t index2) { bool HSelectGenerator::TryGenerateSelectSimpleDiamondPattern( HBasicBlock* block, ScopedArenaSafeMap<HInstruction*, HSelect*>* cache) { DCHECK(block->GetLastInstruction()->IsIf()); - HIf* if_instruction = block->GetLastInstruction()->AsIf(); + // TODO: Remove "OrNull". + HIf* if_instruction = block->GetLastInstruction()->AsIfOrNull(); HBasicBlock* true_block = if_instruction->IfTrueSuccessor(); HBasicBlock* false_block = if_instruction->IfFalseSuccessor(); DCHECK_NE(true_block, false_block); @@ -216,7 +220,8 @@ bool HSelectGenerator::TryGenerateSelectSimpleDiamondPattern( HBasicBlock* HSelectGenerator::TryFixupDoubleDiamondPattern(HBasicBlock* block) { DCHECK(block->GetLastInstruction()->IsIf()); - HIf* if_instruction = block->GetLastInstruction()->AsIf(); + // TODO: Remove "OrNull". + HIf* if_instruction = block->GetLastInstruction()->AsIfOrNull(); HBasicBlock* true_block = if_instruction->IfTrueSuccessor(); HBasicBlock* false_block = if_instruction->IfFalseSuccessor(); DCHECK_NE(true_block, false_block); @@ -231,7 +236,8 @@ HBasicBlock* HSelectGenerator::TryFixupDoubleDiamondPattern(HBasicBlock* block) // The innner if branch has to be a block with just a comparison and an if. if (!inner_if_block->EndsWithIf() || - inner_if_block->GetLastInstruction()->AsIf()->InputAt(0) != + // TODO: Remove "OrNull". + inner_if_block->GetLastInstruction()->AsIfOrNull()->InputAt(0) != inner_if_block->GetFirstInstruction() || inner_if_block->GetLastInstruction()->GetPrevious() != inner_if_block->GetFirstInstruction() || @@ -239,7 +245,8 @@ HBasicBlock* HSelectGenerator::TryFixupDoubleDiamondPattern(HBasicBlock* block) return nullptr; } - HIf* inner_if_instruction = inner_if_block->GetLastInstruction()->AsIf(); + // TODO: Remove "OrNull". + HIf* inner_if_instruction = inner_if_block->GetLastInstruction()->AsIfOrNull(); HBasicBlock* inner_if_true_block = inner_if_instruction->IfTrueSuccessor(); HBasicBlock* inner_if_false_block = inner_if_instruction->IfFalseSuccessor(); if (!inner_if_true_block->IsSingleGoto() || !inner_if_false_block->IsSingleGoto()) { @@ -262,7 +269,8 @@ HBasicBlock* HSelectGenerator::TryFixupDoubleDiamondPattern(HBasicBlock* block) return nullptr; } - HPhi* first_phi = first_merge->GetFirstPhi()->AsPhi(); + // TODO: Remove "OrNull". + HPhi* first_phi = first_merge->GetFirstPhi()->AsPhiOrNull(); // Second merge is first_merge and the remainder branch merging. It must be phi + goto, or phi + // return. Depending on the first merge, we define the second merge. @@ -284,7 +292,8 @@ HBasicBlock* HSelectGenerator::TryFixupDoubleDiamondPattern(HBasicBlock* block) } size_t index = second_merge->GetPredecessorIndexOf(merges_into_second_merge); - HPhi* second_phi = second_merge->GetFirstPhi()->AsPhi(); + // TODO: Remove "OrNull". + HPhi* second_phi = second_merge->GetFirstPhi()->AsPhiOrNull(); // Merge the phis. first_phi->AddInput(second_phi->InputAt(index)); |