aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-03-08 01:01:53 -0800
committerGitHub <noreply@github.com>2025-03-08 01:01:53 -0800
commiteef0ddaeb8e13d975ffbc97b1733a0cf19e0b572 (patch)
tree3b1e297af38c9cc1e04f5bfb1dc1f2935f87fae8 /llvm/lib
parent9f83914880ad786196fb0a9658ef2c467fb23074 (diff)
downloadllvm-eef0ddaeb8e13d975ffbc97b1733a0cf19e0b572.zip
llvm-eef0ddaeb8e13d975ffbc97b1733a0cf19e0b572.tar.gz
llvm-eef0ddaeb8e13d975ffbc97b1733a0cf19e0b572.tar.bz2
[PowerPC] Avoid repeated hash lookups (NFC) (#130390)
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
index 0930206..a86da814 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.