@@ -3935,11 +3935,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
3935
3935
DenseSet<StringRef> Aspects (llvm::from_range,
3936
3936
ArrayRef<StringRef>(Args).drop_front (4 ));
3937
3937
Module *M = CI->getModule ();
3938
+ LLVMContext &Ctx = M->getContext ();
3938
3939
Function *Callee = CI->getCalledFunction ();
3939
3940
FunctionCallee ModularFn =
3940
3941
M->getOrInsertFunction (FnName, Callee->getFunctionType (),
3941
3942
Callee->getAttributes ().removeFnAttribute (
3942
- M-> getContext () , " modular-format" ));
3943
+ Ctx , " modular-format" ));
3943
3944
CallInst *New = cast<CallInst>(CI->clone ());
3944
3945
New->setCalledFunction (ModularFn);
3945
3946
New->removeFnAttr (" modular-format" );
@@ -3949,11 +3950,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
3949
3950
SmallString<20 > Name = ImplName;
3950
3951
Name += ' _' ;
3951
3952
Name += Aspect;
3952
- Constant *Sym =
3953
- M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
3954
3953
Function *RelocNoneFn =
3955
3954
Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
3956
- B.CreateCall (RelocNoneFn, {Sym});
3955
+ B.CreateCall (RelocNoneFn,
3956
+ {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
3957
3957
};
3958
3958
3959
3959
if (Aspects.contains (" float" )) {
0 commit comments