@@ -114,9 +114,8 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
114
114
// samples. Results from perfomance testing seem to favor the zero
115
115
// count though, so I'm leaving it this way for now.
116
116
return Cg.addNode (Function, Size , Function->getKnownExecutionCount ());
117
- } else {
118
- return Id;
119
117
}
118
+ return Id;
120
119
};
121
120
122
121
// Add call graph edges.
@@ -128,9 +127,8 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
128
127
for (auto &It : BC.getBinaryFunctions ()) {
129
128
BinaryFunction *Function = &It.second ;
130
129
131
- if (Filter (*Function)) {
130
+ if (Filter (*Function))
132
131
continue ;
133
- }
134
132
135
133
const CallGraph::NodeId SrcId = lookupNode (Function);
136
134
// Offset of the current basic block from the beginning of the function
@@ -146,9 +144,9 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
146
144
if (IgnoreRecursiveCalls)
147
145
return false ;
148
146
}
149
- if (Filter (*DstFunc)) {
147
+ if (Filter (*DstFunc))
150
148
return false ;
151
- }
149
+
152
150
const CallGraph::NodeId DstId = lookupNode (DstFunc);
153
151
const bool IsValidCount = Count != COUNT_NO_PROFILE;
154
152
const uint64_t AdjCount = UseEdgeCounts && IsValidCount ? Count : 1 ;
@@ -180,10 +178,9 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
180
178
if (!DstSym && BC.MIB ->hasAnnotation (Inst, " CallProfile" )) {
181
179
const auto &ICSP = BC.MIB ->getAnnotationAs <IndirectCallSiteProfile>(
182
180
Inst, " CallProfile" );
183
- for (const IndirectCallProfile &CSI : ICSP) {
181
+ for (const IndirectCallProfile &CSI : ICSP)
184
182
if (CSI.Symbol )
185
183
Counts.emplace_back (CSI.Symbol , CSI.Count );
186
- }
187
184
} else {
188
185
const uint64_t Count = BB->getExecutionCount ();
189
186
Counts.emplace_back (DstSym, Count);
@@ -214,9 +211,8 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
214
211
if (Offset > Size )
215
212
Offset = Size ;
216
213
217
- if (!recordCall (CSI.Symbol , CSI.Count )) {
214
+ if (!recordCall (CSI.Symbol , CSI.Count ))
218
215
++NotProcessed;
219
- }
220
216
}
221
217
} else {
222
218
for (BinaryBasicBlock *BB : Function->layout ()) {
@@ -253,9 +249,8 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
253
249
}
254
250
}
255
251
// Increase Offset if needed
256
- if (BBIncludedInFunctionSize) {
252
+ if (BBIncludedInFunctionSize)
257
253
Offset += BC.computeCodeSize (&Inst, &Inst + 1 );
258
- }
259
254
}
260
255
}
261
256
}
@@ -266,15 +261,14 @@ buildCallGraph(BinaryContext &BC, CgFilterFunction Filter, bool CgFromPerfData,
266
261
#else
267
262
bool PrintInfo = false ;
268
263
#endif
269
- if (PrintInfo || opts::Verbosity > 0 ) {
264
+ if (PrintInfo || opts::Verbosity > 0 )
270
265
outs () << format (" BOLT-INFO: buildCallGraph: %u nodes, %u callsites "
271
266
" (%u recursive), density = %.6lf, %u callsites not "
272
267
" processed, %u callsites with invalid profile, "
273
268
" used perf data for %u stale functions.\n " ,
274
269
Cg.numNodes (), TotalCallsites, RecursiveCallsites,
275
270
Cg.density (), NotProcessed, NoProfileCallsites,
276
271
NumFallbacks);
277
- }
278
272
279
273
return Cg;
280
274
}
0 commit comments