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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini 2016-05-14 04:42:51 +00:00
parent 82d7fff155
commit bdd5f696c0

View File

@ -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;
}