[PATCH] D98495: [CodeGen] Fix issues with scalable-vector INSERT/EXTRACT_SUBVECTORs

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 08:11:41 PDT 2021


david-arm added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:1292
+  // of a scalable vector.
+  if (VecVT.isScalableVector() == SubVecVT.isScalableVector() &&
+      IdxVal >= LoElems && IdxVal + SubElems <= VecElems) {
----------------
Hi @frasercrmck, I'm not sure if this even works for scalable vectors? The LoVT is scalable and you need to know the full number of elements in LoVT rather than the minimum number here. Suppose vscale = 2 and LoElems = 8, then what happens when IdxVal = 9? I think it's still accessing the Lo half in this case since the number of elements in Lo is actually 16.

I suspect you may need to restrict this further to:

  if (VecVT.isFixedLengthVector() && SubVecVT.isFixedLengthVector() && ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98495



More information about the llvm-commits mailing list