diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-28 05:14:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-28 05:14:34 +0000 |
commit | 0eeb913aa17a68b1f2963b02ca1d68f09dba0b78 (patch) | |
tree | 59af809ede34a9dd1b0bd71d65537f2787b08ebe /lib/Transforms/IPO/StripSymbols.cpp | |
parent | 46b3abc9f759ed4bbf88be611cc577b21a8ffa8b (diff) |
Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/StripSymbols.cpp')
-rw-r--r-- | lib/Transforms/IPO/StripSymbols.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp index 57aaf43c65..369f0fc0c8 100644 --- a/lib/Transforms/IPO/StripSymbols.cpp +++ b/lib/Transforms/IPO/StripSymbols.cpp @@ -112,11 +112,11 @@ static bool OnlyUsedBy(Value *V, Value *Usr) { static void RemoveDeadConstant(Constant *C) { assert(C->use_empty() && "Constant is not dead!"); - SmallPtrSet<Constant *, 4> Operands; + SmallPtrSet<Constant*, 4> Operands; for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) if (isa<DerivedType>(C->getOperand(i)->getType()) && OnlyUsedBy(C->getOperand(i), C)) - Operands.insert(C->getOperand(i)); + Operands.insert(cast<Constant>(C->getOperand(i))); if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) { if (!GV->hasLocalLinkage()) return; // Don't delete non static globals. GV->eraseFromParent(); @@ -126,7 +126,7 @@ static void RemoveDeadConstant(Constant *C) { C->destroyConstant(); // If the constant referenced anything, see if we can delete it as well. - for (SmallPtrSet<Constant *, 4>::iterator OI = Operands.begin(), + for (SmallPtrSet<Constant*, 4>::iterator OI = Operands.begin(), OE = Operands.end(); OI != OE; ++OI) RemoveDeadConstant(*OI); } @@ -305,8 +305,7 @@ bool StripDebugDeclare::runOnModule(Module &M) { if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) { if (GV->hasLocalLinkage()) RemoveDeadConstant(GV); - } - else + } else RemoveDeadConstant(C); } |