-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[IR][unittests] Replace of PointerType::getUnqual(Type) with opaque version (NFC) #123901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
junlarsen
merged 1 commit into
llvm:main
from
junlarsen:jun/llvm-unittests-remove-unqual-with-type
Jan 22, 2025
Merged
[IR][unittests] Replace of PointerType::getUnqual(Type) with opaque version (NFC) #123901
junlarsen
merged 1 commit into
llvm:main
from
junlarsen:jun/llvm-unittests-remove-unqual-with-type
Jan 22, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ersion (NFC) Follow up to llvm#123569
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-flang-openmp Author: Mats Jun Larsen (junlarsen) ChangesFollow up to #123569 Full diff: https://github.com/llvm/llvm-project/pull/123901.diff 5 Files Affected:
diff --git a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
index 9b2a66353260d1..f4b22e7ec4da57 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 a7b513bdfdc667..f620d2c968b3f0 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<GlobalVariable>(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<GlobalVariable>(CriticalEndCI->getArgOperand(2));
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index ed608ba57d22ca..f15774c16e766f 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 b5c5510967b9fe..2264f34436b01e 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<GetElementPtrInst>(V));
auto *GEPI = cast<GetElementPtrInst>(V);
diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp
index d06ada5953445d..e7600209e0b14b 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);
|
nikic
approved these changes
Jan 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #123569