Skip to content

Commit c5bc34a

Browse files
committed
[IR][unittests] Replace of PointerType::get(Type) with opaque version (NFC)
In accordance with #123569
1 parent 585858a commit c5bc34a

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

llvm/unittests/CodeGen/LowLevelTypeTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,10 @@ TEST(LowLevelTypeTest, Pointer) {
304304
EXPECT_FALSE(VTy != VTy);
305305

306306
// Test Type->LLT conversion.
307-
Type *IRTy = PointerType::get(IntegerType::get(C, 8), AS);
307+
Type *IRTy = PointerType::get(C, AS);
308308
EXPECT_EQ(Ty, getLLTForType(*IRTy, DL));
309309
Type *IRVTy =
310-
VectorType::get(PointerType::get(IntegerType::get(C, 8), AS), EC);
310+
VectorType::get(PointerType::get(C, AS), EC);
311311
EXPECT_EQ(VTy, getLLTForType(*IRVTy, DL));
312312
}
313313
}

llvm/unittests/FuzzMutate/OperationsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ TEST(OperationsTest, SourcePreds) {
9494
Constant *v8i8 = ConstantVector::getSplat(ElementCount::getFixed(8), i8);
9595
Constant *v4f16 = ConstantVector::getSplat(ElementCount::getFixed(4), f16);
9696
Constant *p0i32 =
97-
ConstantPointerNull::get(PointerType::get(i32->getType(), 0));
97+
ConstantPointerNull::get(PointerType::get(Ctx, 0));
9898
Constant *v8p0i32 =
9999
ConstantVector::getSplat(ElementCount::getFixed(8), p0i32);
100100
Constant *vni32 = ConstantVector::getSplat(ElementCount::getScalable(8), i32);

llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ TEST(RandomIRBuilderTest, createStackMemory) {
328328
Int64Ty,
329329
DoubleTy,
330330
PointerType::get(Ctx, 0),
331-
PointerType::get(Int32Ty, 0),
331+
PointerType::get(Ctx, 0),
332332
VectorType::get(Int32Ty, 4, false),
333333
StructType::create({Int32Ty, DoubleTy, Int64Ty}),
334334
ArrayType::get(Int64Ty, 4),

llvm/unittests/IR/ConstantsTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ TEST(ConstantsTest, GEPReplaceWithConstant) {
315315
std::unique_ptr<Module> M(new Module("MyModule", Context));
316316

317317
Type *IntTy = Type::getInt32Ty(Context);
318-
Type *PtrTy = PointerType::get(IntTy, 0);
318+
Type *PtrTy = PointerType::get(Context, 0);
319319
auto *C1 = ConstantInt::get(IntTy, 1);
320320
auto *Placeholder = new GlobalVariable(
321321
*M, IntTy, false, GlobalValue::ExternalWeakLinkage, nullptr);
@@ -342,7 +342,7 @@ TEST(ConstantsTest, AliasCAPI) {
342342
parseAssemblyString("@g = global i32 42", Error, Context);
343343
GlobalVariable *G = M->getGlobalVariable("g");
344344
Type *I16Ty = Type::getInt16Ty(Context);
345-
Type *I16PTy = PointerType::get(I16Ty, 0);
345+
Type *I16PTy = PointerType::get(Context, 0);
346346
Constant *Aliasee = ConstantExpr::getBitCast(G, I16PTy);
347347
LLVMValueRef AliasRef =
348348
LLVMAddAlias2(wrap(M.get()), wrap(I16Ty), 0, wrap(Aliasee), "a");
@@ -421,7 +421,7 @@ TEST(ConstantsTest, BitcastToGEP) {
421421

422422
auto *G =
423423
new GlobalVariable(*M, S, false, GlobalValue::ExternalLinkage, nullptr);
424-
auto *PtrTy = PointerType::get(i32, 0);
424+
auto *PtrTy = PointerType::get(Context, 0);
425425
auto *C = ConstantExpr::getBitCast(G, PtrTy);
426426
/* With opaque pointers, no cast is necessary. */
427427
EXPECT_EQ(C, G);

llvm/unittests/IR/InstructionsTest.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ TEST(InstructionsTest, CastInst) {
220220
Type *VScaleV4Int16Ty = ScalableVectorType::get(Int16Ty, 4);
221221
Type *VScaleV1Int16Ty = ScalableVectorType::get(Int16Ty, 1);
222222

223-
Type *Int32PtrTy = PointerType::get(Int32Ty, 0);
224-
Type *Int64PtrTy = PointerType::get(Int64Ty, 0);
223+
Type *Int32PtrTy = PointerType::get(C, 0);
224+
Type *Int64PtrTy = PointerType::get(C, 0);
225225

226-
Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
227-
Type *Int64PtrAS1Ty = PointerType::get(Int64Ty, 1);
226+
Type *Int32PtrAS1Ty = PointerType::get(C, 1);
227+
Type *Int64PtrAS1Ty = PointerType::get(C, 1);
228228

229229
Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
230230
Type *V2Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 2);
@@ -406,8 +406,8 @@ TEST(InstructionsTest, CastCAPI) {
406406
Type *FloatTy = Type::getFloatTy(C);
407407
Type *DoubleTy = Type::getDoubleTy(C);
408408

409-
Type *Int8PtrTy = PointerType::get(Int8Ty, 0);
410-
Type *Int32PtrTy = PointerType::get(Int32Ty, 0);
409+
Type *Int8PtrTy = PointerType::get(C, 0);
410+
Type *Int32PtrTy = PointerType::get(C, 0);
411411

412412
const Constant *C8 = Constant::getNullValue(Int8Ty);
413413
const Constant *C64 = Constant::getNullValue(Int64Ty);
@@ -448,7 +448,7 @@ TEST(InstructionsTest, CastCAPI) {
448448
EXPECT_EQ(LLVMTrunc, LLVMGetCastOpcode(wrap(CV64), true, wrap(V8x8Ty), true));
449449
EXPECT_EQ(LLVMSExt, LLVMGetCastOpcode(wrap(CV8), true, wrap(V8x64Ty), true));
450450

451-
Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
451+
Type *Int32PtrAS1Ty = PointerType::get(C, 1);
452452
Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
453453
Type *V2Int32PtrTy = FixedVectorType::get(Int32PtrTy, 2);
454454
const Constant *CV2ptr32 = Constant::getNullValue(V2Int32PtrTy);
@@ -463,8 +463,8 @@ TEST(InstructionsTest, VectorGep) {
463463
// Type Definitions
464464
Type *I8Ty = IntegerType::get(C, 8);
465465
Type *I32Ty = IntegerType::get(C, 32);
466-
PointerType *Ptri8Ty = PointerType::get(I8Ty, 0);
467-
PointerType *Ptri32Ty = PointerType::get(I32Ty, 0);
466+
PointerType *Ptri8Ty = PointerType::get(C, 0);
467+
PointerType *Ptri32Ty = PointerType::get(C, 0);
468468

469469
VectorType *V2xi8PTy = FixedVectorType::get(Ptri8Ty, 2);
470470
VectorType *V2xi32PTy = FixedVectorType::get(Ptri32Ty, 2);

llvm/unittests/IR/VerifierTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST(VerifierTest, Freeze) {
7676
FI_dbl->eraseFromParent();
7777

7878
// Valid type : freeze(i32*)
79-
PointerType *PT = PointerType::get(ITy, 0);
79+
PointerType *PT = PointerType::get(C, 0);
8080
ConstantPointerNull *CPN = ConstantPointerNull::get(PT);
8181
FreezeInst *FI_ptr = new FreezeInst(CPN);
8282
FI_ptr->insertBefore(RI);

llvm/unittests/Linker/LinkModulesTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static Module *getInternal(LLVMContext &Ctx) {
160160
IRBuilder<> Builder(BB);
161161
Builder.CreateRetVoid();
162162

163-
StructType *STy = StructType::create(Ctx, PointerType::get(FTy, 0));
163+
StructType *STy = StructType::create(Ctx, PointerType::get(Ctx, 0));
164164

165165
GlobalVariable *GV =
166166
new GlobalVariable(*InternalM, STy, false /*=isConstant*/,

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ TEST_F(VPRecipeTest, CastVPWidenSelectRecipeToVPUserAndVPDef) {
949949
TEST_F(VPRecipeTest, CastVPWidenGEPRecipeToVPUserAndVPDef) {
950950
VPlan &Plan = getPlan();
951951
IntegerType *Int32 = IntegerType::get(C, 32);
952-
PointerType *Int32Ptr = PointerType::get(Int32, 0);
952+
PointerType *Int32Ptr = PointerType::get(C, 0);
953953
auto *GEP = GetElementPtrInst::Create(Int32, PoisonValue::get(Int32Ptr),
954954
PoisonValue::get(Int32));
955955
VPValue *Op1 = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
@@ -1034,7 +1034,7 @@ TEST_F(VPRecipeTest, CastVPBranchOnMaskRecipeToVPUser) {
10341034
TEST_F(VPRecipeTest, CastVPWidenMemoryRecipeToVPUserAndVPDef) {
10351035
VPlan &Plan = getPlan();
10361036
IntegerType *Int32 = IntegerType::get(C, 32);
1037-
PointerType *Int32Ptr = PointerType::get(Int32, 0);
1037+
PointerType *Int32Ptr = PointerType::get(C, 0);
10381038
auto *Load =
10391039
new LoadInst(Int32, PoisonValue::get(Int32Ptr), "", false, Align(1));
10401040
VPValue *Addr = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
@@ -1055,7 +1055,7 @@ TEST_F(VPRecipeTest, CastVPWidenMemoryRecipeToVPUserAndVPDef) {
10551055
TEST_F(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
10561056
IntegerType *Int1 = IntegerType::get(C, 1);
10571057
IntegerType *Int32 = IntegerType::get(C, 32);
1058-
PointerType *Int32Ptr = PointerType::get(Int32, 0);
1058+
PointerType *Int32Ptr = PointerType::get(C, 0);
10591059
VPlan &Plan = getPlan();
10601060

10611061
{

0 commit comments

Comments
 (0)