[PATCH] D141079: [SelectionDAG] Improve constant folding in the presence of SPLAT_VECTOR

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 14:50:51 PST 2023


reames added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14018
+    // fold it that way
+    if (N0.getOpcode() == ISD::SPLAT_VECTOR &&
+        DAG.isConstantValueOfAnyType(N0.getOperand(0))) {
----------------
This looks to be assuming fixed width splat_vectors.  The primary use of splat_vector are scalable vectors.  


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3033
   }
+  case ISD::SPLAT_VECTOR: {
+    SDValue Scl = Op.getOperand(0);
----------------
You should be able to separate this into it's own patch with test coverage.

Note that this code is currently restricted to fixed length splat_vectors - which only hexagon currently uses.  You could chose to generalize the routine to scalable vectors if that was helpful.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141079



More information about the llvm-commits mailing list