[Mlir-commits] [mlir] [mlir][affine] fix the issue of celidiv mul ceildiv expression not satisfying commutative (PR #109382)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Sep 28 05:17:09 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 641b4d5370f1ce2f5d448cf63519f391be1cf263 e096a49522b4b6ce2ee06bcb8b4203ddfc268204 --extensions cpp -- mlir/lib/IR/AffineExpr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp
index c33e28d055..ef037a2e13 100644
--- a/mlir/lib/IR/AffineExpr.cpp
+++ b/mlir/lib/IR/AffineExpr.cpp
@@ -401,24 +401,22 @@ static bool isDivisibleBySymbol(AffineExpr expr, unsigned symbolPos,
// Checks divisibility by the given symbol for both operands.
case AffineExprKind::Add: {
AffineBinaryOpExpr binaryExpr = cast<AffineBinaryOpExpr>(expr);
- stack.emplace_back(binaryExpr.getLHS(), symbolPos, opKind,
- [&stack, &result, binaryExpr, symbolPos, opKind]() {
- if (result) {
- stack.emplace_back(
- binaryExpr.getRHS(), symbolPos, opKind,
- [&stack]() {
- llvm::detail::scope_exit<
- std::function<void(void)>>
- sexit(std::move(
- std::get<3>(stack.back())));
- stack.pop_back();
- });
- } else {
- llvm::detail::scope_exit<std::function<void(void)>>
- sexit(std::move(std::get<3>(stack.back())));
- stack.pop_back();
- }
- });
+ stack.emplace_back(
+ binaryExpr.getLHS(), symbolPos, opKind,
+ [&stack, &result, binaryExpr, symbolPos, opKind]() {
+ if (result) {
+ stack.emplace_back(
+ binaryExpr.getRHS(), symbolPos, opKind, [&stack]() {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ });
+ } else {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ }
+ });
break;
}
// Checks divisibility by the given symbol for both operands. Consider the
@@ -428,47 +426,44 @@ static bool isDivisibleBySymbol(AffineExpr expr, unsigned symbolPos,
// is `AffineExprKind::Mod` for this reason.
case AffineExprKind::Mod: {
AffineBinaryOpExpr binaryExpr = cast<AffineBinaryOpExpr>(expr);
- stack.emplace_back(binaryExpr.getLHS(), symbolPos, AffineExprKind::Mod,
- [&stack, &result, binaryExpr, symbolPos]() {
- if (result) {
- stack.emplace_back(
- binaryExpr.getRHS(), symbolPos,
- AffineExprKind::Mod, [&stack]() {
- llvm::detail::scope_exit<
- std::function<void(void)>>
- sexit(std::move(
- std::get<3>(stack.back())));
- stack.pop_back();
- });
- } else {
- llvm::detail::scope_exit<std::function<void(void)>>
- sexit(std::move(std::get<3>(stack.back())));
- stack.pop_back();
- }
- });
+ stack.emplace_back(
+ binaryExpr.getLHS(), symbolPos, AffineExprKind::Mod,
+ [&stack, &result, binaryExpr, symbolPos]() {
+ if (result) {
+ stack.emplace_back(
+ binaryExpr.getRHS(), symbolPos, AffineExprKind::Mod,
+ [&stack]() {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ });
+ } else {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ }
+ });
break;
}
// Checks if any of the operand divisible by the given symbol.
case AffineExprKind::Mul: {
AffineBinaryOpExpr binaryExpr = cast<AffineBinaryOpExpr>(expr);
- stack.emplace_back(binaryExpr.getLHS(), symbolPos, opKind,
- [&stack, &result, binaryExpr, symbolPos, opKind]() {
- if (!result) {
- stack.emplace_back(
- binaryExpr.getRHS(), symbolPos, opKind,
- [&stack]() {
- llvm::detail::scope_exit<
- std::function<void(void)>>
- sexit(std::move(
- std::get<3>(stack.back())));
- stack.pop_back();
- });
- } else {
- llvm::detail::scope_exit<std::function<void(void)>>
- sexit(std::move(std::get<3>(stack.back())));
- stack.pop_back();
- }
- });
+ stack.emplace_back(
+ binaryExpr.getLHS(), symbolPos, opKind,
+ [&stack, &result, binaryExpr, symbolPos, opKind]() {
+ if (!result) {
+ stack.emplace_back(
+ binaryExpr.getRHS(), symbolPos, opKind, [&stack]() {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ });
+ } else {
+ llvm::detail::scope_exit<std::function<void(void)>> sexit(
+ std::move(std::get<3>(stack.back())));
+ stack.pop_back();
+ }
+ });
break;
}
// Floordiv and ceildiv are divisible by the given symbol when the first
``````````
</details>
https://github.com/llvm/llvm-project/pull/109382
More information about the Mlir-commits
mailing list