[llvm] [CodeGen] Avoid creating instructions dealing with ones if ones aren't involved in the division (PR #99674)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 21 11:13:10 PDT 2024
================
@@ -6628,11 +6634,14 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
Created.push_back(Q.getNode());
}
- EVT SetCCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
-
- SDValue One = DAG.getConstant(1, dl, VT);
- SDValue IsOne = DAG.getSetCC(dl, SetCCVT, N1, One, ISD::SETEQ);
- return DAG.getSelect(dl, VT, IsOne, N0, Q);
+ if (hasAOne) {
+ EVT SetCCVT =
+ getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+ SDValue One = DAG.getConstant(1, dl, VT);
+ SDValue IsOne = DAG.getSetCC(dl, SetCCVT, N1, One, ISD::SETEQ);
+ return DAG.getSelect(dl, VT, IsOne, N0, Q);
----------------
AtariDreams wrote:
It doesn't always though.
https://github.com/llvm/llvm-project/pull/99674
More information about the llvm-commits
mailing list