[llvm] [SelectionDAG] Scalarize binary ops of splats before legal types (PR #100749)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 01:50:26 PDT 2024


================
@@ -26993,11 +26993,22 @@ static SDValue scalarizeBinOpOfSplats(SDNode *N, SelectionDAG &DAG,
   // TODO: use DAG.isSplatValue instead?
   bool IsBothSplatVector = N0.getOpcode() == ISD::SPLAT_VECTOR &&
                            N1.getOpcode() == ISD::SPLAT_VECTOR;
+
+  // If binop is legal or custom on EltVT, scalarize should be profitable. The
+  // check is the same as isOperationLegalOrCustom without isTypeLegal. We
+  // can do this only before LegalTypes, because it may generate illegal `op
+  // EltVT` from legal `op VT (splat EltVT)`, where EltVT is not legal type but
+  // the result type of splat is legal.
----------------
lukel97 wrote:

I think we can remove this comment now

https://github.com/llvm/llvm-project/pull/100749


More information about the llvm-commits mailing list