From: Matt Arsenault Date: Thu, 31 Jan 2019 18:01:49 +0000 (+0000) Subject: GlobalISel: Fix handling of vectors of pointers in clamp{Min,Max}NumElements X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1efa4deccde60526344842497fbe803b4ce5bdd0;p=llvm GlobalISel: Fix handling of vectors of pointers in clamp{Min,Max}NumElements This avoids hitting the assert added in r352636 in a future commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352777 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h b/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h index 393af1529f0..17acfc2c3c7 100644 --- a/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h +++ b/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h @@ -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