[PATCH] D102073: [TargetLowering] Improve legalization of scalable vector types

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 04:56:54 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:619
 
-    // FIXME: Use CONCAT for 2x -> 4x.
-    return DAG.getBuildVector(PartVT, DL, Ops);
-  }
+  if (ElementCount::isKnownLE(PartNumElts, ValueNumElts) ||
+      PartVT.getVectorElementType() != ValueVT.getVectorElementType())
----------------
Should this also return `SDValue()` if `PartNumElts.isScalable() != ValueNumElts.isScalable()` ?


================
Comment at: llvm/lib/CodeGen/TargetLoweringBase.cpp:1515
   LegalizeTypeAction TA = getTypeAction(Context, VT);
-  if (EltCnt.getKnownMinValue() != 1 &&
+  if ((EltCnt.isScalable() || EltCnt.getFixedValue() != 1) &&
       (TA == TypeWidenVector || TA == TypePromoteInteger)) {
----------------
frasercrmck wrote:
> sdesmalen wrote:
> > Is this equivalent to `EltCnt.isVector()` ? (I assume we can assert that a minimum value of 0 is not allowed)
> I think it's more strictly equivalent to `!EltCnt.isScalar()` which I was about to update to use. I think that's marginally more readable as people may wonder why we're checking `isVector` in what's obviously a vector method. What do you think?
I'm kind of neutral on it, but I see how this may cause some confusion. Perhaps we should consider removing the `isVector()` method entirely in favour of using `!isScalar()` at some point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102073



More information about the llvm-commits mailing list