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

This allows -mir-strip-debug to be run without -debugify having run
before.
This commit is contained in:
Vedant Kumar
2020-04-17 17:53:14 -07:00
parent 2a5675f11d
commit 2fa656cdfd

View File

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