[PATCH] D99682: [SelectionDAG] Teach SelectionDAG::FoldConstantArithmetic to handle SPLAT_VECTOR
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 1 08:38:59 PDT 2021
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5167
+ if (VT.isScalableVector()) {
+ assert(Outputs.size() == 1 && "Vector size mismatch!");
----------------
david-arm wrote:
> This is just a suggestion, but instead of checking for scalable vectors, if you change NumOps above to be always be 1 if no BUILD_VECTORs are involved, then maybe you could write:
>
> if (Outputs.size() == 1) {
> // Must be a combination of either SPLAT_VECTOR or UNDEF.
> return getSplatVector(VT, SDLoc(), Outputs[0]);
> }
>
> However, I'm not sure about the case when both inputs are UNDEF and maybe still want to return UNDEF?
Both inputs being undef doesn't go through this code, it's handled earlier. One of the operands must be a build_vector or splat_vector.
I think using Outputs.size() == 1 would be incorrect if the fixed vector type has 1 element and the input is build_vector. We shouldn't generate splat_vector in that case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99682/new/
https://reviews.llvm.org/D99682
More information about the llvm-commits
mailing list