[PATCH] D130862: [LegalizeTypes] Improve splitting for urem by constant for some constants.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 08:41:54 PDT 2022
RKSimon added a comment.
precommit tests?
================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:4702
+ /// \returns true if the node has been expanded, false if it has not.
+ bool expandUnsignedRemainderByConstant(SDNode *N, const APInt &Divisor,
+ SDValue &Lo, SDValue &Hi, EVT HiLoVT,
----------------
expandUREMByConstant ?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:4543
+ // Try to expand UREM by constant.
+ if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1))) {
+ EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
----------------
auto *CN
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7148
+ SelectionDAG &DAG, SDValue InL, SDValue InH) const {
+ EVT VT = N->getValueType(0);
+
----------------
assert N->getOpcode == ISD::UREM?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7181
+ InH = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, HiLoVT, N->getOperand(0),
+ DAG.getIntPtrConstant(1, dl));
+ }
----------------
Are you we causing any oneuse issues if we split here and then can't expand below?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7199
+ dl,
+ getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), HiLoVT),
+ Sum, InL, ISD::SETULT);
----------------
Pull out repeated getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), HiLoVT) ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130862/new/
https://reviews.llvm.org/D130862
More information about the llvm-commits
mailing list