From 992b6c2ee46e18d789d0303657d8a203b7495959 Mon Sep 17 00:00:00 2001 From: Mats Larsen Date: Wed, 22 Jan 2025 16:59:22 +0900 Subject: [PATCH] [IR][unittests] Replace of PointerType::getUnqual(Type) with opaque version (NFC) Follow up to https://github.com/llvm/llvm-project/issues/123569 --- .../ExecutionEngine/Orc/IndirectionUtilsTest.cpp | 2 +- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | 3 +-- llvm/unittests/IR/ConstantsTest.cpp | 10 +++++----- llvm/unittests/IR/InstructionsTest.cpp | 4 ++-- llvm/unittests/IR/PatternMatch.cpp | 3 +-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp index 9b2a66353260d..f4b22e7ec4da5 100644 --- a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp @@ -19,7 +19,7 @@ TEST(IndirectionUtilsTest, MakeStub) { LLVMContext Context; ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", ""); StructType *ArgTy = getDummyStructTy(Context); - Type *ArgPtrTy = PointerType::getUnqual(ArgTy); + Type *ArgPtrTy = PointerType::getUnqual(Context); FunctionType *FTy = FunctionType::get( Type::getVoidTy(Context), {ArgPtrTy, ArgPtrTy}, false); Function *F = MB.createFunctionDecl(FTy, ""); diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp index a7b513bdfdc66..f620d2c968b3f 100644 --- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp +++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp @@ -3087,8 +3087,7 @@ TEST_F(OpenMPIRBuilderTest, CriticalDirective) { EXPECT_EQ(CriticalEndCI->arg_size(), 3U); EXPECT_TRUE(isa(CriticalEndCI->getArgOperand(0))); EXPECT_EQ(CriticalEndCI->getArgOperand(1), CriticalEntryCI->getArgOperand(1)); - PointerType *CriticalNamePtrTy = - PointerType::getUnqual(ArrayType::get(Type::getInt32Ty(Ctx), 8)); + PointerType *CriticalNamePtrTy = PointerType::getUnqual(Ctx); EXPECT_EQ(CriticalEndCI->getArgOperand(2), CriticalEntryCI->getArgOperand(2)); GlobalVariable *GV = dyn_cast(CriticalEndCI->getArgOperand(2)); diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp index ed608ba57d22c..f15774c16e766 100644 --- a/llvm/unittests/IR/ConstantsTest.cpp +++ b/llvm/unittests/IR/ConstantsTest.cpp @@ -184,9 +184,9 @@ TEST(ConstantsTest, AsInstructionsTest) { Type *Int16Ty = Type::getInt16Ty(Context); Constant *Global = - M->getOrInsertGlobal("dummy", PointerType::getUnqual(Int32Ty)); + M->getOrInsertGlobal("dummy", PointerType::getUnqual(Context)); Constant *Global2 = - M->getOrInsertGlobal("dummy2", PointerType::getUnqual(Int32Ty)); + M->getOrInsertGlobal("dummy2", PointerType::getUnqual(Context)); Constant *P0 = ConstantExpr::getPtrToInt(Global, Int32Ty); Constant *P4 = ConstantExpr::getPtrToInt(Global2, Int32Ty); @@ -222,7 +222,7 @@ TEST(ConstantsTest, AsInstructionsTest) { // not a normal one! // CHECK(ConstantExpr::getGetElementPtr(Global, V, false), // "getelementptr i32*, i32** @dummy, i32 1"); - CHECK(ConstantExpr::getInBoundsGetElementPtr(PointerType::getUnqual(Int32Ty), + CHECK(ConstantExpr::getInBoundsGetElementPtr(PointerType::getUnqual(Context), Global, V), "getelementptr inbounds ptr, ptr @dummy, i32 1"); @@ -250,9 +250,9 @@ TEST(ConstantsTest, ReplaceWithConstantTest) { Constant *One = ConstantInt::get(Int32Ty, 1); Constant *Global = - M->getOrInsertGlobal("dummy", PointerType::getUnqual(Int32Ty)); + M->getOrInsertGlobal("dummy", PointerType::getUnqual(Context)); Constant *GEP = ConstantExpr::getGetElementPtr( - PointerType::getUnqual(Int32Ty), Global, One); + PointerType::getUnqual(Context), Global, One); EXPECT_DEATH(Global->replaceAllUsesWith(GEP), "this->replaceAllUsesWith\\(expr\\(this\\)\\) is NOT valid!"); } diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp index b5c5510967b9f..2264f34436b01 100644 --- a/llvm/unittests/IR/InstructionsTest.cpp +++ b/llvm/unittests/IR/InstructionsTest.cpp @@ -873,8 +873,8 @@ TEST(InstructionsTest, GEPIndices) { Builder.getInt32(13), Builder.getInt32(42) }; - Value *V = Builder.CreateGEP(ArrTy, UndefValue::get(PointerType::getUnqual(ArrTy)), - Indices); + Value *V = Builder.CreateGEP( + ArrTy, UndefValue::get(PointerType::getUnqual(Context)), Indices); ASSERT_TRUE(isa(V)); auto *GEPI = cast(V); diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp index d06ada5953445..e7600209e0b14 100644 --- a/llvm/unittests/IR/PatternMatch.cpp +++ b/llvm/unittests/IR/PatternMatch.cpp @@ -2606,8 +2606,7 @@ TYPED_TEST(MutableConstTest, FCmp) { } TEST_F(PatternMatchTest, ConstExpr) { - Constant *G = - M->getOrInsertGlobal("dummy", PointerType::getUnqual(IRB.getInt32Ty())); + Constant *G = M->getOrInsertGlobal("dummy", PointerType::getUnqual(Ctx)); Constant *S = ConstantExpr::getPtrToInt(G, IRB.getInt32Ty()); Type *VecTy = FixedVectorType::get(IRB.getInt32Ty(), 2); PoisonValue *P = PoisonValue::get(VecTy);