[PATCH] D102262: [ValueTypes] Rename MVT::getVectorNumElements() to MVT::getVectorMinNumElements(). Fix some misuses of getVectorNumElements()

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 01:14:13 PDT 2021


frasercrmck accepted this revision.
frasercrmck added a comment.

LGTM, with some optional nits.



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:2104
 
-  if (VT.getVectorNumElements() != 1 &&
+  if (!VT.isScalableVector() && VT.getVectorNumElements() != 1 &&
       VT.getVectorElementType() != MVT::i1)
----------------
You could probably also express this (and elsewhere) with `!VT.getVectorElementCount().isScalar()` as is done in some other places, but I'm undecided which is better


================
Comment at: llvm/utils/TableGen/CodeGenDAGPatterns.cpp:699
   // processed identically.
-  auto NoLength = [](const SmallSet<unsigned,2> &Lengths, MVT T) -> bool {
-    return !Lengths.count(T.isVector() ? T.getVectorNumElements() : 0);
+  auto NoLength = [](const SmallSet<std::pair<bool, unsigned>, 2> &Lengths,
+                     MVT T) -> bool {
----------------
I don't know if there's a way of making this a bit cleaner without impacting TableGen performance. Would `ElementCount` with `getNull` for scalars work? `T.isVector() ? T.getVectorElementCount() : ElementCount::getNull()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102262



More information about the llvm-commits mailing list