From 2fa656cdfd836d5d3959466f05e44ae51bcded4e Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 17 Apr 2020 17:53:14 -0700 Subject: [PATCH] [Debugify] Do not require named metadata to be present when stripping This allows -mir-strip-debug to be run without -debugify having run before. --- llvm/lib/Transforms/Utils/Debugify.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 Flags; for (MDNode *Flag : NMD->operands()) Flags.push_back(Flag);