[llvm-commits] CVS: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 25 23:14:21 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

DeadStoreElimination.cpp updated: 1.4 -> 1.5

---
Log message:

Implement DeadStoreElim/alloca.llx by observing that allocas are dead at the
end of the function (either return or unwind)


---
Diffs of the changes:  (+4 -1)

Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
diff -u llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.4 llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.5
--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.4	Sun Jul 25 06:09:56 2004
+++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp	Mon Jul 26 01:14:11 2004
@@ -66,7 +66,10 @@
   // 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





More information about the llvm-commits mailing list