Commit Graph

352 Commits

Author SHA1 Message Date
Benjamin Kramer
cb58e1e3bc Retire llvm::alignOf in favor of C++11 alignof.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284733 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 15:02:18 +00:00
Reid Kleckner
5b1c9f3223 Remove LLVM_NOEXCEPT and replace it with noexcept
Now that we have dropped MSVC 2013, all supported compilers support
noexcept and we can drop this portability macro.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284672 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 23:52:38 +00:00
Rong Xu
c8872308b4 [PGO] Fix bogus warning for merging empty llvm profile file
Profile runtime can generate an empty raw profile (when there is no function in
the shared library). This empty profile is treated as a text format profile.  A
test format profile without the flag of "#IR" is thought to be a clang
generated profile.  So in llvm profile merging, we will get a bogus warning of
"Merge IR generated profile with Clang generated profile."

The fix here is to skip the empty profile (when the buffer size is 0) for
profile merge.

Reviewers: vsk, davidxl

Differential Revision: http://reviews.llvm.org/D25687


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284659 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 22:51:17 +00:00
Vedant Kumar
20bdbbe5e9 [Coverage] Support loading multiple binaries into a CoverageMapping
Add support for loading multiple coverage readers into a single
CoverageMapping instance. This should make it easier to prepare a
unified coverage report for multiple binaries.

Differential Revision: https://reviews.llvm.org/D25535

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 17:16:53 +00:00
Vedant Kumar
98f853ee4f [Coverage] Factor out logic to create FunctionRecords (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 22:27:45 +00:00
Piotr Padlewski
05539ce1ca NFC Add const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 21:05:55 +00:00
Igor Kudrin
da47983f42 [Coverage] Make sorting criteria for CounterMappingRegions local.
Move the comparison function into the only place there it is used,
i.e. the call to std::stable_sort in CoverageMappingWriter::write().

Add sorting by region kinds as it is required to ensure stable order
in our tests and to simplify D23987.

Differential Revision: https://reviews.llvm.org/D24034


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-31 07:01:17 +00:00
Teresa Johnson
cf538716fb [ThinLTO] Indirect call promotion fixes for promoted local functions
Summary:
Fix a couple issues limiting the application of indirect call promotion
in ThinLTO mode:
- Invoke indirect call promotion before globalopt, since it may
  eliminate imported functions which appear unreferenced.
- Invoke indirect call promotion with InLTO=true so that the PGOFuncName
  metadata is used to get the name for locals which would have been
  renamed during promotion.

Reviewers: davidxl, mehdi_amini

Subscribers: Prazek, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D24004

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 22:46:56 +00:00
David Majnemer
dc9c737666 Use range algorithms instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:15:00 +00:00
Eugene Zelenko
c986ab210b Fix some Clang-tidy modernize and Include What You Use warnings.
Differential revision: https://reviews.llvm.org/D23291


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:20:18 +00:00
Rong Xu
8dbdfe6cb7 [PGO] Make needsComdatForCounter() available (NFC)
Move needsComdatForCounter() to lib/ProfileData/InstrProf.cpp from
lib/Transforms/Instrumentation/InstrProfiling.cpp to make is available for
other files.

Differential Revision: https://reviews.llvm.org/D22643


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 20:50:02 +00:00
Vedant Kumar
d91d378e3a Retry: [llvm-profdata] Speed up merging by using a thread pool
Add a "-j" option to llvm-profdata to control the number of threads used.
Auto-detect NumThreads when it isn't specified, and avoid spawning threads when
they wouldn't be beneficial.

I tested this patch using a raw profile produced by clang (147MB). Here is the
time taken to merge 4 copies together on my laptop:

  No thread pool: 112.87s user 5.92s system 97% cpu 2:01.08 total
  With 2 threads: 134.99s user 26.54s system 164% cpu 1:33.31 total

Changes since the initial commit:

  - When handling odd-length inputs, call ThreadPool::wait() before merging the
    last profile. Should fix a race/off-by-one (see r275937).

Differential Revision: https://reviews.llvm.org/D22438

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275938 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 01:17:20 +00:00
Vedant Kumar
40a2c5247c Revert "[llvm-profdata] Speed up merging by using a thread pool"
This reverts commit r275921. It broke the ppc64be bot:

  http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/3537

I'm not sure why it broke, but based on the output, it looks like an
off-by-one (one profile left un-merged).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 00:57:09 +00:00
Vedant Kumar
94471e314e [llvm-profdata] Speed up merging by using a thread pool
Add a "-j" option to llvm-profdata to control the number of threads
used. Auto-detect NumThreads when it isn't specified, and avoid spawning
threads when they wouldn't be beneficial.

I tested this patch using a raw profile produced by clang (147MB). Here is the
time taken to merge 4 copies together on my laptop:

  No thread pool: 112.87s user 5.92s system 97% cpu 2:01.08 total
  With 2 threads: 134.99s user 26.54s system 164% cpu 1:33.31 total

Differential Revision: https://reviews.llvm.org/D22438

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275921 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 22:02:39 +00:00
Vedant Kumar
7b18a76385 [Coverage] Mark a few more methods const (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 01:19:33 +00:00
Vedant Kumar
fa8c832177 [Coverage] Mark a few methods const (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:12:23 +00:00
Xinliang David Li
f5c9f766b8 [PGO] Don't include full file path in static function profile counter names
Patch by Jake VanAdrighem
Differential Revision: http://reviews.llvm.org/D22028


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 17:14:51 +00:00
Vedant Kumar
174360e19a Revert "[Coverage] Move logic to encode filenames and mappings into llvm (NFC)"
This reverts commit 520a8298d8 (r273055).

This is breaking stage2 instrumented builds with "malformed coverage
data" errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274106 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 05:33:26 +00:00
Vedant Kumar
0282a55d99 Revert "[Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)"
This reverts commit 1037ef2574.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 05:33:24 +00:00
Vedant Kumar
1037ef2574 [Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)
Pass a `MemoryBuffer &` to BinaryCoverageReader::create() instead of a
`std::unique_ptr<MemoryBuffer> &`. This makes it easier to reason about
the ownership of the buffer at a glance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 22:22:33 +00:00
Vedant Kumar
520a8298d8 [Coverage] Move logic to encode filenames and mappings into llvm (NFC)
Currently, frontends which emit source-based code coverage have to
duplicate logic to encode filenames and raw coverage mappings properly.
This violates an abstraction layer and forces frontends to copy tricky
code.

Introduce llvm::coverage::encodeFilenamesAndRawMappings() to take care
of this.

This will help us experiment with zlib-compressing coverage mapping
data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273055 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:53:31 +00:00
Vedant Kumar
49f93f75af [Coverage] Get rid of an input/output parameter (NFC)
readFunctionRecords is used to iterate through the entries of the
coverage mapping section. Instead of expecting the function to update
the iterator through a `const char *&` parameter, just return the
updated iterator.

This will help us experiment with zlib-compressing coverage mapping
data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:31:03 +00:00
Xinliang David Li
f4c13256d7 Bug fix remove another illegal char from prof symbol name
End-end test with no integrated assembly should be added 
at some point (not done now because some bots are not properly configured to
support -no-integrated-as)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-10 06:32:26 +00:00
Kevin Enderby
e9ddf3a4a7 Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is from a slice of a Mach-O Universal Binary use something like
"foo.o (for architecture i386)" as part of the error message when expected.

Also fixed places in these tools that were ignoring object file errors from
MachOUniversalBinary::getAsObjectFile() when the code moved on to see if
the slice was an archive.

To do this MachOUniversalBinary::getAsObjectFile() and
MachOUniversalBinary::getObjectForArch() were changed from returning
ErrorOr<...> to Expected<...> then that was threaded up to its users.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now the use of
errorToErrorCode() is still used in two places yet to be fully converted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 20:35:34 +00:00
Benjamin Kramer
2ff22b74ed [ProfileData] Clean up string handling a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-29 10:31:00 +00:00
Benjamin Kramer
c4a6700e58 [ProfData] Remove global constructor from ProfileSummaryBuilder.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271021 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:38:16 +00:00
Peter Collingbourne
84e27c2068 Add FIXMEs to all derived classes of std::error_category.
This helps make clear that we're moving away from std::error_code.

Differential Revision: http://reviews.llvm.org/D20592

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270604 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24 20:13:46 +00:00
Benjamin Kramer
e3bf66476f [ProfileData] Thread unique_ptr through the summary builder to avoid leaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 09:18:37 +00:00
Igor Kudrin
88a127497f [Coverage] Fix an issue where improper coverage mapping data could be loaded for an inline function.
If an inline function is observed but unused in a translation unit, dummy
coverage mapping data with zero hash is stored for this function.
If such a coverage mapping section came earlier than real one, the latter
was ignored. As a result, llvm-cov was unable to show coverage information
for those functions.

Differential Revision: http://reviews.llvm.org/D20286


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 09:14:24 +00:00
Easwaran Raman
30c760d801 Remove specializations of ProfileSummary
This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class.

Differential Revision: http://reviews.llvm.org/D20390



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 21:53:28 +00:00
Easwaran Raman
17e7f1191f Move ProfileSummary to IR.
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData.

Differential Revision: http://reviews.llvm.org/D20314



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 21:07:12 +00:00
Vedant Kumar
c77570e062 Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.
- Remove the base ProfError class to work around an MSVC ICE.

Differential Revision: http://reviews.llvm.org/D19901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 03:54:45 +00:00
Igor Kudrin
24466cded7 [Coverage] Ensure that coverage mapping data has an expected alignment in 'covmapping' files.
Coverage mapping data is organized in a sequence of blocks, each of which is expected
to be aligned by 8 bytes. This feature is used when reading those blocks, see
VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge
mapping data has more than one block, it causes llvm-cov to fail.

Differential Revision: http://reviews.llvm.org/D20285


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 07:43:27 +00:00
Vedant Kumar
ce4aff93aa Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269694. MSVC says:

error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 21:03:38 +00:00
Vedant Kumar
515ee3e025 Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Address undefined-var-template warning.
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

Differential Revision: http://reviews.llvm.org/D19901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 20:49:39 +00:00
Chandler Carruth
2e531af53a Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269491. It triggers warnings with Clang, breaking
builds for -Werror users including several build bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 05:26:26 +00:00
Vedant Kumar
db1d476217 Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

Differential Revision: http://reviews.llvm.org/D19901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 21:50:56 +00:00
Vedant Kumar
8007bdd41f Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
This reverts commit r269462. It fails two llvm-profdata tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 20:09:39 +00:00
Vedant Kumar
5b34ed8191 [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Differential Revision: http://reviews.llvm.org/D19901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 20:01:27 +00:00
Vedant Kumar
6d6b3df09a [ProfileData] Use SoftInstrProfErrors to count soft errors, NFC
Differential Revision: http://reviews.llvm.org/D20082

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269222 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 19:42:19 +00:00
Vedant Kumar
412cddb08e Use an emplace_back for consistency, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269199 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 16:03:02 +00:00
Easwaran Raman
d56f6d6de3 Revert r269131
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10 23:26:04 +00:00
Easwaran Raman
79f2742cf7 Reapply r266477 and r266488
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10 22:03:23 +00:00
Rong Xu
3a963d121a [PGO] Use rsplit to parse value-data line in text profile file.
The value-data line is <PGOFuncName>:<Count_Value>. PGOFuncName might contain
':' for the internal linkage functions. We therefore need to use rsplit,
rather split, to extract the data from the line. This fixes the error when
merging a text profile file to an indexed profile file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268818 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 23:20:58 +00:00
Sean Silva
d4c22d2f8d Add a note about the "entry count" used the profile summary
Thanks to David Li for the clarification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268669 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 19:54:13 +00:00
Xinliang David Li
8fa402e863 [profile] Remove unneeded field in raw profile reader
Differential Revision: http://reviews.llvm.org/D19956


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 19:41:18 +00:00
Igor Kudrin
68065ba043 [Coverage] Combine counts of expansion regions if there are no code regions for the same area.
Differential Revision: http://reviews.llvm.org/D18831


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 09:39:45 +00:00
Vedant Kumar
f8e08351d3 [ProfileData] Propagate an error from InstrProfSymtab
CovMapFuncReader::get should propagate up errors from InstrProfSymtab.

This is part of a series of patches to transition ProfileData over to
the stricter Error/Expected interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 20:01:01 +00:00
Vedant Kumar
707e782733 [ProfileData] Add error codes for compression failures
Be more specific in describing compression failures. Also, check for
this kind of error in emitNameData().

This is part of a series of patches to transition ProfileData over to
the stricter Error/Expected interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268400 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 16:53:17 +00:00
Vedant Kumar
0cd16495ba Remove redundant return, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 21:33:36 +00:00