[PATCH] D122791: [DAGCombiner] Teach scalarizeBinOpOfSplats handle scalable splat.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 04:31:13 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:23035
+  bool IsBothSplatVector = N0.getOpcode() == ISD::SPLAT_VECTOR &&
+                           N1.getOpcode() == ISD::SPLAT_VECTOR;
   if (!Src0 || !Src1 || Index0 != Index1 ||
----------------
Use DAG.isSplatValue instead?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:23039
   // bo (splat X, Index), (splat Y, Index) --> splat (bo X, Y), Index
-  SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), ScalarBO);
-  return DAG.getBuildVector(VT, DL, Ops);
+  return DAG.getSplatVector(VT, DL, ScalarBO);
 }
----------------
craig.topper wrote:
> Not sure we should be creating SPLAT_VECTOR on targets that don't support SPLAT_VECTOR. At the very least it's a waste of compile time to convert it back to a BUILD_VECTOR.
+1 at the very least we need a hasOperation() check for the getSplatVector path and getBuildVector fallback


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122791



More information about the llvm-commits mailing list