Skip to content

Commit b07ee6a

Browse files
committed
LowerTypeTests: Simplify pointer types.
1 parent 5928876 commit b07ee6a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,9 @@ class LowerTypeTestsModule {
447447

448448
IntegerType *Int1Ty = Type::getInt1Ty(M.getContext());
449449
IntegerType *Int8Ty = Type::getInt8Ty(M.getContext());
450-
PointerType *Int8PtrTy = PointerType::getUnqual(M.getContext());
450+
PointerType *PtrTy = PointerType::getUnqual(M.getContext());
451451
ArrayType *Int8Arr0Ty = ArrayType::get(Type::getInt8Ty(M.getContext()), 0);
452452
IntegerType *Int32Ty = Type::getInt32Ty(M.getContext());
453-
PointerType *Int32PtrTy = PointerType::getUnqual(M.getContext());
454453
IntegerType *Int64Ty = Type::getInt64Ty(M.getContext());
455454
IntegerType *IntPtrTy = M.getDataLayout().getIntPtrType(M.getContext(), 0);
456455

@@ -654,7 +653,7 @@ void LowerTypeTestsModule::allocateByteArrays() {
654653
BAB.allocate(BAI->Bits, BAI->BitSize, ByteArrayOffsets[I], Mask);
655654

656655
BAI->MaskGlobal->replaceAllUsesWith(
657-
ConstantExpr::getIntToPtr(ConstantInt::get(Int8Ty, Mask), Int8PtrTy));
656+
ConstantExpr::getIntToPtr(ConstantInt::get(Int8Ty, Mask), PtrTy));
658657
BAI->MaskGlobal->eraseFromParent();
659658
if (BAI->MaskPtr)
660659
*BAI->MaskPtr = Mask;
@@ -948,7 +947,7 @@ uint8_t *LowerTypeTestsModule::exportTypeId(StringRef TypeId,
948947

949948
auto ExportConstant = [&](StringRef Name, uint64_t &Storage, Constant *C) {
950949
if (shouldExportConstantsAsAbsoluteSymbols())
951-
ExportGlobal(Name, ConstantExpr::getIntToPtr(C, Int8PtrTy));
950+
ExportGlobal(Name, ConstantExpr::getIntToPtr(C, PtrTy));
952951
else
953952
Storage = cast<ConstantInt>(C)->getZExtValue();
954953
};
@@ -1046,7 +1045,7 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) {
10461045

10471046
if (TIL.TheKind == TypeTestResolution::ByteArray) {
10481047
TIL.TheByteArray = ImportGlobal("byte_array");
1049-
TIL.BitMask = ImportConstant("bit_mask", TTRes.BitMask, 8, Int8PtrTy);
1048+
TIL.BitMask = ImportConstant("bit_mask", TTRes.BitMask, 8, PtrTy);
10501049
}
10511050

10521051
if (TIL.TheKind == TypeTestResolution::Inline)
@@ -1778,7 +1777,7 @@ void LowerTypeTestsModule::buildBitSetsFromFunctionsWASM(
17781777

17791778
// The indirect function table index space starts at zero, so pass a NULL
17801779
// pointer as the subtracted "jump table" offset.
1781-
lowerTypeTestCalls(TypeIds, ConstantPointerNull::get(Int32PtrTy),
1780+
lowerTypeTestCalls(TypeIds, ConstantPointerNull::get(PtrTy),
17821781
GlobalLayout);
17831782
}
17841783

0 commit comments

Comments
 (0)