Skip to content

Commit 39fde9b

Browse files
committed
Revert "llvm.reloc.none takes a GlobalValue again"
This reverts commit 4ac826513d3f564341d91bb9bc5cbf3a53770b57.
1 parent 7cb7d44 commit 39fde9b

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4129,11 +4129,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41294129
return nullptr;
41304130

41314131
Module *M = CI->getModule();
4132+
LLVMContext &Ctx = M->getContext();
41324133
Function *Callee = CI->getCalledFunction();
4133-
FunctionCallee ModularFn =
4134-
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
4135-
Callee->getAttributes().removeFnAttribute(
4136-
M->getContext(), "modular-format"));
4134+
FunctionCallee ModularFn = M->getOrInsertFunction(
4135+
FnName, Callee->getFunctionType(),
4136+
Callee->getAttributes().removeFnAttribute(Ctx, "modular-format"));
41374137
CallInst *New = cast<CallInst>(CI->clone());
41384138
New->setCalledFunction(ModularFn);
41394139
New->removeFnAttr("modular-format");
@@ -4143,11 +4143,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41434143
SmallString<20> Name = ImplName;
41444144
Name += '_';
41454145
Name += Aspect;
4146-
Constant *Sym =
4147-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
41484146
Function *RelocNoneFn =
41494147
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
4150-
B.CreateCall(RelocNoneFn, {Sym});
4148+
B.CreateCall(RelocNoneFn,
4149+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
41514150
};
41524151

41534152
llvm::sort(NeededAspects);

llvm/test/Transforms/InstCombine/modular-format.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ declare void @first_arg_idx(i32, ptr, ...) #3
8989
define void @test_partial_aspects(i32 %arg) {
9090
; CHECK-LABEL: @test_partial_aspects(
9191
; CHECK-NEXT: call void (ptr, ...) @multiple_aspects_mod(ptr nonnull @.str.int, i32 [[ARG:%.*]])
92-
; CHECK-NEXT: call void @llvm.reloc.none(ptr nonnull @basic_impl_unknown)
92+
; CHECK-NEXT: call void @llvm.reloc.none(metadata !"basic_impl_unknown")
9393
; CHECK-NEXT: ret void
9494
;
9595
call void (ptr, ...) @partial_aspects(ptr @.str.int, i32 %arg)

0 commit comments

Comments
 (0)