[llvm] r352777 - GlobalISel: Fix handling of vectors of pointers in clamp{Min, Max}NumElements

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 31 10:01:50 PST 2019


Author: arsenm
Date: Thu Jan 31 10:01:49 2019
New Revision: 352777

URL: http://llvm.org/viewvc/llvm-project?rev=352777&view=rev
Log:
GlobalISel: Fix handling of vectors of pointers in clamp{Min,Max}NumElements

This avoids hitting the assert added in r352636 in a future commit.

Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h?rev=352777&r1=352776&r2=352777&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Thu Jan 31 10:01:49 2019
@@ -712,7 +712,7 @@ public:
         [=](const LegalityQuery &Query) {
           LLT VecTy = Query.Types[TypeIdx];
           return std::make_pair(
-              TypeIdx, LLT::vector(MinElements, VecTy.getScalarSizeInBits()));
+              TypeIdx, LLT::vector(MinElements, VecTy.getElementType()));
         });
   }
   /// Limit the number of elements in EltTy vectors to at most MaxElements.
@@ -729,10 +729,8 @@ public:
         },
         [=](const LegalityQuery &Query) {
           LLT VecTy = Query.Types[TypeIdx];
-          if (MaxElements == 1)
-            return std::make_pair(TypeIdx, VecTy.getElementType());
-          return std::make_pair(
-              TypeIdx, LLT::vector(MaxElements, VecTy.getScalarSizeInBits()));
+          LLT NewTy = LLT::scalarOrVector(MaxElements, VecTy.getElementType());
+          return std::make_pair(TypeIdx, NewTy);
         });
   }
   /// Limit the number of elements for the given vectors to at least MinTy's




More information about the llvm-commits mailing list