@@ -3971,11 +3971,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39713971 DenseSet<StringRef> Aspects (llvm::from_range,
39723972 ArrayRef<StringRef>(Args).drop_front (4 ));
39733973 Module *M = CI->getModule ();
3974+ LLVMContext &Ctx = M->getContext ();
39743975 Function *Callee = CI->getCalledFunction ();
39753976 FunctionCallee ModularFn =
39763977 M->getOrInsertFunction (FnName, Callee->getFunctionType (),
39773978 Callee->getAttributes ().removeFnAttribute (
3978- M-> getContext () , " modular-format" ));
3979+ Ctx , " modular-format" ));
39793980 CallInst *New = cast<CallInst>(CI->clone ());
39803981 New->setCalledFunction (ModularFn);
39813982 New->removeFnAttr (" modular-format" );
@@ -3985,11 +3986,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39853986 SmallString<20 > Name = ImplName;
39863987 Name += ' _' ;
39873988 Name += Aspect;
3988- Constant *Sym =
3989- M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
39903989 Function *RelocNoneFn =
39913990 Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
3992- B.CreateCall (RelocNoneFn, {Sym});
3991+ B.CreateCall (RelocNoneFn,
3992+ {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
39933993 };
39943994
39953995 if (Aspects.contains (" float" )) {
0 commit comments