[llvm] [SandboxIR] Remove sandboxir::PointerType::get(Type) (PR #123885)
Mats Jun Larsen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 21:48:56 PST 2025
https://github.com/junlarsen created https://github.com/llvm/llvm-project/pull/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
>From d09f8136fee61b6bf058d85e4f54c972c30738da Mon Sep 17 00:00:00 2001
From: Mats Larsen <mats at jun.codes>
Date: Wed, 22 Jan 2025 14:47:41 +0900
Subject: [PATCH] [SandboxIR] Remove sandboxir::PointerType::get(Type)
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
---
llvm/include/llvm/SandboxIR/Type.h | 2 --
llvm/lib/SandboxIR/Type.cpp | 4 ----
llvm/unittests/SandboxIR/SandboxIRTest.cpp | 4 ++--
llvm/unittests/SandboxIR/TypesTest.cpp | 4 ----
4 files changed, 2 insertions(+), 12 deletions(-)
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