@@ -4111,12 +4111,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41114111 DenseSet<StringRef> Aspects (llvm::from_range,
41124112 ArrayRef<StringRef>(Args).drop_front (5 ));
41134113 Module *M = CI->getModule ();
4114- LLVMContext &Ctx = M->getContext ();
41154114 Function *Callee = CI->getCalledFunction ();
41164115 FunctionCallee ModularFn =
41174116 M->getOrInsertFunction (FnName, Callee->getFunctionType (),
41184117 Callee->getAttributes ().removeFnAttribute (
4119- Ctx , " modular-format" ));
4118+ M-> getContext () , " modular-format" ));
41204119 CallInst *New = cast<CallInst>(CI->clone ());
41214120 New->setCalledFunction (ModularFn);
41224121 New->removeFnAttr (" modular-format" );
@@ -4126,10 +4125,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41264125 SmallString<20 > Name = ImplName;
41274126 Name += ' _' ;
41284127 Name += Aspect;
4128+ Constant *Sym =
4129+ M->getOrInsertGlobal (Name, Type::getInt8Ty (M->getContext ()));
41294130 Function *RelocNoneFn =
41304131 Intrinsic::getOrInsertDeclaration (M, Intrinsic::reloc_none);
4131- B.CreateCall (RelocNoneFn,
4132- {MetadataAsValue::get (Ctx, MDString::get (Ctx, Name))});
4132+ B.CreateCall (RelocNoneFn, {Sym});
41334133 };
41344134
41354135 if (Aspects.contains (" float" )) {
0 commit comments