diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-26 06:14:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-26 06:14:11 +0000 |
commit | a000279a7de5a2cdc0a65d0960f1fa907a573c3d (patch) | |
tree | 1167b1edf6140bbf9e04d9b935879b12404f02a7 | |
parent | a00064a383d17e9fadc913f5372b372bcfafcfdc (diff) |
Implement DeadStoreElim/alloca.llx by observing that allocas are dead at the
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
-rw-r--r-- | lib/Transforms/Scalar/DeadStoreElimination.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 36aaa63449..40b5671e4c 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -66,7 +66,10 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { // 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 |