[llvm] [SCEV] Introduce SCEVExactFlags for UDiv (PR #225065)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 04:40:38 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 h,cpp -- llvm/include/llvm/Analysis/ScalarEvolution.h llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Transforms/Utils/ScalarEvolutionExpander.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/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
index dc852f450..ff62898df 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -321,9 +321,7 @@ public:
return static_cast<ExactFlags>(SubclassData);
}
- bool isExact() const {
- return getExactFlags() == SCEV::FlagExact;
- }
+ bool isExact() const { return getExactFlags() == SCEV::FlagExact; }
void setIsExact() {
SubclassData = static_cast<unsigned short>(SCEV::FlagExact);
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 73215dd18..bf3199901 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3475,7 +3475,8 @@ const SCEV *ScalarEvolution::getURemExpr(SCEVUse LHS, SCEVUse RHS) {
/// Get a canonical unsigned division expression, or something simpler if
/// possible.
-const SCEV *ScalarEvolution::getUDivExpr(SCEVUse LHS, SCEVUse RHS, bool IsExact) {
+const SCEV *ScalarEvolution::getUDivExpr(SCEVUse LHS, SCEVUse RHS,
+ bool IsExact) {
assert(!LHS->getType()->isPointerTy() &&
"SCEVUDivExpr operand can't be pointer!");
assert(LHS->getType() == RHS->getType() &&
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 50b933da8..958ed65a4 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -297,9 +297,11 @@ Value *SCEVExpander::InsertBinop(
auto canGenerateIncompatiblePoison = [&Flags](Instruction *I) {
// Ensure that no-wrap flags match.
if (isa<OverflowingBinaryOperator>(I)) {
- if (I->hasNoSignedWrap() != any(std::get<SCEV::NoWrapFlags>(Flags) & SCEV::FlagNSW))
+ if (I->hasNoSignedWrap() !=
+ any(std::get<SCEV::NoWrapFlags>(Flags) & SCEV::FlagNSW))
return true;
- if (I->hasNoUnsignedWrap() != any(std::get<SCEV::NoWrapFlags>(Flags) & SCEV::FlagNUW))
+ if (I->hasNoUnsignedWrap() !=
+ any(std::get<SCEV::NoWrapFlags>(Flags) & SCEV::FlagNUW))
return true;
}
if (isa<PossiblyExactOperator>(I) &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/225065
More information about the llvm-commits
mailing list