[Mlir-commits] [mlir] 7972845 - [MLIR][Presburger] Simplify checkExplicitRepresentation
Arjun P
llvmlistbot at llvm.org
Wed Feb 2 06:50:21 PST 2022
Author: Arjun P
Date: 2022-02-02T20:20:16+05:30
New Revision: 79728453b7f6ba166289ec15c902eac8f35e2162
URL: https://github.com/llvm/llvm-project/commit/79728453b7f6ba166289ec15c902eac8f35e2162
DIFF: https://github.com/llvm/llvm-project/commit/79728453b7f6ba166289ec15c902eac8f35e2162.diff
LOG: [MLIR][Presburger] Simplify checkExplicitRepresentation
This also gets rid of a clang-tidy warning.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D118780
Added:
Modified:
mlir/lib/Analysis/Presburger/Utils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index c42e653593bb..a06304b1a266 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -184,23 +184,23 @@ static LogicalResult getDivRepr(const IntegerPolyhedron &cst, unsigned pos,
// explicit representation has not been found yet, otherwise returns `true`.
static bool checkExplicitRepresentation(const IntegerPolyhedron &cst,
ArrayRef<bool> foundRepr,
- SmallVectorImpl<int64_t> ÷nd,
+ ArrayRef<int64_t> dividend,
unsigned pos) {
// Exit to avoid circular dependencies between divisions.
- unsigned c, f;
- for (c = 0, f = cst.getNumIds(); c < f; ++c) {
+ for (unsigned c = 0, e = cst.getNumIds(); c < e; ++c) {
if (c == pos)
continue;
- if (!foundRepr[c] && dividend[c] != 0)
- break;
+
+ if (!foundRepr[c] && dividend[c] != 0) {
+ // Expression can't be constructed as it depends on a yet unknown
+ // identifier.
+ //
+ // TODO: Visit/compute the identifiers in an order so that this doesn't
+ // happen. More complex but much more efficient.
+ return false;
+ }
}
- // Expression can't be constructed as it depends on a yet unknown
- // identifier.
- // TODO: Visit/compute the identifiers in an order so that this doesn't
- // happen. More complex but much more efficient.
- if (c < f)
- return false;
return true;
}
More information about the Mlir-commits
mailing list