aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/DeadStoreElimination.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-08-08 06:06:02 +0000
committerOwen Anderson <resistor@mac.com>2007-08-08 06:06:02 +0000
commitc182f17aed0b9d4fa8a87bdbea56fcd3a3e121dc (patch)
tree852af0348e8e1d6011b8e0ebe7de8384c8d6609d /lib/Transforms/Scalar/DeadStoreElimination.cpp
parenta141cfe5b2beb16599b5bab8c73333b31cc7a548 (diff)
downloadexternal_llvm-c182f17aed0b9d4fa8a87bdbea56fcd3a3e121dc.zip
external_llvm-c182f17aed0b9d4fa8a87bdbea56fcd3a3e121dc.tar.gz
external_llvm-c182f17aed0b9d4fa8a87bdbea56fcd3a3e121dc.tar.bz2
A few more small cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 9397869..1e3ca86 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -58,11 +58,11 @@ namespace {
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 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
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;