[Mlir-commits] [mlir] b2dbcf4 - [Presburger] Avoid repeated hash lookups (NFC) (#107426)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 5 11:43:22 PDT 2024


Author: Kazu Hirata
Date: 2024-09-05T11:43:19-07:00
New Revision: b2dbcf4dc1078fd62ef2295ff9696173a9991116

URL: https://github.com/llvm/llvm-project/commit/b2dbcf4dc1078fd62ef2295ff9696173a9991116
DIFF: https://github.com/llvm/llvm-project/commit/b2dbcf4dc1078fd62ef2295ff9696173a9991116.diff

LOG: [Presburger] Avoid repeated hash lookups (NFC) (#107426)

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/IntegerRelation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
index 87204d2100713b..94af81f955e5a5 100644
--- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
@@ -2367,10 +2367,8 @@ bool IntegerRelation::removeDuplicateConstraints() {
   hashTable.insert({row, 0});
   for (unsigned k = 1; k < ineqs; ++k) {
     row = getInequality(k).drop_back();
-    if (!hashTable.contains(row)) {
-      hashTable.insert({row, k});
+    if (hashTable.try_emplace(row, k).second)
       continue;
-    }
 
     // For identical cases, keep only the smaller part of the constant term.
     unsigned l = hashTable[row];


        


More information about the Mlir-commits mailing list