git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122645
91177308-0d34-0410-b5e6-
96231b3b80d8
// Finally, run over the function zapping any dead instructions.
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
- for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
- Instruction *I = BI++;
- if (isInstructionTriviallyDead(I)) {
- I->eraseFromParent();
- Changed = true;
- }
- }
+ for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;)
+ Changed |= RecursivelyDeleteTriviallyDeadInstructions(BI++);
return Changed;
}