[PATCH] D77276: Clean up usages of asserting vector getters in Type

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 14:39:06 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/IR/ConstantFold.cpp:2010
-    if (C1->getType()->getVectorIsScalable())
-      return nullptr;
     // Fast path for splatted constants.
----------------
Please split out.


================
Comment at: llvm/lib/IR/Constants.cpp:322
+    if (VTy->isScalable())
+      return false; // FIXME: the vector may contain CE
+    for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
----------------
Please split this off into a separate patch.

I think "return false" is actually correct, but it probably makes sense to assert the vector is a ConstantAggregateZero or an UndefValue.


================
Comment at: llvm/lib/IR/Function.cpp:1067
+    return VectorType::get(Ty->getElementType(),
+                           {(unsigned)Ty->getNumElements(), true});
   }
----------------
Does VectorType::getNumElements() not return unsigned?


================
Comment at: llvm/lib/IR/Verifier.cpp:4683
+    Assert(cast<VectorType>(Mask->getType())->getElementCount() ==
+               cast<VectorType>(DataTy)->getElementCount(),
            "masked_store: vector mask must be same length as data", Call);
----------------
Please don't mix functional and non-functional changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77276





More information about the llvm-commits mailing list