[llvm-commits] [llvm] r59688 - /llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Devang Patel
dpatel at apple.com
Wed Nov 19 17:20:42 PST 2008
Author: dpatel
Date: Wed Nov 19 19:20:42 2008
New Revision: 59688
URL: http://llvm.org/viewvc/llvm-project?rev=59688&view=rev
Log:
Do not forget llvm.dbg.declare's first argument while removing debugging information.
Modified:
llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=59688&r1=59687&r2=59688&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Wed Nov 19 19:20:42 2008
@@ -99,7 +99,8 @@
GV->eraseFromParent();
}
else if (!isa<Function>(C))
- C->destroyConstant();
+ if (isa<CompositeType>(C->getType()))
+ C->destroyConstant();
// If the constant referenced anything, see if we can delete it as well.
for (SmallPtrSet<Constant *, 4>::iterator OI = Operands.begin(),
@@ -245,11 +246,18 @@
if (Declare) {
while (!Declare->use_empty()) {
CallInst *CI = cast<CallInst>(Declare->use_back());
- Value *Arg = CI->getOperand(2);
+ Value *Arg1 = CI->getOperand(1);
+ Value *Arg2 = CI->getOperand(2);
assert(CI->use_empty() && "llvm.dbg intrinsic should have void result");
CI->eraseFromParent();
- if (Arg->use_empty())
- if (Constant *C = dyn_cast<Constant>(Arg))
+ if (Arg1->use_empty()) {
+ if (Constant *C = dyn_cast<Constant>(Arg1))
+ DeadConstants.push_back(C);
+ if (Instruction *I = dyn_cast<Instruction>(Arg1))
+ I->eraseFromParent();
+ }
+ if (Arg2->use_empty())
+ if (Constant *C = dyn_cast<Constant>(Arg2))
DeadConstants.push_back(C);
}
Declare->eraseFromParent();
More information about the llvm-commits
mailing list