[Mlir-commits] [mlir] 7be6ea1 - [Dialect] Avoid repeated hash lookups (NFC) (#108137)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 11 06:39:34 PDT 2024


Author: Kazu Hirata
Date: 2024-09-11T06:39:30-07:00
New Revision: 7be6ea124430c3461fb85588d6eb1af70930cfe7

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

LOG: [Dialect] Avoid repeated hash lookups (NFC) (#108137)

Added: 
    

Modified: 
    mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index d51d63f243ea0c..85604eef2f2830 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -465,9 +465,8 @@ bool AnalysisState::isValueRead(Value value) const {
 
   while (!workingSet.empty()) {
     OpOperand *uMaybeReading = workingSet.pop_back_val();
-    if (visited.contains(uMaybeReading))
+    if (!visited.insert(uMaybeReading).second)
       continue;
-    visited.insert(uMaybeReading);
 
     // Skip over all ops that neither read nor write (but create an alias).
     if (bufferizesToAliasOnly(*uMaybeReading))


        


More information about the Mlir-commits mailing list