@@ -4129,11 +4129,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41294129 return nullptr ;
41304130
41314131 Module *M = CI->getModule ();
4132+ LLVMContext &Ctx = M->getContext ();
41324133 Function *Callee = CI->getCalledFunction ();
4133- FunctionCallee ModularFn =
4134- M->getOrInsertFunction (FnName, Callee->getFunctionType (),
4135- Callee->getAttributes ().removeFnAttribute (
4136- M->getContext (), " modular-format" ));
4134+ FunctionCallee ModularFn = M->getOrInsertFunction (
4135+ FnName, Callee->getFunctionType (),
4136+ Callee->getAttributes ().removeFnAttribute (Ctx, " modular-format" ));
41374137 CallInst *New = cast<CallInst>(CI->clone ());
41384138 New->setCalledFunction (ModularFn);
41394139 New->removeFnAttr (" modular-format" );
@@ -4143,11 +4143,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41434143 SmallString<20 > Name = ImplName;
41444144 Name += ' _' ;
41454145 Name += Aspect;
4146- Constant *Sym =
4147- M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
41484146 Function *RelocNoneFn =
41494147 Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
4150- B.CreateCall (RelocNoneFn, {Sym});
4148+ B.CreateCall (RelocNoneFn,
4149+ {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
41514150 };
41524151
41534152 llvm::sort (NeededAspects);
0 commit comments