[Mlir-commits] [mlir] 7cf18ff - [LLVMIR] Avoid repeated hash lookups (NFC) (#107428)

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


Author: Kazu Hirata
Date: 2024-09-05T11:43:36-07:00
New Revision: 7cf18ff22b626efb0dad6eb9daebea821faff438

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

LOG: [LLVMIR] Avoid repeated hash lookups (NFC) (#107428)

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/ModuleImport.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
index bd761650534880..d1732cb808928a 100644
--- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
@@ -1021,9 +1021,8 @@ ModuleImport::getConstantsToConvert(llvm::Constant *constant) {
     llvm::Constant *current = workList.back();
     // Collect all dependencies of the current constant and add them to the
     // adjacency list if none has been computed before.
-    auto adjacencyIt = adjacencyLists.find(current);
-    if (adjacencyIt == adjacencyLists.end()) {
-      adjacencyIt = adjacencyLists.try_emplace(current).first;
+    auto [adjacencyIt, inserted] = adjacencyLists.try_emplace(current);
+    if (inserted) {
       // Add all constant operands to the adjacency list and skip any other
       // values such as basic block addresses.
       for (llvm::Value *operand : current->operands())


        


More information about the Mlir-commits mailing list