[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
Fri Jan 6 07:23:25 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))) {
----------------
luke wrote:
> 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?
To my knowledge, we're a bit inconsistent about this. RISCV uses SPLAT_VECTOR only for scalable vectors. Hexagaon (and per your other comment, WebAssembly) use them for both fixed and scalable. I'm also unclear on when they use SPLAT_VECTOR vs BUILD_VECTOR.
Longer term, I do think that having one canonical representation for a splat vector makes sense, and that it'll probably be SPLAT_VECTOR. We're just not there yet. In particular, DAGCombine has various weaknesses for SPLAT_VECTOR that need to be worked through.
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