[llvm] [LV] Rewrite UDiv A, B -> UDiv A, UMax(B, 1) in trip counts if needed. (PR #92177)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 13:43: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 ac946e615c625fcc7c370fac8bdbff24bfa3c9e8 32833a70445de97edc44403e184fff5232eab8d1 --extensions h,cpp -- llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
``````````
</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 97411272c2..b34748a683 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -4306,8 +4306,10 @@ ScalarEvolution::getSequentialMinMaxExpr(SCEVTypes Kind,
for (unsigned i = 1, e = Ops.size(); i != e; ++i) {
bool MayBeUB = SCEVExprContains(Ops[i], [this](const SCEV *S) {
auto *UDiv = dyn_cast<SCEVUDivExpr>(S);
- // The UDiv may be UB if the divisor is poison or zero. Unless the divisor is a non-zero constant, we have to assume the UDiv may be UB.
- return UDiv && (!isa<SCEVConstant>(UDiv->getOperand(1)) || !isKnownNonZero(UDiv->getOperand(1)));
+ // The UDiv may be UB if the divisor is poison or zero. Unless the divisor
+ // is a non-zero constant, we have to assume the UDiv may be UB.
+ return UDiv && (!isa<SCEVConstant>(UDiv->getOperand(1)) ||
+ !isKnownNonZero(UDiv->getOperand(1)));
});
if (MayBeUB)
``````````
</details>
https://github.com/llvm/llvm-project/pull/92177
More information about the llvm-commits
mailing list