From 94ebcf7e5eccd1b4f8bad3d88f765e29d01254db Mon Sep 17 00:00:00 2001 From: Dehao Chen Date: Wed, 22 Feb 2017 17:27:21 +0000 Subject: [PATCH] Fix an obvious bug in SampleProfileReaderGCC. Summary: The CallTargetProfile should be added to FProfile to be consistent with other profile readers. Reviewers: dnovillo, davidxl Reviewed By: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30233 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295852 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ProfileData/SampleProfReader.cpp | 8 ++---- .../SampleProfile/Inputs/indirect-call.afdo | Bin 0 -> 1744 bytes .../SampleProfile/indirect-call-gcc.ll | 26 ++++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/Transforms/SampleProfile/Inputs/indirect-call.afdo create mode 100644 test/Transforms/SampleProfile/indirect-call-gcc.ll diff --git a/lib/ProfileData/SampleProfReader.cpp b/lib/ProfileData/SampleProfReader.cpp index af80b036a5b..6d063602fb2 100644 --- a/lib/ProfileData/SampleProfReader.cpp +++ b/lib/ProfileData/SampleProfReader.cpp @@ -681,11 +681,9 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile( if (!GcovBuffer.readInt64(TargetCount)) return sampleprof_error::truncated; - if (Update) { - FunctionSamples &TargetProfile = Profiles[TargetName]; - TargetProfile.addCalledTargetSamples(LineOffset, Discriminator, - TargetName, TargetCount); - } + if (Update) + FProfile->addCalledTargetSamples(LineOffset, Discriminator, + TargetName, TargetCount); } } diff --git a/test/Transforms/SampleProfile/Inputs/indirect-call.afdo b/test/Transforms/SampleProfile/Inputs/indirect-call.afdo new file mode 100644 index 0000000000000000000000000000000000000000..2d5b345e960e75027e9a9d9e69e9d35366224554 GIT binary patch literal 1744 zcmYdHNlw=?H!xv