[PATCH] D117794: [ISEL] Canonicalise constant splats to RHS.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 20 13:17:05 PST 2022
sdesmalen added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5613
"Operand is DELETED_NODE!");
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2);
----------------
craig.topper wrote:
> We could move the dyn_casts below the isCommutative block and fully rely on isConstantIntBuildVectorOrConstantInt inside the if. That would remove the need to swap the N1C/N2C.
Good point.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5618
if (TLI->isCommutativeBinOp(Opcode)) {
- if (N1C && !N2C) {
- std::swap(N1C, N2C);
- std::swap(N1, N2);
- } else if (N1CFP && !N2CFP) {
- std::swap(N1CFP, N2CFP);
+ bool IsN1C = N1C || isConstantIntBuildVectorOrConstantInt(N1);
+ bool IsN2C = N2C || isConstantIntBuildVectorOrConstantInt(N2);
----------------
craig.topper wrote:
> Just to confirm, This will also handle SPLAT_VECTOR despite its name. Right?
Yes, that's correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117794/new/
https://reviews.llvm.org/D117794
More information about the llvm-commits
mailing list