diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-05-14 04:42:51 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-05-14 04:42:51 +0000 |
commit | 2f8a5f3f44216ecfe1452ce5fa68903eced5b52f (patch) | |
tree | bd28edc07d7e200e3b60a5a72f2dce97d4dbd5a2 | |
parent | dec0e54d58e5fabffb4916cc01dce1f503aa5e89 (diff) | |
download | bcm5719-llvm-2f8a5f3f44216ecfe1452ce5fa68903eced5b52f.tar.gz bcm5719-llvm-2f8a5f3f44216ecfe1452ce5fa68903eced5b52f.zip |
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@apple.com>
llvm-svn: 269539
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 7a91b662388..82ce8c95e78 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -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; } |