Skip to content

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@kazutakahirata kazutakahirata requested a review from nikic October 8, 2024 02:47
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Oct 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 8, 2024

@llvm/pr-subscribers-mlir

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/111470.diff

1 Files Affected:

  • (modified) mlir/lib/Transforms/Utils/RegionUtils.cpp (+1-2)
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).

@llvmbot
Copy link
Member

llvmbot commented Oct 8, 2024

@llvm/pr-subscribers-mlir-core

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/111470.diff

1 Files Affected:

  • (modified) mlir/lib/Transforms/Utils/RegionUtils.cpp (+1-2)
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).

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit 1e5f32e into llvm:main Oct 8, 2024
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_Transforms branch October 8, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants