[Mlir-commits] [mlir] af6ad7a - [mlir] Use DenseMap::contains (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Apr 8 15:44:29 PDT 2023


Author: Kazu Hirata
Date: 2023-04-08T15:44:18-07:00
New Revision: af6ad7ac9a81e0e292afe0e33ae404dfdd08e0e7

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

LOG: [mlir] Use DenseMap::contains (NFC)

Added: 
    

Modified: 
    mlir/lib/Interfaces/ValueBoundsOpInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
index 45193fd7f9ca..aae9f39afc18 100644
--- a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
+++ b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
@@ -84,7 +84,7 @@ AffineExpr ValueBoundsConstraintSet::getExpr(Value value,
 
   // Dynamic value: add to constraint set.
   ValueDim valueDim = std::make_pair(value, dim.value_or(kIndexValue));
-  if (valueDimToPosition.find(valueDim) == valueDimToPosition.end())
+  if (!valueDimToPosition.contains(valueDim))
     (void)insert(value, dim);
   int64_t pos = getPos(value, dim);
   return pos < cstr.getNumDimVars()
@@ -112,8 +112,7 @@ int64_t ValueBoundsConstraintSet::insert(Value value,
 #endif // NDEBUG
 
   ValueDim valueDim = std::make_pair(value, dim.value_or(kIndexValue));
-  assert((valueDimToPosition.find(valueDim) == valueDimToPosition.end()) &&
-         "already mapped");
+  assert(!valueDimToPosition.contains(valueDim) && "already mapped");
   int64_t pos = isSymbol ? cstr.appendVar(VarKind::Symbol)
                          : cstr.appendVar(VarKind::SetDim);
   positionToValueDim.insert(positionToValueDim.begin() + pos, valueDim);


        


More information about the Mlir-commits mailing list