diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 1fca1b5..f70686b 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -319,8 +319,8 @@ static FunctionSummary *calculatePrevailingSummary( function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing) { - if (auto It = CachedPrevailingSummary.find(VI); - It != CachedPrevailingSummary.end()) + auto [It, Inserted] = CachedPrevailingSummary.try_emplace(VI); + if (!Inserted) return It->second; /// At this point, prevailing symbols have been resolved. The following leads @@ -363,7 +363,6 @@ static FunctionSummary *calculatePrevailingSummary( /// future this can be revisited. /// 5. Otherwise, go conservative. - CachedPrevailingSummary[VI] = nullptr; FunctionSummary *Local = nullptr; FunctionSummary *Prevailing = nullptr; @@ -764,12 +763,12 @@ ArgumentUsesSummary collectArgumentUsesPerBlock(Argument &A, Function &F) { auto UpdateUseInfo = [&Result](Instruction *I, ArgumentAccessInfo Info) { auto *BB = I->getParent(); auto &BBInfo = Result.UsesPerBlock[BB]; - bool AlreadyVisitedInst = BBInfo.Insts.contains(I); - auto &IInfo = BBInfo.Insts[I]; + auto [It, Inserted] = BBInfo.Insts.try_emplace(I); + auto &IInfo = It->second; // Instructions that have more than one use of the argument are considered // as clobbers. - if (AlreadyVisitedInst) { + if (!Inserted) { IInfo = {ArgumentAccessInfo::AccessType::Unknown, {}}; BBInfo.HasUnknownAccess = true; return false; |