[Mlir-commits] [mlir] [LLVMIR] Avoid repeated hash lookups (NFC) (PR #107428)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 5 09:58:02 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/107428.diff
1 Files Affected:
- (modified) mlir/lib/Target/LLVMIR/ModuleImport.cpp (+2-3)
``````````diff
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())
``````````
</details>
https://github.com/llvm/llvm-project/pull/107428
More information about the Mlir-commits
mailing list