@@ -30,6 +30,9 @@ class FunctionSummaryIndexer : public SILInstructionVisitor<FunctionSummaryIndex
30
30
std::unique_ptr<FunctionSummary> TheSummary;
31
31
32
32
std::set<GUID> RecordedTypes;
33
+ std::set<GUID> RecordedDirectTargets;
34
+ std::set<GUID> RecordedVTableTargets;
35
+ std::set<GUID> RecordedWitnessTargets;
33
36
34
37
void indexDirectFunctionCall (const SILFunction &Callee);
35
38
void indexIndirectFunctionCall (const SILDeclRef &Callee,
@@ -95,6 +98,9 @@ class FunctionSummaryIndexer : public SILInstructionVisitor<FunctionSummaryIndex
95
98
void FunctionSummaryIndexer::indexDirectFunctionCall (
96
99
const SILFunction &Callee) {
97
100
GUID guid = getGUIDFromUniqueName (Callee.getName ());
101
+ if (!RecordedDirectTargets.insert (guid).second ) {
102
+ return ;
103
+ }
98
104
FunctionSummary::Call call (guid, Callee.getName (),
99
105
FunctionSummary::Call::Direct);
100
106
TheSummary->addCall (call);
@@ -104,6 +110,11 @@ void FunctionSummaryIndexer::indexIndirectFunctionCall(
104
110
const SILDeclRef &Callee, FunctionSummary::Call::KindTy Kind) {
105
111
std::string mangledName = Callee.mangle ();
106
112
GUID guid = getGUIDFromUniqueName (mangledName);
113
+ std::set<GUID> &RecordedTargets = Kind == FunctionSummary::Call::VTable ?
114
+ RecordedVTableTargets : RecordedWitnessTargets;
115
+ if (!RecordedTargets.insert (guid).second ) {
116
+ return ;
117
+ }
107
118
FunctionSummary::Call call (guid, mangledName, Kind);
108
119
TheSummary->addCall (call);
109
120
}
0 commit comments