[PATCH] D78967: [SVE] Remove invalid usage of VectorType::getNumElements in Function

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 17:16:43 PDT 2020


ctetreau added inline comments.


================
Comment at: llvm/lib/IR/Function.cpp:1081
+    // FIXME: Explicit conversion from fixed to scalable vector. Can/should this
+    // happen?
+    return ScalableVectorType::get(Ty->getElementType(),
----------------
efriedma wrote:
> It's intentional.  See EncodeFixedType in llvm/utils/TableGen/IntrinsicEmitter.cpp .  Actually, Ty should always be a FixedVectorType here, I think; maybe we can just `cast<FixedVectorType>` here?
It's not super clear to me because the types and values don't line up exactly, but it seems like this all has to do with serialization, and in the stream there's something like:

   VALUE    -> PREFIX SUFFIX
   PREFIX   -> SCALABLE |
   SCALABLE -> [value that specifies if the following is actually a scalable vector]
   SUFFIX   -> [value for a fixed width vector]

... seems like a bit of an abuse to me, but doing anything about it would involve changing the data layout.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78967





More information about the llvm-commits mailing list