@@ -4111,11 +4111,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41114111 DenseSet<StringRef> Aspects (llvm::from_range,
41124112 ArrayRef<StringRef>(Args).drop_front (4 ));
41134113 Module *M = CI->getModule ();
4114+ LLVMContext &Ctx = M->getContext ();
41144115 Function *Callee = CI->getCalledFunction ();
41154116 FunctionCallee ModularFn =
41164117 M->getOrInsertFunction (FnName, Callee->getFunctionType (),
41174118 Callee->getAttributes ().removeFnAttribute (
4118- M-> getContext () , " modular-format" ));
4119+ Ctx , " modular-format" ));
41194120 CallInst *New = cast<CallInst>(CI->clone ());
41204121 New->setCalledFunction (ModularFn);
41214122 New->removeFnAttr (" modular-format" );
@@ -4125,11 +4126,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41254126 SmallString<20 > Name = ImplName;
41264127 Name += ' _' ;
41274128 Name += Aspect;
4128- Constant *Sym =
4129- M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
41304129 Function *RelocNoneFn =
41314130 Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
4132- B.CreateCall (RelocNoneFn, {Sym});
4131+ B.CreateCall (RelocNoneFn,
4132+ {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
41334133 };
41344134
41354135 if (Aspects.contains (" float" )) {
0 commit comments