[PATCH] D118459: [ISEL] Canonicalize STEP_VECTOR to LHS if RHS is a splat.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 04:54:53 PST 2022
sdesmalen added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5644
+ N2.getOpcode() == ISD::STEP_VECTOR)
+ std::swap(N1, N2);
}
----------------
RKSimon wrote:
> I expect we're going to need this for a lot of the DAG combines as well - is it worth adding a helper wrapper for isConstantIntBuildVectorOrConstantInt/isConstantFPBuildVectorOrConstantFP with SPLAT_VECTOR and STEP_VECTOR as well?
I'd rather avoid creating another `isConstant....` method, because we already have so many of them and despite the name, `isConstantIntBuildVectorOrConstantInt` already supports SPLAT_VECTOR (it would actually be good to clean that up a bit at some point).
For this patch, it may be worth moving this commutativity code as a whole to a separate function (e.g. `swapCommutativeOperands`), would that help?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118459/new/
https://reviews.llvm.org/D118459
More information about the llvm-commits
mailing list