[llvm] 830bd0e - [SandboxIR] Remove sandboxir::PointerType::get(Type) (#123885)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 23:19:37 PST 2025
Author: Mats Jun Larsen
Date: 2025-01-22T16:19:33+09:00
New Revision: 830bd0e8f263c6efcfd37f38cc621b0476582b83
URL: https://github.com/llvm/llvm-project/commit/830bd0e8f263c6efcfd37f38cc621b0476582b83
DIFF: https://github.com/llvm/llvm-project/commit/830bd0e8f263c6efcfd37f38cc621b0476582b83.diff
LOG: [SandboxIR] Remove sandboxir::PointerType::get(Type) (#123885)
This was just an alias for getting the LLVM Context from the type.
We are in the process of removing the same function for the regular LLVM
type in https://github.com/llvm/llvm-project/issues/123569
Added:
Modified:
llvm/include/llvm/SandboxIR/Type.h
llvm/lib/SandboxIR/Type.cpp
llvm/unittests/SandboxIR/SandboxIRTest.cpp
llvm/unittests/SandboxIR/TypesTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/SandboxIR/Type.h b/llvm/include/llvm/SandboxIR/Type.h
index c7a8943632baeb..ec32284dacd61f 100644
--- a/llvm/include/llvm/SandboxIR/Type.h
+++ b/llvm/include/llvm/SandboxIR/Type.h
@@ -292,8 +292,6 @@ class PointerType : public Type {
public:
// TODO: add missing functions
- // TODO: Remove non-opaque variant of sandboxir::PointerType::get
- static PointerType *get(Type *ElementType, unsigned AddressSpace);
static PointerType *get(Context &Ctx, unsigned AddressSpace);
static bool classof(const Type *From) {
diff --git a/llvm/lib/SandboxIR/Type.cpp b/llvm/lib/SandboxIR/Type.cpp
index 4734d51be28227..51128bf307e9f2 100644
--- a/llvm/lib/SandboxIR/Type.cpp
+++ b/llvm/lib/SandboxIR/Type.cpp
@@ -45,10 +45,6 @@ void Type::dump() {
}
#endif
-PointerType *PointerType::get(Type *ElementType, unsigned AddressSpace) {
- return get(ElementType->getContext(), AddressSpace);
-}
-
PointerType *PointerType::get(Context &Ctx, unsigned AddressSpace) {
return cast<PointerType>(
Ctx.getType(llvm::PointerType::get(Ctx.LLVMCtx, AddressSpace)));
diff --git a/llvm/unittests/SandboxIR/SandboxIRTest.cpp b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
index 73e8ef283fc2ae..9d1c86a9b9c727 100644
--- a/llvm/unittests/SandboxIR/SandboxIRTest.cpp
+++ b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
@@ -5150,8 +5150,8 @@ define void @foo(i32 %arg, float %farg, double %darg, ptr %ptr) {
auto *Ti16 = sandboxir::Type::getInt16Ty(Ctx);
auto *Tdouble = sandboxir::Type::getDoubleTy(Ctx);
auto *Tfloat = sandboxir::Type::getFloatTy(Ctx);
- auto *Tptr = sandboxir::PointerType::get(Tfloat, 0);
- auto *Tptr1 = sandboxir::PointerType::get(Tfloat, 1);
+ auto *Tptr = sandboxir::PointerType::get(Ctx, 0);
+ auto *Tptr1 = sandboxir::PointerType::get(Ctx, 1);
// Check classof(), getOpcode(), getSrcTy(), getDstTy()
auto *ZExt = cast<sandboxir::CastInst>(&*It++);
diff --git a/llvm/unittests/SandboxIR/TypesTest.cpp b/llvm/unittests/SandboxIR/TypesTest.cpp
index 6ccd08d4e710fb..d87f034bd047e5 100644
--- a/llvm/unittests/SandboxIR/TypesTest.cpp
+++ b/llvm/unittests/SandboxIR/TypesTest.cpp
@@ -217,10 +217,6 @@ define void @foo(ptr %ptr) {
auto *F = Ctx.createFunction(LLVMF);
// Check classof(), creation.
auto *PtrTy = cast<sandboxir::PointerType>(F->getArg(0)->getType());
- // Check get(ElementType, AddressSpace).
- auto *NewPtrTy =
- sandboxir::PointerType::get(sandboxir::Type::getInt32Ty(Ctx), 0u);
- EXPECT_EQ(NewPtrTy, PtrTy);
// Check get(Ctx, AddressSpace).
auto *NewPtrTy2 = sandboxir::PointerType::get(Ctx, 0u);
EXPECT_EQ(NewPtrTy2, PtrTy);
More information about the llvm-commits
mailing list