[PATCH] D154760: [DAGCombine] Canonicalize operands for visitANDLike
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 8 04:01:27 PDT 2023
RKSimon added a comment.
please can you add test cases?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6126
// TODO: Rewrite this to return a new 'AND' instead of using CombineTo.
- if (N0.getOpcode() == ISD::ADD && N1.getOpcode() == ISD::SRL &&
- VT.getSizeInBits() <= 64 && N0->hasOneUse()) {
- if (ConstantSDNode *ADDI = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
- if (ConstantSDNode *SRLI = dyn_cast<ConstantSDNode>(N1.getOperand(1))) {
+ if (N0.getOpcode() == ISD::SRL && N1.getOpcode() == ISD::ADD &&
+ VT.getSizeInBits() <= 64 && N1->hasOneUse()) {
----------------
Why are you having to swap all the ADD/SRL operand handling? Can't you just adjust the std::swap code above?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154760/new/
https://reviews.llvm.org/D154760
More information about the llvm-commits
mailing list