[Mlir-commits] [mlir] ef6f7c4 - [MLIR][Presburger] Simplify std::{all, any}_of -> llvm::{all, any}_of (NFC)
Arjun P
llvmlistbot at llvm.org
Tue Mar 29 10:04:52 PDT 2022
Author: Arjun P
Date: 2022-03-29T18:04:45+01:00
New Revision: ef6f7c4a60836b052a0c6d995280d19eafa31b39
URL: https://github.com/llvm/llvm-project/commit/ef6f7c4a60836b052a0c6d995280d19eafa31b39
DIFF: https://github.com/llvm/llvm-project/commit/ef6f7c4a60836b052a0c6d995280d19eafa31b39.diff
LOG: [MLIR][Presburger] Simplify std::{all,any}_of -> llvm::{all,any}_of (NFC)
Also simplify [](const F &f){ return f.foo(); } -> std::mem_fn(&F::foo)
Added:
Modified:
mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
mlir/lib/Analysis/Presburger/Simplex.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
index 5017731fe3348..f5f02455bd4b4 100644
--- a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
@@ -333,10 +333,8 @@ bool PresburgerRelation::isEqual(const PresburgerRelation &set) const {
/// false otherwise.
bool PresburgerRelation::isIntegerEmpty() const {
// The set is empty iff all of the disjuncts are empty.
- return std::all_of(integerRelations.begin(), integerRelations.end(),
- [](const IntegerRelation &disjunct) {
- return disjunct.isIntegerEmpty();
- });
+ return llvm::all_of(integerRelations,
+ std::mem_fn(&IntegerRelation::isIntegerEmpty));
}
bool PresburgerRelation::findIntegerSample(SmallVectorImpl<int64_t> &sample) {
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index d736a05f9636a..33ccfe1d83db0 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -211,8 +211,8 @@ MaybeOptimum<SmallVector<int64_t, 8>> LexSimplex::findIntegerLexMin() {
assert(!sample.isEmpty() && "If we reached here the sample should exist!");
if (sample.isUnbounded())
return OptimumKind::Unbounded;
- return llvm::to_vector<8>(llvm::map_range(
- *sample, [](const Fraction &f) { return f.getAsInteger(); }));
+ return llvm::to_vector<8>(
+ llvm::map_range(*sample, std::mem_fn(&Fraction::getAsInteger)));
}
// Polytope is integer empty.
@@ -1213,9 +1213,8 @@ class presburger::GBRSimplex {
/// First pushes a snapshot for the current simplex state to the stack so
/// that this can be rolled back later.
void addEqualityForDirection(ArrayRef<int64_t> dir) {
- assert(
- std::any_of(dir.begin(), dir.end(), [](int64_t x) { return x != 0; }) &&
- "Direction passed is the zero vector!");
+ assert(llvm::any_of(dir, [](int64_t x) { return x != 0; }) &&
+ "Direction passed is the zero vector!");
snapshotStack.push_back(simplex.getSnapshot());
simplex.addEquality(getCoeffsForDirection(dir));
}
More information about the Mlir-commits
mailing list