[PATCH] D121187: [DAGCombiner][VP] Add DAGCombine for VP_MUL.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 13 19:44:20 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22863
+  if (ConstValue1 && ConstValue1->isZero()) {
+    return DAG.getSplatVector(
+        VT, SDLoc(N),
----------------
I think we should only use getSplatVector for scalable vectors. Fixed vectors should use getSplatBuildVector.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22863
+  if (ConstValue1 && ConstValue1->isZero()) {
+    return DAG.getSplatVector(
+        VT, SDLoc(N),
----------------
craig.topper wrote:
> I think we should only use getSplatVector for scalable vectors. Fixed vectors should use getSplatBuildVector.
You can just call `DAG.getConstant(0, SDLoc(N), VT);` It will do the right thing.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22874
+  if (ConstValue1 && ConstValue1->isAllOnes()) {
+    SDValue ZeroSplat = DAG.getSplatVector(
+        VT, SDLoc(N),
----------------
DAG.getConstant(0, SDLoc(N), VT)


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22882
+  if (ConstValue1 && ConstValue1->getAPIntValue().isPowerOf2()) {
+    SDValue Splat = DAG.getSplatVector(
+        VT, SDLoc(N),
----------------
Same comment as above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121187



More information about the llvm-commits mailing list