Skip to content

Commit c0038c2

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

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
@@ -4109,11 +4109,11 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41094109
return nullptr;
41104110

41114111
Module *M = CI->getModule();
4112+
LLVMContext &Ctx = M->getContext();
41124113
Function *Callee = CI->getCalledFunction();
4113-
FunctionCallee ModularFn =
4114-
M->getOrInsertFunction(FnName, Callee->getFunctionType(),
4115-
Callee->getAttributes().removeFnAttribute(
4116-
M->getContext(), "modular-format"));
4114+
FunctionCallee ModularFn = M->getOrInsertFunction(
4115+
FnName, Callee->getFunctionType(),
4116+
Callee->getAttributes().removeFnAttribute(Ctx, "modular-format"));
41174117
CallInst *New = cast<CallInst>(CI->clone());
41184118
New->setCalledFunction(ModularFn);
41194119
New->removeFnAttr("modular-format");
@@ -4123,11 +4123,10 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
41234123
SmallString<20> Name = ImplName;
41244124
Name += '_';
41254125
Name += Aspect;
4126-
Constant *Sym =
4127-
M->getOrInsertGlobal(Name, Type::getInt8Ty(M->getContext()));
41284126
Function *RelocNoneFn =
41294127
Intrinsic::getOrInsertDeclaration(M, Intrinsic::reloc_none);
4130-
B.CreateCall(RelocNoneFn, {Sym});
4128+
B.CreateCall(RelocNoneFn,
4129+
{MetadataAsValue::get(Ctx, MDString::get(Ctx, Name))});
41314130
};
41324131

41334132
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)