Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Mar 8, 2025

@llvm/pr-subscribers-backend-powerpc

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+5-3)
diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
index 0930206c0ae9b..a86da814f10e9 100644
--- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
@@ -241,9 +241,11 @@ class PPCBoolRetToInt : public FunctionPass {
       ++NumBoolCallPromotion;
     ++NumBoolToIntPromotion;
 
-    for (Value *V : Defs)
-      if (!BoolToIntMap.count(V))
-        BoolToIntMap[V] = translate(V);
+    for (Value *V : Defs) {
+      auto [It, Inserted] = BoolToIntMap.try_emplace(V);
+      if (Inserted)
+        It->second = translate(V);
+    }
 
     // Replace the operands of the translated instructions. They were set to
     // zero in the translate function.

@kazutakahirata kazutakahirata merged commit eef0dda into llvm:main Mar 8, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_PowerPC branch March 8, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants