[PATCH] D81945: [CodeGen] Fix warnings in isPow2VectorType and getPow2VectorType

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 18 01:36:14 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGae22e8416347: [CodeGen] Fix warnings in isPow2VectorType and getPow2VectorType (authored by david-arm).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81945/new/

https://reviews.llvm.org/D81945

Files:
  llvm/include/llvm/CodeGen/ValueTypes.h


Index: llvm/include/llvm/CodeGen/ValueTypes.h
===================================================================
--- llvm/include/llvm/CodeGen/ValueTypes.h
+++ llvm/include/llvm/CodeGen/ValueTypes.h
@@ -389,7 +389,7 @@
 
     /// Returns true if the given vector is a power of 2.
     bool isPow2VectorType() const {
-      unsigned NElts = getVectorNumElements();
+      unsigned NElts = getVectorMinNumElements();
       return !(NElts & (NElts - 1));
     }
 
@@ -397,10 +397,9 @@
     /// and returns that type.
     EVT getPow2VectorType(LLVMContext &Context) const {
       if (!isPow2VectorType()) {
-        unsigned NElts = getVectorNumElements();
-        unsigned Pow2NElts = 1 <<  Log2_32_Ceil(NElts);
-        return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts,
-                                isScalableVector());
+        ElementCount NElts = getVectorElementCount();
+        NElts.Min = 1 << Log2_32_Ceil(NElts.Min);
+        return EVT::getVectorVT(Context, getVectorElementType(), NElts);
       }
       else {
         return *this;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81945.271606.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200618/cf96a7ad/attachment.bin>


More information about the llvm-commits mailing list