[PATCH] D99787: [CSSPGO] Fix incorrect probe distribution factor computation in top-down inliner

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 1 22:04:11 PDT 2021


wlei created this revision.
Herald added subscribers: hoy, wenlei, lxfind, hiraditya.
wlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99787

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -872,17 +872,15 @@
       // profile will be used to prorate callsites from the callee if
       // inlined. Once not inlined, the direct callsite distribution should
       // be prorated so that the it will reflect the real callsite counts.
-      setProbeDistributionFactor(CI, Candidate.CallsiteDistribution * Sum /
-                                         SumOrigin);
+      setProbeDistributionFactor(CI, 1.0 * Sum / SumOrigin);
       Candidate.CallInstr = DI;
       if (isa<CallInst>(DI) || isa<InvokeInst>(DI)) {
         bool Inlined = tryInlineCandidate(Candidate, InlinedCallSite);
         if (!Inlined) {
           // Prorate the direct callsite distribution so that it reflects real
           // callsite counts.
-          setProbeDistributionFactor(*DI, Candidate.CallsiteDistribution *
-                                              Candidate.CallsiteCount /
-                                              SumOrigin);
+          setProbeDistributionFactor(*DI,
+                                     1.0 * Candidate.CallsiteCount / SumOrigin);
         }
         return Inlined;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99787.334895.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210402/d1119439/attachment.bin>


More information about the llvm-commits mailing list