[llvm] [SCEV] Updates for getUDivExactExpr() to improve handling of MulExpr numerators/denominators (PR #195704)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 10:44:27 PDT 2026


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 llvm/unittests/Analysis/ScalarEvolutionTest.cpp --diff_from_common_commit
``````````

: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 52e08a25f..716346a7f 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3565,7 +3565,6 @@ const SCEV *ScalarEvolution::getUDivExpr(SCEVUse LHS, SCEVUse RHS) {
   if (LHS == RHS)
     return getConstant(LHS->getType(), 1);
 
-
   if (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(RHS)) {
     if (RHSC->getValue()->isOne())
       return LHS;                               // X udiv 1 --> x
diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
index c92620904..d4086b755 100644
--- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -1582,11 +1582,10 @@ TEST_F(ScalarEvolutionsTest, SCEVUDivFloorCeiling) {
 TEST_F(ScalarEvolutionsTest, SCEVUDivEqual) {
   LLVMContext C;
   SMDiagnostic Err;
-  std::unique_ptr<Module> M =
-      parseAssemblyString("define void @foo(i32 %a) {"
-                          "  ret void"
-                          "}",
-                          Err, C);
+  std::unique_ptr<Module> M = parseAssemblyString("define void @foo(i32 %a) {"
+                                                  "  ret void"
+                                                  "}",
+                                                  Err, C);
 
   ASSERT_TRUE(M && "Could not parse module?");
   ASSERT_TRUE(!verifyModule(*M) && "Must have been well formed!");
@@ -1602,7 +1601,6 @@ TEST_F(ScalarEvolutionsTest, SCEVUDivEqual) {
   });
 }
 
-
 TEST_F(ScalarEvolutionsTest, SCEVUDivExactPreserveNUW) {
   LLVMContext C;
   SMDiagnostic Err;

``````````

</details>


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


More information about the llvm-commits mailing list