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

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 10 19:27:36 PDT 2022


jacquesguan 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 ||
----------------
RKSimon wrote:
> Use DAG.isSplatValue instead?
I tried to use DAG.isSplatValue, but this way would affect many no splat cases of X86 target, some of them are negative.


================
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);
 }
----------------
RKSimon wrote:
> 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
Done, I only build splat_vector when is scalable now.


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