@@ -99,10 +99,11 @@ extern cl::opt<bool> MemProfReportHintedSizes;
9999// can only take an address of basic block located in the same function.
100100// Set `RefLocalLinkageIFunc` to true if the analyzed value references a
101101// local-linkage ifunc.
102- static bool findRefEdges (ModuleSummaryIndex &Index, const User *CurUser,
103- SetVector<ValueInfo, std::vector<ValueInfo>> &RefEdges,
104- SmallPtrSet<const User *, 8 > &Visited,
105- bool &RefLocalLinkageIFunc) {
102+ static bool
103+ findRefEdges (ModuleSummaryIndex &Index, const User *CurUser,
104+ SetVector<ValueInfo, SmallVector<ValueInfo, 0 >> &RefEdges,
105+ SmallPtrSet<const User *, 8 > &Visited,
106+ bool &RefLocalLinkageIFunc) {
106107 bool HasBlockAddress = false ;
107108 SmallVector<const User *, 32 > Worklist;
108109 if (Visited.insert (CurUser).second )
@@ -310,7 +311,7 @@ static void computeFunctionSummary(
310311 MapVector<ValueInfo, CalleeInfo, DenseMap<ValueInfo, unsigned >,
311312 std::vector<std::pair<ValueInfo, CalleeInfo>>>
312313 CallGraphEdges;
313- SetVector<ValueInfo, std::vector <ValueInfo>> RefEdges, LoadRefEdges,
314+ SetVector<ValueInfo, SmallVector <ValueInfo, 0 >> RefEdges, LoadRefEdges,
314315 StoreRefEdges;
315316 SetVector<GlobalValue::GUID, std::vector<GlobalValue::GUID>> TypeTests;
316317 SetVector<FunctionSummary::VFuncId, std::vector<FunctionSummary::VFuncId>>
@@ -568,16 +569,17 @@ static void computeFunctionSummary(
568569 if (PSI->hasPartialSampleProfile () && ScalePartialSampleProfileWorkingSetSize)
569570 Index.addBlockCount (F.size ());
570571
571- std::vector <ValueInfo> Refs;
572+ SmallVector <ValueInfo, 0 > Refs;
572573 if (IsThinLTO) {
573- auto AddRefEdges = [&](const std::vector<const Instruction *> &Instrs,
574- SetVector<ValueInfo, std::vector<ValueInfo>> &Edges,
575- SmallPtrSet<const User *, 8 > &Cache) {
576- for (const auto *I : Instrs) {
577- Cache.erase (I);
578- findRefEdges (Index, I, Edges, Cache, HasLocalIFuncCallOrRef);
579- }
580- };
574+ auto AddRefEdges =
575+ [&](const std::vector<const Instruction *> &Instrs,
576+ SetVector<ValueInfo, SmallVector<ValueInfo, 0 >> &Edges,
577+ SmallPtrSet<const User *, 8 > &Cache) {
578+ for (const auto *I : Instrs) {
579+ Cache.erase (I);
580+ findRefEdges (Index, I, Edges, Cache, HasLocalIFuncCallOrRef);
581+ }
582+ };
581583
582584 // By now we processed all instructions in a function, except
583585 // non-volatile loads and non-volatile value stores. Let's find
@@ -805,7 +807,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
805807 DenseSet<GlobalValue::GUID> &CantBePromoted,
806808 const Module &M,
807809 SmallVectorImpl<MDNode *> &Types) {
808- SetVector<ValueInfo, std::vector <ValueInfo>> RefEdges;
810+ SetVector<ValueInfo, SmallVector <ValueInfo, 0 >> RefEdges;
809811 SmallPtrSet<const User *, 8 > Visited;
810812 bool RefLocalIFunc = false ;
811813 bool HasBlockAddress =
@@ -961,7 +963,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
961963 /* MayThrow */ true ,
962964 /* HasUnknownCall */ true ,
963965 /* MustBeUnreachable */ false },
964- /* EntryCount=*/ 0 , ArrayRef <ValueInfo>{},
966+ /* EntryCount=*/ 0 , SmallVector <ValueInfo, 0 >{},
965967 ArrayRef<FunctionSummary::EdgeTy>{},
966968 ArrayRef<GlobalValue::GUID>{},
967969 ArrayRef<FunctionSummary::VFuncId>{},
@@ -978,7 +980,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
978980 GlobalVarSummary::GVarFlags (
979981 false , false , cast<GlobalVariable>(GV)->isConstant (),
980982 GlobalObject::VCallVisibilityPublic),
981- ArrayRef <ValueInfo>{});
983+ SmallVector <ValueInfo, 0 >{});
982984 Index.addGlobalValueSummary (*GV, std::move (Summary));
983985 }
984986 });
0 commit comments