[llvm] [CodeGen] Use round-down algorithm for uncooperative constants (PR #99666)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 10:09:08 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 9da9127fec7b0a252b80d60b09b8c0ccedb41672 b401c547d4442915022c39a041b49f6977a4fa72 --extensions h,cpp -- llvm/include/llvm/Support/DivisionByConstantInfo.h llvm/lib/Support/DivisionByConstantInfo.cpp llvm/unittests/Support/DivisionByConstantTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Support/DivisionByConstantInfo.cpp b/llvm/lib/Support/DivisionByConstantInfo.cpp
index 6290cb91cb..1f05497144 100644
--- a/llvm/lib/Support/DivisionByConstantInfo.cpp
+++ b/llvm/lib/Support/DivisionByConstantInfo.cpp
@@ -71,7 +71,8 @@ SignedDivisionByConstantInfo SignedDivisionByConstantInfo::get(const APInt &D) {
/// LeadingZeros can be used to simplify the calculation if the upper bits
/// of the divided value are known zero.
-static UnsignedDivisionByConstantInfo get2(const APInt &D, unsigned LeadingZeros) {
+static UnsignedDivisionByConstantInfo get2(const APInt &D,
+ unsigned LeadingZeros) {
assert(!D.isZero() && !D.isOne() && "Precondition violation.");
assert(D.getBitWidth() > 1 && "Does not work at smaller bitwidths.");
@@ -207,7 +208,7 @@ UnsignedDivisionByConstantInfo::get(const APInt &D, unsigned LeadingZeros) {
Retval.PostShift = Exponent;
Retval.IsAdd = false;
} else if (!D[0]) {
- //
+ //
Retval.Magic = MultiplierRoundDown;
Retval.PreShift = 0;
Retval.PostShift = ExponentRoundDown;
@@ -223,4 +224,3 @@ UnsignedDivisionByConstantInfo::get(const APInt &D, unsigned LeadingZeros) {
return Retval;
}
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/99666
More information about the llvm-commits
mailing list