diff options
author | Devang Patel <dpatel@apple.com> | 2008-11-20 01:20:42 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-11-20 01:20:42 +0000 |
commit | c8b2fe1eeda436a9a855ac9ffc34a3ec9f5b1ac8 (patch) | |
tree | cf6e015c354f5c544310f8ee3000921cdb7722ce /llvm/lib/Transforms | |
parent | 61915f5d4ac343f537a0eb2e11c3e99165ecf9a1 (diff) | |
download | bcm5719-llvm-c8b2fe1eeda436a9a855ac9ffc34a3ec9f5b1ac8.tar.gz bcm5719-llvm-c8b2fe1eeda436a9a855ac9ffc34a3ec9f5b1ac8.zip |
Do not forget llvm.dbg.declare's first argument while removing debugging information.
llvm-svn: 59688
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/StripSymbols.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index 6a0458c5128..7e225e2bd55 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/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(); |