[llvm] [llvm-profgen] Support creating profiles of arbitrary events (PR #99026)

Wei Xiao via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 20 00:29:24 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.
----------------
williamweixiao wrote:

instead of applying duplication factors and taking MAX of the counts.

https://github.com/llvm/llvm-project/pull/99026


More information about the llvm-commits mailing list