Skip to content

Commit 5a31460

Browse files
committed
[llvm] Replace calls to Type::getPointerTo (NFC)
Clean-up towards removing method Type::getPointerTo.
1 parent aea94c9 commit 5a31460

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static void createInitOrFiniCalls(Function &F, bool IsCtor) {
128128
LoopBB, ExitBB);
129129
IRB.SetInsertPoint(LoopBB);
130130
auto *CallBackPHI = IRB.CreatePHI(PtrTy, 2, "ptr");
131-
auto *CallBack = IRB.CreateLoad(CallBackTy->getPointerTo(F.getAddressSpace()),
131+
auto *CallBack = IRB.CreateLoad(IRB.getPtrTy(F.getAddressSpace()),
132132
CallBackPHI, "callback");
133133
IRB.CreateCall(CallBackTy, CallBack);
134134
auto *NewCallBack =

llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static void createInitOrFiniCalls(Function &F, bool IsCtor) {
189189
LoopBB, ExitBB);
190190
IRB.SetInsertPoint(LoopBB);
191191
auto *CallBackPHI = IRB.CreatePHI(PtrTy, 2, "ptr");
192-
auto *CallBack = IRB.CreateLoad(CallBackTy->getPointerTo(F.getAddressSpace()),
192+
auto *CallBack = IRB.CreateLoad(IRB.getPtrTy(F.getAddressSpace()),
193193
CallBackPHI, "callback");
194194
IRB.CreateCall(CallBackTy, CallBack);
195195
auto *NewCallBack =

llvm/unittests/IR/InstructionsTest.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ TEST(InstructionsTest, CloneCall) {
714714
Type *Int32Ty = Type::getInt32Ty(C);
715715
Type *ArgTys[] = {Int32Ty, Int32Ty, Int32Ty};
716716
FunctionType *FnTy = FunctionType::get(Int32Ty, ArgTys, /*isVarArg=*/false);
717-
Value *Callee = Constant::getNullValue(FnTy->getPointerTo());
717+
Value *Callee = Constant::getNullValue(PointerType::getUnqual(C));
718718
Value *Args[] = {
719719
ConstantInt::get(Int32Ty, 1),
720720
ConstantInt::get(Int32Ty, 2),
@@ -748,7 +748,7 @@ TEST(InstructionsTest, AlterCallBundles) {
748748
LLVMContext C;
749749
Type *Int32Ty = Type::getInt32Ty(C);
750750
FunctionType *FnTy = FunctionType::get(Int32Ty, Int32Ty, /*isVarArg=*/false);
751-
Value *Callee = Constant::getNullValue(FnTy->getPointerTo());
751+
Value *Callee = Constant::getNullValue(PointerType::getUnqual(C));
752752
Value *Args[] = {ConstantInt::get(Int32Ty, 42)};
753753
OperandBundleDef OldBundle("before", UndefValue::get(Int32Ty));
754754
std::unique_ptr<CallInst> Call(
@@ -775,7 +775,7 @@ TEST(InstructionsTest, AlterInvokeBundles) {
775775
LLVMContext C;
776776
Type *Int32Ty = Type::getInt32Ty(C);
777777
FunctionType *FnTy = FunctionType::get(Int32Ty, Int32Ty, /*isVarArg=*/false);
778-
Value *Callee = Constant::getNullValue(FnTy->getPointerTo());
778+
Value *Callee = Constant::getNullValue(PointerType::getUnqual(C));
779779
Value *Args[] = {ConstantInt::get(Int32Ty, 42)};
780780
std::unique_ptr<BasicBlock> NormalDest(BasicBlock::Create(C));
781781
std::unique_ptr<BasicBlock> UnwindDest(BasicBlock::Create(C));
@@ -1501,50 +1501,51 @@ TEST(InstructionsTest, FPCallIsFPMathOperator) {
15011501

15021502
Type *ITy = Type::getInt32Ty(C);
15031503
FunctionType *IFnTy = FunctionType::get(ITy, {});
1504-
Value *ICallee = Constant::getNullValue(IFnTy->getPointerTo());
1504+
PointerType *PtrTy = PointerType::getUnqual(C);
1505+
Value *ICallee = Constant::getNullValue(PtrTy);
15051506
std::unique_ptr<CallInst> ICall(CallInst::Create(IFnTy, ICallee, {}, ""));
15061507
EXPECT_FALSE(isa<FPMathOperator>(ICall));
15071508

15081509
Type *VITy = FixedVectorType::get(ITy, 2);
15091510
FunctionType *VIFnTy = FunctionType::get(VITy, {});
1510-
Value *VICallee = Constant::getNullValue(VIFnTy->getPointerTo());
1511+
Value *VICallee = Constant::getNullValue(PtrTy);
15111512
std::unique_ptr<CallInst> VICall(CallInst::Create(VIFnTy, VICallee, {}, ""));
15121513
EXPECT_FALSE(isa<FPMathOperator>(VICall));
15131514

15141515
Type *AITy = ArrayType::get(ITy, 2);
15151516
FunctionType *AIFnTy = FunctionType::get(AITy, {});
1516-
Value *AICallee = Constant::getNullValue(AIFnTy->getPointerTo());
1517+
Value *AICallee = Constant::getNullValue(PtrTy);
15171518
std::unique_ptr<CallInst> AICall(CallInst::Create(AIFnTy, AICallee, {}, ""));
15181519
EXPECT_FALSE(isa<FPMathOperator>(AICall));
15191520

15201521
Type *FTy = Type::getFloatTy(C);
15211522
FunctionType *FFnTy = FunctionType::get(FTy, {});
1522-
Value *FCallee = Constant::getNullValue(FFnTy->getPointerTo());
1523+
Value *FCallee = Constant::getNullValue(PtrTy);
15231524
std::unique_ptr<CallInst> FCall(CallInst::Create(FFnTy, FCallee, {}, ""));
15241525
EXPECT_TRUE(isa<FPMathOperator>(FCall));
15251526

15261527
Type *VFTy = FixedVectorType::get(FTy, 2);
15271528
FunctionType *VFFnTy = FunctionType::get(VFTy, {});
1528-
Value *VFCallee = Constant::getNullValue(VFFnTy->getPointerTo());
1529+
Value *VFCallee = Constant::getNullValue(PtrTy);
15291530
std::unique_ptr<CallInst> VFCall(CallInst::Create(VFFnTy, VFCallee, {}, ""));
15301531
EXPECT_TRUE(isa<FPMathOperator>(VFCall));
15311532

15321533
Type *AFTy = ArrayType::get(FTy, 2);
15331534
FunctionType *AFFnTy = FunctionType::get(AFTy, {});
1534-
Value *AFCallee = Constant::getNullValue(AFFnTy->getPointerTo());
1535+
Value *AFCallee = Constant::getNullValue(PtrTy);
15351536
std::unique_ptr<CallInst> AFCall(CallInst::Create(AFFnTy, AFCallee, {}, ""));
15361537
EXPECT_TRUE(isa<FPMathOperator>(AFCall));
15371538

15381539
Type *AVFTy = ArrayType::get(VFTy, 2);
15391540
FunctionType *AVFFnTy = FunctionType::get(AVFTy, {});
1540-
Value *AVFCallee = Constant::getNullValue(AVFFnTy->getPointerTo());
1541+
Value *AVFCallee = Constant::getNullValue(PtrTy);
15411542
std::unique_ptr<CallInst> AVFCall(
15421543
CallInst::Create(AVFFnTy, AVFCallee, {}, ""));
15431544
EXPECT_TRUE(isa<FPMathOperator>(AVFCall));
15441545

15451546
Type *AAVFTy = ArrayType::get(AVFTy, 2);
15461547
FunctionType *AAVFFnTy = FunctionType::get(AAVFTy, {});
1547-
Value *AAVFCallee = Constant::getNullValue(AAVFFnTy->getPointerTo());
1548+
Value *AAVFCallee = Constant::getNullValue(PtrTy);
15481549
std::unique_ptr<CallInst> AAVFCall(
15491550
CallInst::Create(AAVFFnTy, AAVFCallee, {}, ""));
15501551
EXPECT_TRUE(isa<FPMathOperator>(AAVFCall));

llvm/unittests/IR/VectorBuilderTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,8 @@ TEST_F(VectorBuilderTest, TestCreateLoadStore) {
221221

222222
auto *FloatVecTy =
223223
FixedVectorType::get(Type::getFloatTy(Context), VectorNumElements);
224-
auto *FloatVecPtrTy = FloatVecTy->getPointerTo();
225224

226-
Value *FloatVecPtr = UndefValue::get(FloatVecPtrTy);
225+
Value *FloatVecPtr = UndefValue::get(Builder.getPtrTy(0));
227226
Value *FloatVec = UndefValue::get(FloatVecTy);
228227

229228
// vp.load

0 commit comments

Comments
 (0)