aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-11-20 01:20:42 +0000
committerDevang Patel <dpatel@apple.com>2008-11-20 01:20:42 +0000
commitabd691195fa4f616fddfc57bb58eb925b5f8ea4e (patch)
tree78a67c392782e8894a8a3142d77dfb76d102eec9 /lib/Transforms/IPO
parent2727b8ee6ea6412192e4e2c9c1f23fb26239c0c6 (diff)
downloadexternal_llvm-abd691195fa4f616fddfc57bb58eb925b5f8ea4e.zip
external_llvm-abd691195fa4f616fddfc57bb58eb925b5f8ea4e.tar.gz
external_llvm-abd691195fa4f616fddfc57bb58eb925b5f8ea4e.tar.bz2
Do not forget llvm.dbg.declare's first argument while removing debugging information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 6a0458c..7e225e2 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -99,7 +99,8 @@ static void RemoveDeadConstant(Constant *C) {
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 @@ bool StripDebugInfo(Module &M) {
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();