[llvm] [SamplePGO] Add a cutoff for number of profile matching anchors (PR #95542)
Krzysztof Pszeniczny via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 08:17:38 PDT 2024
================
@@ -300,6 +306,16 @@ void SampleProfileMatcher::runStaleProfileMatching(
if (FilteredIRAnchorsList.empty() || FilteredProfileAnchorList.empty())
return;
+ if (FilteredIRAnchorsList.size() > SalvageStaleProfileMaxCallsites ||
----------------
amharc wrote:
Since this check is meant to prevent superlinear behaviour in case of very large functions, I think it makes sense to check for both "the profile has too many anchors" and "the IR has too many anchors". In the regular case both should be small and cases where any of those is say >1000 are exotic enough that it might be better to err on the side of caution and skip those functions.
For example: those functions are often autogenerated, in which case stale profile matching (which targets localised edits made by humans) might not be very appropriate.
https://github.com/llvm/llvm-project/pull/95542
More information about the llvm-commits
mailing list