[llvm-commits] [llvm] r40922 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp

Owen Anderson resistor at mac.com
Tue Aug 7 23:06:02 PDT 2007


Author: resistor
Date: Wed Aug  8 01:06:02 2007
New Revision: 40922

URL: http://llvm.org/viewvc/llvm-project?rev=40922&view=rev
Log:
A few more small cleanups.

Modified:
    llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=40922&r1=40921&r2=40922&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Aug  8 01:06:02 2007
@@ -58,11 +58,11 @@
     void DeleteDeadInstructionChains(Instruction *I,
                                      SetVector<Instruction*> &DeadInsts);
     
-    // Find the base pointer that a pointer came from
-    // Because this is used to find pointers that originate
-    // from allocas, it is safe to ignore GEP indices, since
-    // either the store will be in the alloca, and thus dead,
-    // or beyond the end of the alloca, and thus undefined.
+    /// Find the base pointer that a pointer came from
+    /// Because this is used to find pointers that originate
+    /// from allocas, it is safe to ignore GEP indices, since
+    /// either the store will be in the alloca, and thus dead,
+    /// or beyond the end of the alloca, and thus undefined.
     void TranslatePointerBitCasts(Value*& v) {
       assert(isa<PointerType>(v->getType()) &&
              "Translating a non-pointer type?");
@@ -113,10 +113,8 @@
     Value* pointer = 0;
     if (StoreInst* S = dyn_cast<StoreInst>(BBI))
       pointer = S->getPointerOperand();
-    else if (FreeInst* F = dyn_cast<FreeInst>(BBI))
-      pointer = F->getPointerOperand();
-      
-    assert(pointer && "Not a free or a store?");
+    else
+      pointer = cast<FreeInst>(BBI)->getPointerOperand();
       
     StoreInst*& last = lastStore[pointer];
     bool deletedStore = false;





More information about the llvm-commits mailing list