[PATCH] D141079: [SelectionDAG] Improve constant folding in the presence of SPLAT_VECTOR
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 04:13:44 PST 2023
luke 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))) {
----------------
reames wrote:
> This looks to be assuming fixed width splat_vectors. The primary use of splat_vector are scalable vectors.
That makes sense, I was wondering what the difference was between a splat_vector and a splatted build_vector.
In this case then is it still possible to fold here?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3033
}
+ case ISD::SPLAT_VECTOR: {
+ SDValue Scl = Op.getOperand(0);
----------------
reames wrote:
> 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.
WebAssembly now uses fixed length splat_vectors too to aid in selecting splatted loads (D139871).
Will take a look at generalising this
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