| 626 | } |
| 627 | |
| 628 | void LoopUnrollerUtilsImpl::KillDebugDeclares(BasicBlock* bb) { |
| 629 | // We cannot kill an instruction inside BasicBlock::ForEachInst() |
| 630 | // because it will generate dangling pointers. We use |to_be_killed| |
| 631 | // to kill them after the loop. |
| 632 | std::vector<Instruction*> to_be_killed; |
| 633 | |
| 634 | bb->ForEachInst([&to_be_killed, this](Instruction* inst) { |
| 635 | if (context_->get_debug_info_mgr()->IsDebugDeclare(inst)) { |
| 636 | to_be_killed.push_back(inst); |
| 637 | } |
| 638 | }); |
| 639 | for (auto* inst : to_be_killed) context_->KillInst(inst); |
| 640 | } |
| 641 | |
| 642 | // Copy a given basic block, give it a new result_id, and store the new block |
| 643 | // and the id mapping in the state. |preserve_instructions| is used to determine |