diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-08-22 19:00:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-13 20:39:49 +0000 |
commit | fe6060f10f634930ff71b7c50291ddc610da2475 (patch) | |
tree | 1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp | |
parent | b61bce17f346d79cecfd8f195a64b10f77be43b1 (diff) | |
parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp b/contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp index f5dc589a98cb..c9a19948ff2f 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/UnreachableBlockElim.cpp @@ -114,25 +114,23 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { // Loop over all dead blocks, remembering them and deleting all instructions // in them. std::vector<MachineBasicBlock*> DeadBlocks; - for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { - MachineBasicBlock *BB = &*I; - + for (MachineBasicBlock &BB : F) { // Test for deadness. - if (!Reachable.count(BB)) { - DeadBlocks.push_back(BB); + if (!Reachable.count(&BB)) { + DeadBlocks.push_back(&BB); // Update dominator and loop info. - if (MLI) MLI->removeBlock(BB); - if (MDT && MDT->getNode(BB)) MDT->eraseNode(BB); + if (MLI) MLI->removeBlock(&BB); + if (MDT && MDT->getNode(&BB)) MDT->eraseNode(&BB); - while (BB->succ_begin() != BB->succ_end()) { - MachineBasicBlock* succ = *BB->succ_begin(); + while (BB.succ_begin() != BB.succ_end()) { + MachineBasicBlock* succ = *BB.succ_begin(); MachineBasicBlock::iterator start = succ->begin(); while (start != succ->end() && start->isPHI()) { for (unsigned i = start->getNumOperands() - 1; i >= 2; i-=2) if (start->getOperand(i).isMBB() && - start->getOperand(i).getMBB() == BB) { + start->getOperand(i).getMBB() == &BB) { start->RemoveOperand(i); start->RemoveOperand(i-1); } @@ -140,7 +138,7 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { start++; } - BB->removeSuccessor(BB->succ_begin()); + BB.removeSuccessor(BB.succ_begin()); } } } |