Skip to content

Commit 7d98564

Browse files
committed
Emit reloc.none instinsic with metdata string arg
1 parent c02868f commit 7d98564

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
@@ -3971,11 +3971,12 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39713971
DenseSet<StringRef> Aspects(llvm::from_range,
39723972
ArrayRef<StringRef>(Args).drop_front(4));
39733973
Module *M = CI->getModule();
3974+
LLVMContext &Ctx = M->getContext();
39743975
Function *Callee = CI->getCalledFunction();
39753976
FunctionCallee ModularFn =
39763977
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
39773978
Callee->getAttributes().removeFnAttribute(
3978-
M->getContext(), "modular-format"));
3979+
Ctx, "modular-format"));
39793980
CallInst *New = cast<CallInst>(CI->clone());
39803981
New->setCalledFunction(ModularFn);
39813982
New->removeFnAttr("modular-format");
@@ -3985,11 +3986,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
39853986
SmallString<20> Name = ImplName;
39863987
Name += '_';
39873988
Name += Aspect;
3988-
Constant *Sym =
3989-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
39903989
Function *RelocNoneFn =
39913990
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
3992-
B.CreateCall(RelocNoneFn, {Sym});
3991+
B.CreateCall(RelocNoneFn,
3992+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
39933993
};
39943994

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

0 commit comments

Comments
 (0)