[llvm] 5bf5570 - [IR] Remove unit tests for typed pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 06:10:42 PDT 2023
Author: Nikita Popov
Date: 2023-07-12T15:10:33+02:00
New Revision: 5bf5570e60be4f0cd0fbfa965599c63966c55447
URL: https://github.com/llvm/llvm-project/commit/5bf5570e60be4f0cd0fbfa965599c63966c55447
DIFF: https://github.com/llvm/llvm-project/commit/5bf5570e60be4f0cd0fbfa965599c63966c55447.diff
LOG: [IR] Remove unit tests for typed pointers (NFC)
Added:
Modified:
llvm/unittests/IR/ConstantsTest.cpp
llvm/unittests/IR/TypesTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index 577d9e9e697a83..265a7020698984 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -467,9 +467,8 @@ TEST(ConstantsTest, BuildConstantDataVectors) {
}
}
-void bitcastToGEPHelper(bool useOpaquePointers) {
+TEST(ConstantsTest, BitcastToGEP) {
LLVMContext Context;
- Context.setOpaquePointers(useOpaquePointers);
std::unique_ptr<Module> M(new Module("MyModule", Context));
auto *i32 = Type::getInt32Ty(Context);
@@ -481,17 +480,8 @@ void bitcastToGEPHelper(bool useOpaquePointers) {
new GlobalVariable(*M, S, false, GlobalValue::ExternalLinkage, nullptr);
auto *PtrTy = PointerType::get(i32, 0);
auto *C = ConstantExpr::getBitCast(G, PtrTy);
- if (Context.supportsTypedPointers()) {
- EXPECT_EQ(cast<ConstantExpr>(C)->getOpcode(), Instruction::BitCast);
- } else {
- /* With opaque pointers, no cast is necessary. */
- EXPECT_EQ(C, G);
- }
-}
-
-TEST(ConstantsTest, BitcastToGEP) {
- bitcastToGEPHelper(true);
- bitcastToGEPHelper(false);
+ /* With opaque pointers, no cast is necessary. */
+ EXPECT_EQ(C, G);
}
bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
diff --git a/llvm/unittests/IR/TypesTest.cpp b/llvm/unittests/IR/TypesTest.cpp
index 2944957a8b64a8..eba808a6690bf4 100644
--- a/llvm/unittests/IR/TypesTest.cpp
+++ b/llvm/unittests/IR/TypesTest.cpp
@@ -36,10 +36,9 @@ TEST(TypesTest, LayoutIdenticalEmptyStructs) {
}
TEST(TypesTest, CopyPointerType) {
- LLVMContext COpaquePointers;
- COpaquePointers.setOpaquePointers(true);
+ LLVMContext C;
- PointerType *P1 = PointerType::get(COpaquePointers, 1);
+ PointerType *P1 = PointerType::get(C, 1);
EXPECT_TRUE(P1->isOpaque());
PointerType *P1C = PointerType::getWithSamePointeeType(P1, 1);
EXPECT_EQ(P1, P1C);
@@ -47,18 +46,6 @@ TEST(TypesTest, CopyPointerType) {
PointerType *P1C0 = PointerType::getWithSamePointeeType(P1, 0);
EXPECT_NE(P1, P1C0);
EXPECT_TRUE(P1C0->isOpaque());
-
- LLVMContext CTypedPointers;
- CTypedPointers.setOpaquePointers(false);
- Type *Int8 = Type::getInt8Ty(CTypedPointers);
- PointerType *P2 = PointerType::get(Int8, 1);
- EXPECT_FALSE(P2->isOpaque());
- PointerType *P2C = PointerType::getWithSamePointeeType(P2, 1);
- EXPECT_EQ(P2, P2C);
- EXPECT_FALSE(P2C->isOpaque());
- PointerType *P2C0 = PointerType::getWithSamePointeeType(P2, 0);
- EXPECT_NE(P2, P2C0);
- EXPECT_FALSE(P2C0->isOpaque());
}
TEST(TypesTest, TargetExtType) {
More information about the llvm-commits
mailing list