Skip to content

Commit c2e511c

Browse files
committed
Emit reloc.none instinsic with metdata string arg
1 parent a58f53e commit c2e511c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,11 +3935,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39353935
DenseSet<StringRef> Aspects(llvm::from_range,
39363936
ArrayRef<StringRef>(Args).drop_front(4));
39373937
Module *M = CI->getModule();
3938+
LLVMContext &Ctx = M->getContext();
39383939
Function *Callee = CI->getCalledFunction();
39393940
FunctionCallee ModularFn =
39403941
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
39413942
Callee->getAttributes().removeFnAttribute(
3942-
M->getContext(), "modular-format"));
3943+
Ctx, "modular-format"));
39433944
CallInst *New = cast<CallInst>(CI->clone());
39443945
New->setCalledFunction(ModularFn);
39453946
New->removeFnAttr("modular-format");
@@ -3949,11 +3950,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39493950
SmallString<20> Name = ImplName;
39503951
Name += '_';
39513952
Name += Aspect;
3952-
Constant *Sym =
3953-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
39543953
Function *RelocNoneFn =
39553954
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
3956-
B.CreateCall(RelocNoneFn, {Sym});
3955+
B.CreateCall(RelocNoneFn,
3956+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
39573957
};
39583958

39593959
if (Aspects.contains("float")) {

0 commit comments

Comments
 (0)