[PATCH] D124374: [RISCV][TargetLowering] Special case overflow expansion for (uaddo X, C).
Hsiangkai Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 16:21:21 PDT 2022
HsiangKai updated this revision to Diff 425921.
HsiangKai added a comment.
Revert the change and modify the comments only.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124374/new/
https://reviews.llvm.org/D124374
Files:
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -6971,7 +6971,10 @@
SDValue Overflow;
if (IsAdd && isOneConstant(RHS)) {
// Special case uaddo X, 1 overflowed if the addition result is 0.
- // FIXME: We can do this for any constant RHS by using (X + C) < C.
+ // The general case (X + C) < C is not necessary benefits. Although we
+ // reduce the live range of X, we may introduce the materialization of
+ // constant C, especially the setcc result is used by branch. We have no
+ // compare with constant and branch instructions.
Overflow = DAG.getSetCC(DL, N->getValueType(1), Res,
DAG.getConstant(0, DL, MVT::i64), ISD::SETEQ);
} else {
Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -8823,7 +8823,9 @@
if (IsAdd && isOneConstant(RHS)) {
// Special case: uaddo X, 1 overflowed if X+1 is 0. This potential reduces
// the live range of X. We assume comparing with 0 is cheap.
- // TODO: This generalizes to (X + C) < C.
+ // The general case (X + C) < C is not necessary benefits. Although we
+ // reduce the live range of X, we may introduce the materialization of
+ // constant C.
SetCC =
DAG.getSetCC(dl, SetCCType, Result,
DAG.getConstant(0, dl, Node->getValueType(0)), ISD::SETEQ);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124374.425921.patch
Type: text/x-patch
Size: 1690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220428/1bc01f41/attachment.bin>
More information about the llvm-commits
mailing list