Skip to content

Commit 0222b55

Browse files
[IPO] Avoid repeated hash lookups (NFC) (#129987)
1 parent c8898b0 commit 0222b55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
134134
unsigned ArgNo = 0, NewArgNo = 0;
135135
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
136136
++I, ++ArgNo) {
137-
if (!ArgsToPromote.count(&*I)) {
137+
auto It = ArgsToPromote.find(&*I);
138+
if (It == ArgsToPromote.end()) {
138139
// Unchanged argument
139140
Params.push_back(I->getType());
140141
ArgAttrVec.push_back(PAL.getParamAttrs(ArgNo));
@@ -150,7 +151,7 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
150151

151152
NewArgIndices.push_back((unsigned)-1);
152153
} else {
153-
const auto &ArgParts = ArgsToPromote.find(&*I)->second;
154+
const auto &ArgParts = It->second;
154155
for (const auto &Pair : ArgParts) {
155156
Params.push_back(Pair.second.Ty);
156157
ArgAttrVec.push_back(AttributeSet());

0 commit comments

Comments
 (0)