[Mlir-commits] [mlir] 1e5f32e - [Transforms] Avoid repeated hash lookups (NFC) (#111470)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 8 07:29:50 PDT 2024


Author: Kazu Hirata
Date: 2024-10-08T07:29:43-07:00
New Revision: 1e5f32e81f96af45551dafb369279c6d55ac9b97

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

LOG: [Transforms] Avoid repeated hash lookups (NFC) (#111470)

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/RegionUtils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/RegionUtils.cpp b/mlir/lib/Transforms/Utils/RegionUtils.cpp
index b7d26e88230946..e55ef6eb66b9c7 100644
--- a/mlir/lib/Transforms/Utils/RegionUtils.cpp
+++ b/mlir/lib/Transforms/Utils/RegionUtils.cpp
@@ -709,8 +709,7 @@ static SmallVector<SmallVector<Value, 8>, 2> pruneRedundantArguments(
   DenseMap<Value, unsigned> firstValueToIdx;
   for (unsigned j = 0; j < numArgs; ++j) {
     Value newArg = newArguments[0][j];
-    if (!firstValueToIdx.contains(newArg))
-      firstValueToIdx[newArg] = j;
+    firstValueToIdx.try_emplace(newArg, j);
   }
 
   // Go through the first list of arguments (list 0).


        


More information about the Mlir-commits mailing list