@@ -4021,12 +4021,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40214021 DenseSet<StringRef> Aspects (llvm::from_range,
40224022 ArrayRef<StringRef>(Args).drop_front (5 ));
40234023 Module *M = CI->getModule ();
4024- LLVMContext &Ctx = M->getContext ();
40254024 Function *Callee = CI->getCalledFunction ();
40264025 FunctionCallee ModularFn =
40274026 M->getOrInsertFunction (FnName, Callee->getFunctionType (),
40284027 Callee->getAttributes ().removeFnAttribute (
4029- Ctx , " modular-format" ));
4028+ M-> getContext () , " modular-format" ));
40304029 CallInst *New = cast<CallInst>(CI->clone ());
40314030 New->setCalledFunction (ModularFn);
40324031 New->removeFnAttr (" modular-format" );
@@ -4036,10 +4035,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40364035 SmallString<20 > Name = ImplName;
40374036 Name += ' _' ;
40384037 Name += Aspect;
4038+ Constant *Sym =
4039+ M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
40394040 Function *RelocNoneFn =
40404041 Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
4041- B.CreateCall (RelocNoneFn,
4042- {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
4042+ B.CreateCall (RelocNoneFn, {Sym});
40434043 };
40444044
40454045 if (Aspects.contains (" float" )) {
0 commit comments