Skip to content

Commit 765ec26

Browse files
committed
Emit reloc.none instinsic with metdata string arg
1 parent b7257e8 commit 765ec26

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
@@ -4021,11 +4021,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40214021
DenseSet<StringRef> Aspects(llvm::from_range,
40224022
ArrayRef<StringRef>(Args).drop_front(4));
40234023
Module *M = CI->getModule();
4024+
LLVMContext &Ctx = M->getContext();
40244025
Function *Callee = CI->getCalledFunction();
40254026
FunctionCallee ModularFn =
40264027
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
40274028
Callee->getAttributes().removeFnAttribute(
4028-
M->getContext(), "modular-format"));
4029+
Ctx, "modular-format"));
40294030
CallInst *New = cast<CallInst>(CI->clone());
40304031
New->setCalledFunction(ModularFn);
40314032
New->removeFnAttr("modular-format");
@@ -4035,11 +4036,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40354036
SmallString<20> Name = ImplName;
40364037
Name += '_';
40374038
Name += Aspect;
4038-
Constant *Sym =
4039-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
40404039
Function *RelocNoneFn =
40414040
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
4042-
B.CreateCall(RelocNoneFn, {Sym});
4041+
B.CreateCall(RelocNoneFn,
4042+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
40434043
};
40444044

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

0 commit comments

Comments
 (0)