================ @@ -2422,59 +2342,226 @@ void SampleProfileMatcher::runStaleProfileMatching( } } -void SampleProfileMatcher::runOnFunction(const Function &F) { - // We need to use flattened function samples for matching. - // Unlike IR, which includes all callsites from the source code, the callsites - // in profile only show up when they are hit by samples, i,e. the profile - // callsites in one context may differ from those in another context. To get - // the maximum number of callsites, we merge the function profiles from all - // contexts, aka, the flattened profile to find profile anchors. - const auto *FSFlattened = getFlattenedSamplesFor(F); - if (!FSFlattened) - return; +void SampleProfileMatcher::runStaleProfileMatching() { + for (const auto &F : M) { + if (F.isDeclaration() || !F.hasFnAttribute("use-sample-profile")) ---------------- WenleiHe wrote:
This particular check is duplicated now because we turned `runOnFunction` into `runOnModule`. Maybe make a small helper to centralize this check and keep them always in sync for the different function loops. https://github.com/llvm/llvm-project/pull/79090 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits