[PATCH] D152147: [RISCV] Fold binary op into select if profitable.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 13 10:18:45 PDT 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5784
+ unsigned OtherSelOpNo = 2;
+ SDValue ConstSelOp = Sel->getOperand(1);
+ ConstantSDNode *ConstSelOpNode = dyn_cast<ConstantSDNode>(ConstSelOp);
----------------
Can `ConstSelOp` and `ConstSelOpNode` be moved below the if by using `ConstSelOpNo`?
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5846
+ if (Op.hasOneUse() && isBinOp(Op->use_begin()->getOpcode())) {
+ SDNode *BinOp = *Op->use_begin();
----------------
Is this safe for division/remainder? The select could be sanitizing inputs. RISC-V doesn't have traps for div/rem, but IR/SelectionDAG semantics consider division by 0 to be immediate UB. Same with (sdiv -1, INT_MIN)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152147/new/
https://reviews.llvm.org/D152147
More information about the llvm-commits
mailing list