[PATCH] D80709: [SelectionDAG] Update getNode asserts for EXTRACT/INSERT_SUBVECTOR.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 06:30:23 PDT 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5454
+           "Cannot extract a scalable vector from a fixed length vector!");
+    assert((VT.isScalableVector() != N1VT.isScalableVector() ||
+            VT.getVectorMinNumElements() <= N1VT.getVectorMinNumElements()) &&
----------------
paulwalker-arm wrote:
> david-arm wrote:
> > This suggests we permit fixed width vectors of arbitrary length being extracted as subvectors from a scalable vector. That's ok, but presumably we'll need to support that in the backend too with appropriate undefs being used to fill in the parts that exceed the bounds of the scalable vector.
> Yes and no.  We do permit the extraction of an arbitrary length fixed length vector from a scalable vector but the requirement that the extracted vector must be smaller than the source vector stands. As does the requirement for there to be no overflow. It's just that we cannot protect against those invalid use cases with a compiler time assert.
In D79806 we've defined insert/extract_subvector such that the result vector can be considered undefined if it is inserting/extracting beyond the valid runtime vector length.

```/// Elements IDX through (IDX + num_elements(T) - 1) must be valid VECTOR1
/// indices. If this condition cannot be determined statically but is false at
/// runtime, then the result vector is undefined.```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80709





More information about the llvm-commits mailing list