[llvm] Add more cases for computeOverflowForSignedAdd (PR #99900)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 10:06:44 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 1c798e0b077f062dbe56603021a9b67c7621ffe0 4072ffa1aee863e6614a8eab2804b2d8dbfc17c9 --extensions cpp -- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 9cec62a3be..e060ec6474 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4241,8 +4241,8 @@ SelectionDAG::computeOverflowForSignedAdd(SDValue N0, SDValue N1) const {
// cannot overflow.
if (ComputeNumSignBits(N0) > 1 && ComputeNumSignBits(N1) > 1)
return OFK_Never;
-
- // smulhi + any value never overflow
+
+ // smulhi + any value never overflow
KnownBits N1Known = computeKnownBits(N1);
if (N0.getOpcode() == ISD::SMUL_LOHI && N0.getResNo() == 1)
return OFK_Never;
@@ -4250,8 +4250,8 @@ SelectionDAG::computeOverflowForSignedAdd(SDValue N0, SDValue N1) const {
KnownBits N0Known = computeKnownBits(N0);
if (N1.getOpcode() == ISD::SMUL_LOHI && N1.getResNo() == 1)
return OFK_Never;
-
- // Fallback to ConstantRange::signedAddMayOverflow handling.
+
+ // Fallback to ConstantRange::signedAddMayOverflow handling.
ConstantRange N0Range = ConstantRange::fromKnownBits(N0Known, false);
ConstantRange N1Range = ConstantRange::fromKnownBits(N1Known, false);
return mapOverflowResult(N0Range.signedAddMayOverflow(N1Range));
``````````
</details>
https://github.com/llvm/llvm-project/pull/99900
More information about the llvm-commits
mailing list