[llvm] 0222b55 - [IPO] Avoid repeated hash lookups (NFC) (#129987)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 6 08:49:14 PST 2025
Author: Kazu Hirata
Date: 2025-03-06T08:49:11-08:00
New Revision: 0222b5544e44ca8332fbf0e11948502d6abd887f
URL: https://github.com/llvm/llvm-project/commit/0222b5544e44ca8332fbf0e11948502d6abd887f
DIFF: https://github.com/llvm/llvm-project/commit/0222b5544e44ca8332fbf0e11948502d6abd887f.diff
LOG: [IPO] Avoid repeated hash lookups (NFC) (#129987)
Added:
Modified:
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index c440638884322..2a3df722d29c5 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -134,7 +134,8 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
unsigned ArgNo = 0, NewArgNo = 0;
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
++I, ++ArgNo) {
- if (!ArgsToPromote.count(&*I)) {
+ auto It = ArgsToPromote.find(&*I);
+ if (It == ArgsToPromote.end()) {
// Unchanged argument
Params.push_back(I->getType());
ArgAttrVec.push_back(PAL.getParamAttrs(ArgNo));
@@ -150,7 +151,7 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
NewArgIndices.push_back((unsigned)-1);
} else {
- const auto &ArgParts = ArgsToPromote.find(&*I)->second;
+ const auto &ArgParts = It->second;
for (const auto &Pair : ArgParts) {
Params.push_back(Pair.second.Ty);
ArgAttrVec.push_back(AttributeSet());
More information about the llvm-commits
mailing list