[llvm] [llvm-profgen] Support creating profiles of arbitrary events (PR #99026)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 23:48:28 PDT 2024
================
@@ -388,18 +390,25 @@ void ProfileGeneratorBase::updateBodySamplesforFunctionProfile(
// Use the maximum count of samples with same line location
uint32_t Discriminator = getBaseDiscriminator(LeafLoc.Location.Discriminator);
- // Use duplication factor to compensated for loop unroll/vectorization.
- // Note that this is only needed when we're taking MAX of the counts at
- // the location instead of SUM.
- Count *= getDuplicationFactor(LeafLoc.Location.Discriminator);
-
- ErrorOr<uint64_t> R =
- FunctionProfile.findSamplesAt(LeafLoc.Location.LineOffset, Discriminator);
-
- uint64_t PreviousCount = R ? R.get() : 0;
- if (PreviousCount <= Count) {
+ if (LeadingIPOnly) {
+ // When computing an IP-based profile we take the SUM of counts at the
+ // location instead of applying duplication factors and taking the MAX.
----------------
WenleiHe wrote:
Regardless of using IP sampling or LBR sampling, sample profile loader always take the max for profile annotation, so this is not correct in the general sense. I'm guessing what you meant is when consuming mispredict profile, sum is used at profile use time. In that case, this needs to be narrowed to only mispredict or certain profile type, not general IP profile.
https://github.com/llvm/llvm-project/pull/99026
More information about the llvm-commits
mailing list