[PATCH] D95009: [llvm-profgen][NFC] Fix the incorrect computation of callsite sample count

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 18:11:44 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdaeea961a6d9: [llvm-profgen][NFC] Fix the incorrect computation of callsite sample count (authored by wlei).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95009/new/

https://reviews.llvm.org/D95009

Files:
  llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
  llvm/tools/llvm-profgen/ProfileGenerator.cpp


Index: llvm/tools/llvm-profgen/ProfileGenerator.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -239,11 +239,9 @@
 
     // Record called target sample and its count
     const FrameLocation &LeafLoc = Binary->getInlineLeafFrameLoc(SourceOffset);
-
     FunctionProfile.addCalledTargetSamples(LeafLoc.second.LineOffset,
                                            LeafLoc.second.Discriminator,
                                            CalleeName, Count);
-    FunctionProfile.addTotalSamples(Count);
 
     // Record head sample for called target(callee)
     // TODO: Cleanup ' @ '
@@ -311,8 +309,10 @@
         CallerLeafFrameLoc.second.LineOffset,
         CallerLeafFrameLoc.second.Discriminator, CalleeProfile.getName(),
         EstimatedCallCount);
-    updateBodySamplesforFunctionProfile(CallerProfile, CallerLeafFrameLoc,
-                                        EstimatedCallCount);
+    CallerProfile.addBodySamples(CallerLeafFrameLoc.second.LineOffset,
+                                 CallerLeafFrameLoc.second.Discriminator,
+                                 EstimatedCallCount);
+    CallerProfile.addTotalSamples(EstimatedCallCount);
   }
 }
 
Index: llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
===================================================================
--- llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
+++ llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
@@ -7,7 +7,7 @@
 ; CHECK: 2: 2
 ; CHECK: 4: 1
 ; CHECK: 5: 3
-; CHECK:[main:1 @ foo]:9:0
+; CHECK:[main:1 @ foo]:6:0
 ; CHECK: 2: 3
 ; CHECK: 3: 3 bar:3
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95009.317739.patch
Type: text/x-patch
Size: 1690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210120/90ed3eab/attachment.bin>


More information about the llvm-commits mailing list