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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Jay Foad (jayfoad)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/81582.diff


1 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp (+2-5) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
index f3716f96c44ac3..5458dfc68f3dfc 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);

``````````

</details>


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


More information about the llvm-commits mailing list