Skip to content

Commit 97d691b

Browse files
authored
[IR][unittests] Replace of PointerType::get(Type) with opaque version (NFC) (#123621)
In accordance with #123569
1 parent 0f9e913 commit 97d691b

File tree

8 files changed

+81
-108
lines changed

8 files changed

+81
-108
lines changed

llvm/unittests/CodeGen/LowLevelTypeTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,9 @@ 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));
309-
Type *IRVTy =
310-
VectorType::get(PointerType::get(IntegerType::get(C, 8), AS), EC);
309+
Type *IRVTy = VectorType::get(PointerType::get(C, AS), EC);
311310
EXPECT_EQ(VTy, getLLTForType(*IRVTy, DL));
312311
}
313312
}

llvm/unittests/FuzzMutate/OperationsTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ TEST(OperationsTest, SourcePreds) {
9393
Constant *v8i1 = ConstantVector::getSplat(ElementCount::getFixed(8), i1);
9494
Constant *v8i8 = ConstantVector::getSplat(ElementCount::getFixed(8), i8);
9595
Constant *v4f16 = ConstantVector::getSplat(ElementCount::getFixed(4), f16);
96-
Constant *p0i32 =
97-
ConstantPointerNull::get(PointerType::get(i32->getType(), 0));
96+
Constant *p0i32 = ConstantPointerNull::get(PointerType::get(Ctx, 0));
9897
Constant *v8p0i32 =
9998
ConstantVector::getSplat(ElementCount::getFixed(8), p0i32);
10099
Constant *vni32 = ConstantVector::getSplat(ElementCount::getScalable(8), i32);

llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,26 +323,24 @@ TEST(RandomIRBuilderTest, createStackMemory) {
323323
Type *DoubleTy = Type::getDoubleTy(Ctx);
324324
Constant *Double_0 =
325325
ConstantFP::get(Ctx, APFloat::getZero(DoubleTy->getFltSemantics()));
326-
std::array<Type *, 8> Types = {
326+
std::array<Type *, 7> Types = {
327327
Int32Ty,
328328
Int64Ty,
329329
DoubleTy,
330330
PointerType::get(Ctx, 0),
331-
PointerType::get(Int32Ty, 0),
332331
VectorType::get(Int32Ty, 4, false),
333332
StructType::create({Int32Ty, DoubleTy, Int64Ty}),
334333
ArrayType::get(Int64Ty, 4),
335334
};
336-
std::array<Value *, 8> Inits = {
335+
std::array<Value *, 7> Inits = {
337336
Int32_1,
338337
Int64_42,
339338
Double_0,
340339
UndefValue::get(Types[3]),
341-
UndefValue::get(Types[4]),
342340
ConstantVector::get({Int32_1, Int32_1, Int32_1, Int32_1}),
343-
ConstantStruct::get(cast<StructType>(Types[6]),
341+
ConstantStruct::get(cast<StructType>(Types[5]),
344342
{Int32_1, Double_0, Int64_42}),
345-
ConstantArray::get(cast<ArrayType>(Types[7]),
343+
ConstantArray::get(cast<ArrayType>(Types[6]),
346344
{Int64_42, Int64_42, Int64_42, Int64_42}),
347345
};
348346
ASSERT_EQ(Types.size(), Inits.size());

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: 66 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -220,29 +220,22 @@ 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 *PtrTy = PointerType::get(C, 0);
224+
Type *PtrAS1Ty = PointerType::get(C, 1);
225225

226-
Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
227-
Type *Int64PtrAS1Ty = PointerType::get(Int64Ty, 1);
226+
Type *V2PtrAS1Ty = FixedVectorType::get(PtrAS1Ty, 2);
227+
Type *V4PtrAS1Ty = FixedVectorType::get(PtrAS1Ty, 4);
228+
Type *VScaleV4PtrAS1Ty = ScalableVectorType::get(PtrAS1Ty, 4);
228229

229-
Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
230-
Type *V2Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 2);
231-
Type *V4Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 4);
232-
Type *VScaleV4Int32PtrAS1Ty = ScalableVectorType::get(Int32PtrAS1Ty, 4);
233-
Type *V4Int64PtrAS1Ty = FixedVectorType::get(Int64PtrAS1Ty, 4);
234-
235-
Type *V2Int64PtrTy = FixedVectorType::get(Int64PtrTy, 2);
236-
Type *V2Int32PtrTy = FixedVectorType::get(Int32PtrTy, 2);
237-
Type *VScaleV2Int32PtrTy = ScalableVectorType::get(Int32PtrTy, 2);
238-
Type *V4Int32PtrTy = FixedVectorType::get(Int32PtrTy, 4);
239-
Type *VScaleV4Int32PtrTy = ScalableVectorType::get(Int32PtrTy, 4);
240-
Type *VScaleV4Int64PtrTy = ScalableVectorType::get(Int64PtrTy, 4);
230+
Type *V2PtrTy = FixedVectorType::get(PtrTy, 2);
231+
Type *V4PtrTy = FixedVectorType::get(PtrTy, 4);
232+
Type *VScaleV2PtrTy = ScalableVectorType::get(PtrTy, 2);
233+
Type *VScaleV4PtrTy = ScalableVectorType::get(PtrTy, 4);
241234

242235
const Constant* c8 = Constant::getNullValue(V8x8Ty);
243236
const Constant* c64 = Constant::getNullValue(V8x64Ty);
244237

245-
const Constant *v2ptr32 = Constant::getNullValue(V2Int32PtrTy);
238+
const Constant *v2ptr32 = Constant::getNullValue(V2PtrTy);
246239

247240
EXPECT_EQ(CastInst::Trunc, CastInst::getCastOpcode(c64, true, V8x8Ty, true));
248241
EXPECT_EQ(CastInst::SExt, CastInst::getCastOpcode(c8, true, V8x64Ty, true));
@@ -251,23 +244,21 @@ TEST(InstructionsTest, CastInst) {
251244
EXPECT_FALSE(CastInst::isBitCastable(V8x8Ty, V8x64Ty));
252245

253246
// Check address space casts are rejected since we don't know the sizes here
254-
EXPECT_FALSE(CastInst::isBitCastable(Int32PtrTy, Int32PtrAS1Ty));
255-
EXPECT_FALSE(CastInst::isBitCastable(Int32PtrAS1Ty, Int32PtrTy));
256-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, V2Int32PtrAS1Ty));
257-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int32PtrTy));
258-
EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V2Int64PtrAS1Ty));
259-
EXPECT_EQ(CastInst::AddrSpaceCast, CastInst::getCastOpcode(v2ptr32, true,
260-
V2Int32PtrAS1Ty,
261-
true));
247+
EXPECT_FALSE(CastInst::isBitCastable(PtrTy, PtrAS1Ty));
248+
EXPECT_FALSE(CastInst::isBitCastable(PtrAS1Ty, PtrTy));
249+
EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, V2PtrAS1Ty));
250+
EXPECT_FALSE(CastInst::isBitCastable(V2PtrAS1Ty, V2PtrTy));
251+
EXPECT_TRUE(CastInst::isBitCastable(V2PtrAS1Ty, V2PtrAS1Ty));
252+
EXPECT_EQ(CastInst::AddrSpaceCast,
253+
CastInst::getCastOpcode(v2ptr32, true, V2PtrAS1Ty, true));
262254

263255
// Test mismatched number of elements for pointers
264-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V4Int64PtrAS1Ty));
265-
EXPECT_FALSE(CastInst::isBitCastable(V4Int64PtrAS1Ty, V2Int32PtrAS1Ty));
266-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrAS1Ty, V4Int32PtrAS1Ty));
267-
EXPECT_FALSE(CastInst::isBitCastable(Int32PtrTy, V2Int32PtrTy));
268-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, Int32PtrTy));
256+
EXPECT_FALSE(CastInst::isBitCastable(V2PtrAS1Ty, V4PtrAS1Ty));
257+
EXPECT_FALSE(CastInst::isBitCastable(V4PtrAS1Ty, V2PtrAS1Ty));
258+
EXPECT_FALSE(CastInst::isBitCastable(PtrTy, V2PtrTy));
259+
EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, PtrTy));
269260

270-
EXPECT_TRUE(CastInst::isBitCastable(Int32PtrTy, Int64PtrTy));
261+
EXPECT_TRUE(CastInst::isBitCastable(PtrTy, PtrTy));
271262
EXPECT_FALSE(CastInst::isBitCastable(DoubleTy, FloatTy));
272263
EXPECT_FALSE(CastInst::isBitCastable(FloatTy, DoubleTy));
273264
EXPECT_TRUE(CastInst::isBitCastable(FloatTy, FloatTy));
@@ -281,55 +272,48 @@ TEST(InstructionsTest, CastInst) {
281272
EXPECT_FALSE(CastInst::isBitCastable(Int32Ty, Int64Ty));
282273
EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, Int32Ty));
283274

284-
EXPECT_FALSE(CastInst::isBitCastable(V2Int32PtrTy, Int64Ty));
285-
EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, V2Int32PtrTy));
286-
EXPECT_TRUE(CastInst::isBitCastable(V2Int64PtrTy, V2Int32PtrTy));
287-
EXPECT_TRUE(CastInst::isBitCastable(V2Int32PtrTy, V2Int64PtrTy));
275+
EXPECT_FALSE(CastInst::isBitCastable(V2PtrTy, Int64Ty));
276+
EXPECT_FALSE(CastInst::isBitCastable(Int64Ty, V2PtrTy));
288277
EXPECT_FALSE(CastInst::isBitCastable(V2Int32Ty, V2Int64Ty));
289278
EXPECT_FALSE(CastInst::isBitCastable(V2Int64Ty, V2Int32Ty));
290279

291-
292280
EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
293-
Constant::getNullValue(V4Int32PtrTy),
294-
V2Int32PtrTy));
281+
Constant::getNullValue(V4PtrTy), V2PtrTy));
295282
EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
296-
Constant::getNullValue(V2Int32PtrTy),
297-
V4Int32PtrTy));
283+
Constant::getNullValue(V2PtrTy), V4PtrTy));
298284

299-
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
300-
Constant::getNullValue(V4Int32PtrAS1Ty),
301-
V2Int32PtrTy));
302-
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
303-
Constant::getNullValue(V2Int32PtrTy),
304-
V4Int32PtrAS1Ty));
285+
EXPECT_FALSE(CastInst::castIsValid(
286+
Instruction::AddrSpaceCast, Constant::getNullValue(V4PtrAS1Ty), V2PtrTy));
287+
EXPECT_FALSE(CastInst::castIsValid(
288+
Instruction::AddrSpaceCast, Constant::getNullValue(V2PtrTy), V4PtrAS1Ty));
305289

306290
// Address space cast of fixed/scalable vectors of pointers to scalable/fixed
307291
// vector of pointers.
308-
EXPECT_FALSE(CastInst::castIsValid(
309-
Instruction::AddrSpaceCast, Constant::getNullValue(VScaleV4Int32PtrAS1Ty),
310-
V4Int32PtrTy));
311292
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
312-
Constant::getNullValue(V4Int32PtrTy),
313-
VScaleV4Int32PtrAS1Ty));
293+
Constant::getNullValue(VScaleV4PtrAS1Ty),
294+
V4PtrTy));
295+
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
296+
Constant::getNullValue(V4PtrTy),
297+
VScaleV4PtrAS1Ty));
314298
// Address space cast of scalable vectors of pointers to scalable vector of
315299
// pointers.
316-
EXPECT_FALSE(CastInst::castIsValid(
317-
Instruction::AddrSpaceCast, Constant::getNullValue(VScaleV4Int32PtrAS1Ty),
318-
VScaleV2Int32PtrTy));
319300
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
320-
Constant::getNullValue(VScaleV2Int32PtrTy),
321-
VScaleV4Int32PtrAS1Ty));
301+
Constant::getNullValue(VScaleV4PtrAS1Ty),
302+
VScaleV2PtrTy));
303+
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
304+
Constant::getNullValue(VScaleV2PtrTy),
305+
VScaleV4PtrAS1Ty));
322306
EXPECT_TRUE(CastInst::castIsValid(Instruction::AddrSpaceCast,
323-
Constant::getNullValue(VScaleV4Int64PtrTy),
324-
VScaleV4Int32PtrAS1Ty));
307+
Constant::getNullValue(VScaleV4PtrTy),
308+
VScaleV4PtrAS1Ty));
325309
// Same number of lanes, different address space.
326-
EXPECT_TRUE(CastInst::castIsValid(
327-
Instruction::AddrSpaceCast, Constant::getNullValue(VScaleV4Int32PtrAS1Ty),
328-
VScaleV4Int32PtrTy));
310+
EXPECT_TRUE(CastInst::castIsValid(Instruction::AddrSpaceCast,
311+
Constant::getNullValue(VScaleV4PtrAS1Ty),
312+
VScaleV4PtrTy));
329313
// Same number of lanes, same address space.
330314
EXPECT_FALSE(CastInst::castIsValid(Instruction::AddrSpaceCast,
331-
Constant::getNullValue(VScaleV4Int64PtrTy),
332-
VScaleV4Int32PtrTy));
315+
Constant::getNullValue(VScaleV4PtrTy),
316+
VScaleV4PtrTy));
333317

334318
// Bit casting fixed/scalable vector to scalable/fixed vectors.
335319
EXPECT_FALSE(CastInst::castIsValid(Instruction::BitCast,
@@ -377,10 +361,10 @@ TEST(InstructionsTest, CastInst) {
377361
// pointers
378362
// First form
379363
BasicBlock *BB = BasicBlock::Create(C);
380-
Constant *NullV2I32Ptr = Constant::getNullValue(V2Int32PtrTy);
364+
Constant *NullV2I32Ptr = Constant::getNullValue(V2PtrTy);
381365
auto Inst1 = CastInst::CreatePointerCast(NullV2I32Ptr, V2Int32Ty, "foo", BB);
382366

383-
Constant *NullVScaleV2I32Ptr = Constant::getNullValue(VScaleV2Int32PtrTy);
367+
Constant *NullVScaleV2I32Ptr = Constant::getNullValue(VScaleV2PtrTy);
384368
auto Inst1VScale = CastInst::CreatePointerCast(
385369
NullVScaleV2I32Ptr, VScaleV2Int32Ty, "foo.vscale", BB);
386370

@@ -400,14 +384,12 @@ TEST(InstructionsTest, CastCAPI) {
400384
LLVMContext C;
401385

402386
Type *Int8Ty = Type::getInt8Ty(C);
403-
Type *Int32Ty = Type::getInt32Ty(C);
404387
Type *Int64Ty = Type::getInt64Ty(C);
405388

406389
Type *FloatTy = Type::getFloatTy(C);
407390
Type *DoubleTy = Type::getDoubleTy(C);
408391

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

412394
const Constant *C8 = Constant::getNullValue(Int8Ty);
413395
const Constant *C64 = Constant::getNullValue(Int64Ty);
@@ -433,12 +415,11 @@ TEST(InstructionsTest, CastCAPI) {
433415
EXPECT_EQ(LLVMFPExt,
434416
LLVMGetCastOpcode(wrap(CF32), true, wrap(DoubleTy), true));
435417

436-
const Constant *CPtr8 = Constant::getNullValue(Int8PtrTy);
418+
const Constant *CPtr8 = Constant::getNullValue(PtrTy);
437419

438420
EXPECT_EQ(LLVMPtrToInt,
439421
LLVMGetCastOpcode(wrap(CPtr8), true, wrap(Int8Ty), true));
440-
EXPECT_EQ(LLVMIntToPtr,
441-
LLVMGetCastOpcode(wrap(C8), true, wrap(Int8PtrTy), true));
422+
EXPECT_EQ(LLVMIntToPtr, LLVMGetCastOpcode(wrap(C8), true, wrap(PtrTy), true));
442423

443424
Type *V8x8Ty = FixedVectorType::get(Int8Ty, 8);
444425
Type *V8x64Ty = FixedVectorType::get(Int64Ty, 8);
@@ -448,26 +429,22 @@ TEST(InstructionsTest, CastCAPI) {
448429
EXPECT_EQ(LLVMTrunc, LLVMGetCastOpcode(wrap(CV64), true, wrap(V8x8Ty), true));
449430
EXPECT_EQ(LLVMSExt, LLVMGetCastOpcode(wrap(CV8), true, wrap(V8x64Ty), true));
450431

451-
Type *Int32PtrAS1Ty = PointerType::get(Int32Ty, 1);
452-
Type *V2Int32PtrAS1Ty = FixedVectorType::get(Int32PtrAS1Ty, 2);
453-
Type *V2Int32PtrTy = FixedVectorType::get(Int32PtrTy, 2);
454-
const Constant *CV2ptr32 = Constant::getNullValue(V2Int32PtrTy);
432+
Type *PtrAS1Ty = PointerType::get(C, 1);
433+
Type *V2PtrAS1Ty = FixedVectorType::get(PtrAS1Ty, 2);
434+
Type *V2PtrTy = FixedVectorType::get(PtrTy, 2);
435+
const Constant *CV2Ptr = Constant::getNullValue(V2PtrTy);
455436

456-
EXPECT_EQ(LLVMAddrSpaceCast, LLVMGetCastOpcode(wrap(CV2ptr32), true,
457-
wrap(V2Int32PtrAS1Ty), true));
437+
EXPECT_EQ(LLVMAddrSpaceCast,
438+
LLVMGetCastOpcode(wrap(CV2Ptr), true, wrap(V2PtrAS1Ty), true));
458439
}
459440

460441
TEST(InstructionsTest, VectorGep) {
461442
LLVMContext C;
462443

463444
// Type Definitions
464-
Type *I8Ty = IntegerType::get(C, 8);
465445
Type *I32Ty = IntegerType::get(C, 32);
466-
PointerType *Ptri8Ty = PointerType::get(I8Ty, 0);
467-
PointerType *Ptri32Ty = PointerType::get(I32Ty, 0);
468-
469-
VectorType *V2xi8PTy = FixedVectorType::get(Ptri8Ty, 2);
470-
VectorType *V2xi32PTy = FixedVectorType::get(Ptri32Ty, 2);
446+
PointerType *PtrTy = PointerType::get(C, 0);
447+
VectorType *V2xPTy = FixedVectorType::get(PtrTy, 2);
471448

472449
// Test different aspects of the vector-of-pointers type
473450
// and GEPs which use this type.
@@ -478,8 +455,8 @@ TEST(InstructionsTest, VectorGep) {
478455
Constant *C2xi32a = ConstantVector::get(ConstVa);
479456
Constant *C2xi32b = ConstantVector::get(ConstVb);
480457

481-
CastInst *PtrVecA = new IntToPtrInst(C2xi32a, V2xi32PTy);
482-
CastInst *PtrVecB = new IntToPtrInst(C2xi32b, V2xi32PTy);
458+
CastInst *PtrVecA = new IntToPtrInst(C2xi32a, V2xPTy);
459+
CastInst *PtrVecB = new IntToPtrInst(C2xi32b, V2xPTy);
483460

484461
ICmpInst *ICmp0 = new ICmpInst(ICmpInst::ICMP_SGT, PtrVecA, PtrVecB);
485462
ICmpInst *ICmp1 = new ICmpInst(ICmpInst::ICMP_ULT, PtrVecA, PtrVecB);
@@ -495,10 +472,10 @@ TEST(InstructionsTest, VectorGep) {
495472
GetElementPtrInst *Gep2 = GetElementPtrInst::Create(I32Ty, PtrVecB, C2xi32a);
496473
GetElementPtrInst *Gep3 = GetElementPtrInst::Create(I32Ty, PtrVecB, C2xi32b);
497474

498-
CastInst *BTC0 = new BitCastInst(Gep0, V2xi8PTy);
499-
CastInst *BTC1 = new BitCastInst(Gep1, V2xi8PTy);
500-
CastInst *BTC2 = new BitCastInst(Gep2, V2xi8PTy);
501-
CastInst *BTC3 = new BitCastInst(Gep3, V2xi8PTy);
475+
CastInst *BTC0 = new BitCastInst(Gep0, V2xPTy);
476+
CastInst *BTC1 = new BitCastInst(Gep1, V2xPTy);
477+
CastInst *BTC2 = new BitCastInst(Gep2, V2xPTy);
478+
CastInst *BTC3 = new BitCastInst(Gep3, V2xPTy);
502479

503480
Value *S0 = BTC0->stripPointerCasts();
504481
Value *S1 = BTC1->stripPointerCasts();

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)