[llvm] [SCEV] Use APInt for DividesBy when collecting loop guard info (NFC). (PR #163017)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 11 14:49:25 PDT 2025


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 origin/main HEAD --extensions cpp -- llvm/lib/Analysis/ScalarEvolution.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index f321fe2fd..618146f2c 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -15639,8 +15639,7 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
     auto GetNextSCEVDividesByDivisor = [&](const SCEV *Expr,
                                            const APInt &DivisorVal) {
       const APInt *ExprVal;
-      if (!match(Expr, m_scev_APInt(ExprVal)) ||
-          DivisorVal.isNonPositive())
+      if (!match(Expr, m_scev_APInt(ExprVal)) || DivisorVal.isNonPositive())
         return Expr;
       APInt Rem = ExprVal->urem(DivisorVal);
       if (Rem.isZero())
@@ -15655,8 +15654,7 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
     auto GetPreviousSCEVDividesByDivisor = [&](const SCEV *Expr,
                                                const APInt &DivisorVal) {
       const APInt *ExprVal;
-      if (!match(Expr, m_scev_APInt(ExprVal)) || 
-          DivisorVal.isNonPositive())
+      if (!match(Expr, m_scev_APInt(ExprVal)) || DivisorVal.isNonPositive())
         return Expr;
       APInt Rem = ExprVal->urem(DivisorVal);
       // return the SCEV: Expr - Expr % Divisor

``````````

</details>


https://github.com/llvm/llvm-project/pull/163017


More information about the llvm-commits mailing list