diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-02-04 18:42:24 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-02-04 18:42:24 +0000 |
commit | 072382867573808d1cd5757799adfcdc697537c3 (patch) | |
tree | 494223cbfaca52a558d74796997fd4af7edc1ed0 /llvm/lib | |
parent | 5745c5f54f459bdd9de36df031e697c59f2d4717 (diff) | |
download | bcm5719-llvm-072382867573808d1cd5757799adfcdc697537c3.tar.gz bcm5719-llvm-072382867573808d1cd5757799adfcdc697537c3.zip |
GlobalISel: Fix moreElementsToNextPow2
This was completely broken. The condition was inverted, and changed
the element type for vectors of pointers.
Fixes bug 40592.
llvm-svn: 353069
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp index 1e9650f44d4..c2817a12352 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp @@ -115,8 +115,8 @@ LegalityPredicate LegalityPredicates::memSizeInBytesNotPow2(unsigned MMOIdx) { LegalityPredicate LegalityPredicates::numElementsNotPow2(unsigned TypeIdx) { return [=](const LegalityQuery &Query) { - const LLT &QueryTy = Query.Types[TypeIdx]; - return QueryTy.isVector() && isPowerOf2_32(QueryTy.getNumElements()); + const LLT QueryTy = Query.Types[TypeIdx]; + return QueryTy.isVector() && !isPowerOf2_32(QueryTy.getNumElements()); }; } diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp index 2d5422a0a9f..33228abcfb8 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp @@ -40,12 +40,11 @@ LegalizeMutation LegalizeMutations::widenScalarToNextPow2(unsigned TypeIdx, LegalizeMutation LegalizeMutations::moreElementsToNextPow2(unsigned TypeIdx, unsigned Min) { return [=](const LegalityQuery &Query) { - const LLT &VecTy = Query.Types[TypeIdx]; - unsigned NewNumElements = 1 << Log2_32_Ceil(VecTy.getNumElements()); - if (NewNumElements < Min) - NewNumElements = Min; - return std::make_pair( - TypeIdx, LLT::vector(NewNumElements, VecTy.getScalarSizeInBits())); + const LLT VecTy = Query.Types[TypeIdx]; + unsigned NewNumElements = + std::max(1u << Log2_32_Ceil(VecTy.getNumElements()), Min); + return std::make_pair(TypeIdx, + LLT::vector(NewNumElements, VecTy.getElementType())); }; } |