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

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 08:19:20 PDT 2021


frasercrmck marked 2 inline comments as done.
frasercrmck 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) {
----------------
david-arm wrote:
> 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() && ...
Hi. For insert_/extract_subvector, when the subvector is a scalable type, then the index is implicitly multiplied by vscale. So it should be correct to use the minimum number in this case: IdxVal in your example is actually 18.


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