[llvm] r269540 - 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:58:35 PDT 2016


Author: mehdi_amini
Date: Fri May 13 23:58:35 2016
New Revision: 269540

URL: http://llvm.org/viewvc/llvm-project?rev=269540&view=rev
Log:
StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)

Suggested by Adrian. This is NFC right now but is more clean and
robust against future potential new debug info intrinsics.

From: mehdi_amini <mehdi_amini at 91177308-0d34-0410-b5e6-96231b3b80d8>

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=269540&r1=269539&r2=269540&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Fri May 13 23:58:35 2016
@@ -248,18 +248,11 @@ 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.
-      // 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();
+      if (isa<DbgInfoIntrinsic>(&I)) {
+        I.eraseFromParent();
         Changed = true;
         continue;
       }




More information about the llvm-commits mailing list