[llvm] 2fa656c - [Debugify] Do not require named metadata to be present when stripping

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 17:05:02 PDT 2020


Author: Vedant Kumar
Date: 2020-04-22T17:03:39-07:00
New Revision: 2fa656cdfd836d5d3959466f05e44ae51bcded4e

URL: https://github.com/llvm/llvm-project/commit/2fa656cdfd836d5d3959466f05e44ae51bcded4e
DIFF: https://github.com/llvm/llvm-project/commit/2fa656cdfd836d5d3959466f05e44ae51bcded4e.diff

LOG: [Debugify] Do not require named metadata to be present when stripping

This allows -mir-strip-debug to be run without -debugify having run
before.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Debugify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index f2739a8257a2..19c73f3840fc 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -224,7 +224,8 @@ bool llvm::stripDebugifyMetadata(Module &M) {
   // Strip out the module-level Debug Info Version metadata.
   // FIXME: There must be an easier way to remove an operand from a NamedMDNode.
   NamedMDNode *NMD = M.getModuleFlagsMetadata();
-  assert(NMD && "debugify metadata present without Debug Info Version set?");
+  if (!NMD)
+    return Changed;
   SmallVector<MDNode *, 4> Flags;
   for (MDNode *Flag : NMD->operands())
     Flags.push_back(Flag);


        


More information about the llvm-commits mailing list