Skip to content

Commit 6313550

Browse files
[IPO] Avoid repeated hash lookups (NFC) (#131720)
1 parent b42f8ec commit 6313550

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,13 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
236236
ArgNo = 0;
237237
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
238238
++I, ++AI, ++ArgNo) {
239-
if (!ArgsToPromote.count(&*I)) {
239+
auto ArgIt = ArgsToPromote.find(&*I);
240+
if (ArgIt == ArgsToPromote.end()) {
240241
Args.push_back(*AI); // Unmodified argument
241242
ArgAttrVec.push_back(CallPAL.getParamAttrs(ArgNo));
242243
} else if (!I->use_empty()) {
243244
Value *V = *AI;
244-
const auto &ArgParts = ArgsToPromote.find(&*I)->second;
245-
for (const auto &Pair : ArgParts) {
245+
for (const auto &Pair : ArgIt->second) {
246246
LoadInst *LI = IRB.CreateAlignedLoad(
247247
Pair.second.Ty,
248248
createByteGEP(IRB, DL, V, Pair.second.Ty, Pair.first),
@@ -266,7 +266,7 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
266266
ArgAttrVec.push_back(AttributeSet());
267267
}
268268
} else {
269-
assert(ArgsToPromote.count(&*I) && I->use_empty());
269+
assert(I->use_empty());
270270
DeadArgs.emplace_back(AI->get());
271271
}
272272
}

0 commit comments

Comments
 (0)