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

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 09:22:04 PDT 2020


david-arm created this revision.
david-arm added reviewers: sdesmalen, c-rhodes, ctetreau.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We should either call getVectorMinNumElements() or
getVectorElementCount().


Repository:
  rG LLVM Github Monorepo

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.271118.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/4e57c215/attachment-0001.bin>


More information about the llvm-commits mailing list