| 777 | } |
| 778 | |
| 779 | bool LoopUnrollerUtilsImpl::FoldConditionBlock(BasicBlock* condition_block, |
| 780 | uint32_t operand_label) { |
| 781 | // Remove the old conditional branch to the merge and continue blocks. |
| 782 | Instruction& old_branch = *condition_block->tail(); |
| 783 | uint32_t new_target = old_branch.GetSingleWordOperand(operand_label); |
| 784 | |
| 785 | DebugScope scope = old_branch.GetDebugScope(); |
| 786 | const std::vector<Instruction> lines = old_branch.dbg_line_insts(); |
| 787 | |
| 788 | context_->KillInst(&old_branch); |
| 789 | // Add the new unconditional branch to the merge block. |
| 790 | InstructionBuilder builder( |
| 791 | context_, condition_block, |
| 792 | IRContext::Analysis::kAnalysisDefUse | |
| 793 | IRContext::Analysis::kAnalysisInstrToBlockMapping); |
| 794 | Instruction* new_branch = builder.AddBranch(new_target); |
| 795 | |
| 796 | if (!lines.empty()) { |
| 797 | if (!new_branch->AddDebugLine(&lines.back())) { |
| 798 | return false; |
| 799 | } |
| 800 | } |
| 801 | new_branch->SetDebugScope(scope); |
| 802 | return true; |
| 803 | } |
| 804 | |
| 805 | void LoopUnrollerUtilsImpl::CloseUnrolledLoop(Loop* loop) { |
| 806 | // Remove the OpLoopMerge instruction from the function. |
nothing calls this directly
no test coverage detected