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 | a91a56353086b8cd70ace87a4e290ac278ff345b (patch) | |
tree | 21df6f38e087db69bdcd2de6c28e5e72c64742ec /llvm/lib/Transforms | |
parent | 5e71d4315566bfaaa36110f97f60fe1c50a5c342 (diff) | |
download | bcm5719-llvm-a91a56353086b8cd70ace87a4e290ac278ff345b.tar.gz bcm5719-llvm-a91a56353086b8cd70ace87a4e290ac278ff345b.zip |
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.
llvm-svn: 85375
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/StripSymbols.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index 57aaf43c65a..369f0fc0c82 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/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); } |