return Count;
}
+ // Remove all call site samples for inlinees. This is needed when flattening
+ // a nested profile.
+ void removeAllCallsiteSamples() {
+ CallsiteSamples.clear();
+ }
+
// Accumulate all call target samples to update the body samples.
void updateCallsiteSamples() {
for (auto &I : BodySamples) {
return CallsiteSamples;
}
- CallsiteSampleMap &getCallsiteSamples() { return CallsiteSamples; }
-
/// Return the maximum of sample counts in a function body. When SkipCallSite
/// is false, which is the default, the return count includes samples in the
/// inlined functions. When SkipCallSite is true, the return count only
auto Ret = OutputProfiles.try_emplace(Context, FS);
FunctionSamples &Profile = Ret.first->second;
if (Ret.second) {
- // When it's the copy of the old profile, just clear all the inlinees'
- // samples.
- Profile.getCallsiteSamples().clear();
+ // Clear nested inlinees' samples for the flattened copy. These inlinees
+ // will have their own top-level entries after flattening.
+ Profile.removeAllCallsiteSamples();
// We recompute TotalSamples later, so here set to zero.
Profile.setTotalSamples(0);
} else {