| 567 | } |
| 568 | |
| 569 | void LoopUnrollerUtilsImpl::ReplaceInductionUseWithFinalValue(Loop* loop) { |
| 570 | context_->InvalidateAnalysesExceptFor( |
| 571 | IRContext::Analysis::kAnalysisLoopAnalysis | |
| 572 | IRContext::Analysis::kAnalysisDefUse | |
| 573 | IRContext::Analysis::kAnalysisInstrToBlockMapping); |
| 574 | |
| 575 | std::vector<Instruction*> inductions; |
| 576 | loop->GetInductionVariables(inductions); |
| 577 | |
| 578 | for (size_t index = 0; index < inductions.size(); ++index) { |
| 579 | // We don't want the decorations that applied to the induction variable |
| 580 | // to be applied to the value that replace it. |
| 581 | context_->KillNamesAndDecorates(state_.previous_phis_[index]); |
| 582 | |
| 583 | uint32_t trip_step_id = GetPhiDefID(state_.previous_phis_[index], |
| 584 | state_.previous_latch_block_->id()); |
| 585 | context_->ReplaceAllUsesWith(inductions[index]->result_id(), trip_step_id); |
| 586 | invalidated_instructions_.push_back(inductions[index]); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | // Fully unroll the loop by partially unrolling it by the number of loop |
| 591 | // iterations minus one for the body already accounted for. |
nothing calls this directly
no test coverage detected