[PATCH] D150824: [RISCV] Lower experimental_get_vector_length intrinsic to vsetvli for some cases.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 13:21:37 PDT 2023


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1184
+
+  if (!IsScalable)
+    return true;
----------------
craig.topper wrote:
> reames wrote:
> > For fixed vectors, we should be able to statically compute this when the ElementWidth * VF is less than VLEN right?  It's fine to do that in a different patch, just want to make sure I'm not missing something.
> The ElementWidth doesn't have any real meaning. The vectorizer already picked a VF. The get_vector_length is asking, given that VF, how many elements fit in that type. The width of the elements or VLEN doesn't change that answer.
> 
> I guess we could return a lower number but that means we'd never use the entire type the vectorizer is emitting. That seems like we a cost model issue if we actually want to use less than the type the vectorizer picks.
I see your point for fixed length vectors.  Essentially, we can let the vectorizer pick one via cost modeling, and then split as needed.  So here, we can report the number of elements even if splitting might be required.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150824



More information about the llvm-commits mailing list