[llvm] [AMDGPU] Use LLT::isPointerOrPointerVector in legalizer (PR #81582)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 00:39:13 PST 2024


https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/81582

None

>From 4a2c5c589ed8170ca0226b7cc6b086331897cee3 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Tue, 13 Feb 2024 08:37:15 +0000
Subject: [PATCH] [AMDGPU] Use LLT::isPointerOrPointerVector in legalizer

---
 llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
index f3716f96c44ac..5458dfc68f3df 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -342,11 +342,8 @@ static std::initializer_list<LLT> AllS64Vectors = {V2S64, V3S64, V4S64, V5S64,
 
 // Checks whether a type is in the list of legal register types.
 static bool isRegisterClassType(LLT Ty) {
-  if (Ty.isVector() && Ty.getElementType().isPointer())
-    Ty = LLT::fixed_vector(Ty.getNumElements(),
-                           LLT::scalar(Ty.getScalarSizeInBits()));
-  else if (Ty.isPointer())
-    Ty = LLT::scalar(Ty.getScalarSizeInBits());
+  if (Ty.isPointerOrPointerVector())
+    Ty = Ty.changeElementType(LLT::scalar(Ty.getScalarSizeInBits()));
 
   return is_contained(AllS32Vectors, Ty) || is_contained(AllS64Vectors, Ty) ||
          is_contained(AllScalarTypes, Ty) || is_contained(AllS16Vectors, Ty);



More information about the llvm-commits mailing list