diff options
author | wlei <wlei@fb.com> | 2021-01-19 16:20:11 -0800 |
---|---|---|
committer | wlei <wlei@fb.com> | 2021-01-19 17:50:48 -0800 |
commit | daeea961a6d93f301e7a22659a2c203846fd58f2 (patch) | |
tree | a2434419c8c3e0d11693187dc439e11a203437c8 | |
parent | 233106269db6af64f9eff7db0bdf119593f822b1 (diff) | |
download | llvm-daeea961a6d93f301e7a22659a2c203846fd58f2.zip llvm-daeea961a6d93f301e7a22659a2c203846fd58f2.tar.gz llvm-daeea961a6d93f301e7a22659a2c203846fd58f2.tar.bz2 |
[llvm-profgen][NFC] Fix the incorrect computation of callsite sample count
Differential Revision: https://reviews.llvm.org/D95009
-rw-r--r-- | llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-profgen/ProfileGenerator.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test index 385009d..9beecb2 100644 --- a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test +++ b/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 diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp index 7c5c5e3..265becc 100644 --- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp +++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp @@ -239,11 +239,9 @@ void CSProfileGenerator::populateFunctionBoundarySamples( // 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 @@ void CSProfileGenerator::populateInferredFunctionSamples() { 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); } } |