[PATCH] D83602: [DAGCombiner] Scalarize splats with just one demanded lane

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 04:19:50 PDT 2020


aheejin added a comment.

I think this is a nice idea! But I'd like people working on other targets to check this too.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:17658
+  if (!TLI.isOperationLegalOrCustomOrPromote(Opc, ResVT))
+    return SDValue();
+
----------------
I can imagine `ADD` is legal for `MVT::i32`, but when `Opc` is `BUILD_VECTOR` or `SPLAT_VECTOR`, are they legal operations for scalar types too, such as as `MVT::i32`? If so, why? Aren't they for vector types?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:17676
+                             : DAG.getAnyExtOrTrunc(SplatVal, DL, ResVT);
+  }
+  case ISD::ADD:
----------------
Can't we use this code for `BUILD_VECTOR` here for all splat-type vectors, including `SPLAT_VECTOR`, `BUILD_VECTOR`, and `SHUFFLE_VECTOR`? `getSplatSourceVector` seems to handle all these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83602





More information about the llvm-commits mailing list