[llvm] r269539 - Revert "StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)"
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 21:42:51 PDT 2016
Author: mehdi_amini
Date: Fri May 13 23:42:51 2016
New Revision: 269539
URL: http://llvm.org/viewvc/llvm-project?rev=269539&view=rev
Log:
Revert "StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)"
This reverts commit r269537, was not ready to be commited and went through by mistake
From: Mehdi Amini <mehdi.amini at apple.com>
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=269539&r1=269538&r2=269539&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Fri May 13 23:42:51 2016
@@ -248,11 +248,18 @@ bool llvm::stripDebugInfo(Function &F) {
F.setSubprogram(nullptr);
}
+ Function *Declare = F.getParent()->getFunction("llvm.dbg.declare");
+ Function *DbgVal = F.getParent()->getFunction("llvm.dbg.value");
for (BasicBlock &BB : F) {
for (auto II = BB.begin(), End = BB.end(); II != End;) {
Instruction &I = *II++; // We may delete the instruction, increment now.
- if (dyn_cast<DbgInfoIntrinsic>(&I)) {
- I.eraseFromParent();
+ // Remove all of the calls to the debugger intrinsics, and remove them
+ // from the module.
+ CallInst *CI = dyn_cast<CallInst>(&I);
+ if (CI && CI->getCalledFunction() &&
+ (CI->getCalledFunction() == Declare ||
+ CI->getCalledFunction() == DbgVal)) {
+ CI->eraseFromParent();
Changed = true;
continue;
}
More information about the llvm-commits
mailing list