end of the function (either return or unwind)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15232
91177308-0d34-0410-b5e6-
96231b3b80d8
// If this block ends in a return, unwind, and eventually tailcall/barrier,
// then all allocas are dead at its end.
if (BB.getTerminator()->getNumSuccessors() == 0) {
-
+ BasicBlock *Entry = BB.getParent()->begin();
+ for (BasicBlock::iterator I = Entry->begin(), E = Entry->end(); I != E; ++I)
+ if (AllocaInst *AI = dyn_cast<AllocaInst>(I))
+ KillLocs.add(AI, ~0);
}
// PotentiallyDeadInsts - Deleting dead stores from the program can make other