[llvm] [BOLT] Avoid repeated hash lookups (NFC) (PR #112822)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 20:25:57 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112822
None
>From 42494e2e4e6c8028d312b49075e33ade14fadd71 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 17 Oct 2024 07:52:00 -0700
Subject: [PATCH] [BOLT] Avoid repeated hash lookups (NFC)
---
bolt/lib/Passes/VeneerElimination.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bolt/lib/Passes/VeneerElimination.cpp b/bolt/lib/Passes/VeneerElimination.cpp
index 87fe625e8c3b3e..8bf0359477c658 100644
--- a/bolt/lib/Passes/VeneerElimination.cpp
+++ b/bolt/lib/Passes/VeneerElimination.cpp
@@ -73,12 +73,12 @@ Error VeneerElimination::runOnFunctions(BinaryContext &BC) {
continue;
const MCSymbol *TargetSymbol = BC.MIB->getTargetSymbol(Instr, 0);
- if (VeneerDestinations.find(TargetSymbol) == VeneerDestinations.end())
+ auto It = VeneerDestinations.find(TargetSymbol);
+ if (It == VeneerDestinations.end())
continue;
VeneerCallers++;
- BC.MIB->replaceBranchTarget(Instr, VeneerDestinations[TargetSymbol],
- BC.Ctx.get());
+ BC.MIB->replaceBranchTarget(Instr, It->second, BC.Ctx.get());
}
}
}
More information about the llvm-commits
mailing list