Skip to content

Commit c0c98c2

Browse files
committed
Emit reloc.none instinsic with metdata string arg
1 parent 147dad1 commit c0c98c2

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
@@ -4091,11 +4091,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40914091
DenseSet<StringRef> Aspects(llvm::from_range,
40924092
ArrayRef<StringRef>(Args).drop_front(4));
40934093
Module *M = CI->getModule();
4094+
LLVMContext &Ctx = M->getContext();
40944095
Function *Callee = CI->getCalledFunction();
40954096
FunctionCallee ModularFn =
40964097
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
40974098
Callee->getAttributes().removeFnAttribute(
4098-
M->getContext(), "modular-format"));
4099+
Ctx, "modular-format"));
40994100
CallInst *New = cast<CallInst>(CI->clone());
41004101
New->setCalledFunction(ModularFn);
41014102
New->removeFnAttr("modular-format");
@@ -4105,11 +4106,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41054106
SmallString<20> Name = ImplName;
41064107
Name += '_';
41074108
Name += Aspect;
4108-
Constant *Sym =
4109-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
41104109
Function *RelocNoneFn =
41114110
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
4112-
B.CreateCall(RelocNoneFn, {Sym});
4111+
B.CreateCall(RelocNoneFn,
4112+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
41134113
};
41144114

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

0 commit comments

Comments
 (0)