diff --git a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test --- 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 --- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp +++ b/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); } }