[PATCH] D104451: [GlobalISel] NFC: Change LLT::vector to take ElementCount.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 08:47:58 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/include/llvm/Support/LowLevelTypeImpl.h:100
   static LLT scalarOrVector(uint16_t NumElements, LLT ScalarTy) {
-    return NumElements == 1 ? ScalarTy : LLT::vector(NumElements, ScalarTy);
+    // FIXME: Migrate interface to use ElementCount
+    return NumElements == 1 ? ScalarTy
----------------
arsenm wrote:
> Is there actually a context where you would use this which would need a scalable vector?
The context would be where the algorithm that uses `scalarOrVector` is agnostic of whether the type is fixed or scalable and just passes an `ElementCount`.
As an example: `LLT::divide(int Factor)` would return `v2i64` for `v4i64.divide(2)`, `nxv2i64` for `nxv4i64.divide(2)`, but `i64` for `v2i64.divide(2)`. And instead of having to write if conditional code, it can work on ElementCount directly (see its implementation in D104452)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104451



More information about the llvm-commits mailing list