Commit Graph

377 Commits

Author SHA1 Message Date
Vedant Kumar
b9454635c0 [ProfileData] PR33517: Check for failure of symtab creation
With PR33517, it became apparent that symbol table creation can fail
when presented with malformed inputs. This patch makes that sort of
error detectable, so llvm-cov etc. can fail more gracefully.

Specifically, we now check that function names within the symbol table
aren't empty.

Testing: check-{llvm,clang,profile}, some unit test updates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305765 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 01:38:56 +00:00
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Benjamin Kramer
0dbb1537bc [InstrProf] Use more ArrayRef/StringRef.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-28 13:23:02 +00:00
Dehao Chen
e26e940120 Change sample profile writer to make it deterministic.
Summary: This patch changes the function profile output order to be deterministic. In order to make it easier to understand, hottest functions (with most total samples) is ordered first.

Reviewers: dnovillo, davidxl

Reviewed By: dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 23:43:44 +00:00
Vedant Kumar
737d8b6809 [ProfileData] Unify getInstrProf*SectionName helpers
This is a version of D32090 that unifies all of the
`getInstrProf*SectionName` helper functions. (Note: the build failures
which D32090 would have addressed were fixed with r300352.)

We should unify these helper functions because they are hard to use in
their current form. E.g we recently introduced more helpers to fix
section naming for COFF files. This scheme doesn't totally succeed at
hiding low-level details about section naming, so we should switch to an
API that is easier to maintain.

This is not an NFC commit because it fixes llvm-cov's testing support
for COFF files (this falls out of the API change naturally). This is an
area where we lack tests -- I will see about adding one as a follow up.

Testing: check-clang, check-profile, check-llvm.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300381 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 00:09:57 +00:00
Xinliang David Li
e8752f4f05 [Profile] Make host tool aware of object format when quering prof section names
Differential Revision: https://reviews.llvm.org/D32073


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 17:48:40 +00:00
Xinliang David Li
2fc706bf3c [Profile] PE binary coverage bug fix
PR/32584

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 23:37:12 +00:00
Dehao Chen
14eaa3c97f SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name
Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.

Reviewers: davidxl, dnovillo

Reviewed By: davidxl

Subscribers: andreadb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 19:52:10 +00:00
Rong Xu
9e52f8ee8b [PGO] Memory intrinsic calls optimization based on profiled size
This patch optimizes two memory intrinsic operations: memset and memcpy based
on the profiled size of the operation. The high level transformation is like:
  mem_op(..., size)
  ==>
  switch (size) {
    case s1:
       mem_op(..., s1);
       goto merge_bb;
    case s2:
       mem_op(..., s2);
       goto merge_bb;
    ...
    default:
       mem_op(..., size);
       goto merge_bb;
    }
  merge_bb:

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 16:42:20 +00:00
Dehao Chen
cd2a5b62d1 SamplePGO ThinLTO ICP fix for local functions.
Summary:
In SamplePGO, if the profile is collected from non-LTO binary, and used to drive ThinLTO, the indirect call promotion may fail because ThinLTO adjusts local function names to avoid conflicts. There are two places of where the mismatch can happen:

1. thin-link prepends SourceFileName to front of FuncName to build the GUID (GlobalValue::getGlobalIdentifier). Unlike instrumentation FDO, SamplePGO does not use the PGOFuncName scheme and therefore the indirect call target profile data contains a hash of the OriginalName.
2. backend compiler promotes some local functions to global and appends .llvm.{$ModuleHash} to the end of the FuncName to derive PromotedFunctionName

This patch tries at the best effort to find the GUID from the original local function name (in profile), and use that in ICP promotion, and in SamplePGO matching that happens in the backend after importing/inlining:

1. in thin-link, it builds the map from OriginalName to GUID so that when thin-link reads in indirect call target profile (represented by OriginalName), it knows which GUID to import.
2. in backend compiler, if sample profile reader cannot find a profile match for PromotedFunctionName, it will try to find if there is a match for OriginalFunctionName.
3. in backend compiler, we build symbol table entry for OriginalFunctionName and pointer to the same symbol of PromotedFunctionName, so that ICP can find the correct target to promote.

Reviewers: mehdi_amini, tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits, Prazek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 17:33:01 +00:00
Rong Xu
5497dd541a [PGO] Text format profile reader needs to clear the value profile
Summary:
Reset the ValueData for each function to avoid using the ones in
the previous function.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296916 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 21:56:34 +00:00
Eugene Zelenko
f4f67a0c55 [ProfileData] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 01:07:34 +00:00
Rong Xu
676fd3131a [PGO] Fix a bug in reading text format value profile.
Summary: Should use the Valuekind read from the profile.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:42:39 +00:00
Rong Xu
8c896211a1 Fix comments. NFC.
Change "Thin-LTO" to "ThinLTO" in the comments for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 17:59:01 +00:00
Rong Xu
dd2b6c53e8 [PGO] Directory name stripping in global identifier for static functions
Current internal option -static-func-full-module-prefix keeps all the
directory path the profile counter names for static functions. The default
of this option is false. This strips the directory names from the source
filename which is problematic:

(1) it creates linker errors for profile-generation compilation, exposed in
our internal benchmarks. We are seeing messages like
"warning: relocation refers to discarded section".
This is due to the name conflicts after the stripping.

(2) the stripping only applies to getPGOFuncName.
Current Thin-LTO module importing for the indirect-calls assumes
the source directory name not being stripped. Current default value
for this option can potentially prevent some inter-module
indirect-call-promotions.

This patch turns the default value for -static-func-full-module-prefix to true.

The second part of the patch is to have an alternative implementation under
 the internal option -static-func-strip-dirname-prefix=<value>

This options specifies level of directories to be stripped from the source
filename. Using a large value as the parameter has the same effect as
-static-func-full-module-prefix.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296206 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-25 00:00:36 +00:00
Dehao Chen
94ebcf7e5e 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
2017-02-22 17:27:21 +00:00
Matthias Braun
88d207542b Cleanup dump() functions.
We had various variants of defining dump() functions in LLVM. Normalize
them (this should just consistently implement the things discussed in
http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html

For reference:
- Public headers should just declare the dump() method but not use
  LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- The definition of a dump method should look like this:
  #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
  LLVM_DUMP_METHOD void MyClass::dump() {
    // print stuff to dbgs()...
  }
  #endif

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:02:38 +00:00
Dan Gohman
c67238a892 [WebAssembly] Add triple support for the new wasm object format
Differential Revision: https://reviews.llvm.org/D26701


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292252 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 20:34:09 +00:00
George Rimar
ef935cd26f Recommit r292214 "[Support/Compression] - Change zlib API to return Error instead of custom status"
No any changes, will follow up with D28807 commit containing APLi change for clang
to fix build issues happened.

Original commit message:
[Support/Compression] - Change zlib API to return Error instead of custom status.

Previously API returned custom enum values.
Patch changes it to return Error with string description.
That should help users to report errors in universal way.

Differential revision: https://reviews.llvm.org/D28684



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292226 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 15:45:07 +00:00
George Rimar
7c0ccdc11d Revert r292214 "[Support/Compression] - Change zlib API to return Error instead of custom status."
It broked clang:
http://lab.llvm.org:8080/green//job/clang-stage1-cmake-RA-incremental_build/34218/consoleFull#46141505449ba4694-19c4-4d7e-bec5-911270d8a58c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292217 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 13:27:58 +00:00
George Rimar
4a6a534c0c [Support/Compression] - Change zlib API to return Error instead of custom status.
Previously API returned custom enum values.
Patch changes it to return Error with string description.
That should help users to report errors in universal way.

Differential revision: https://reviews.llvm.org/D28684

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292214 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 13:20:17 +00:00
Rong Xu
6d80fe73c6 Resubmit "[PGO] Turn off comdat renaming in IR PGO by default"
This patch resubmits the changes in r291588.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291696 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 20:19:41 +00:00
Rong Xu
de4116d55c Revert "[PGO] Turn off comdat renaming in IR PGO by default"
This patch reverts r291588: [PGO] Turn off comdat renaming in IR PGO by default,
as we are seeing some hash mismatches in our internal tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 23:54:31 +00:00
Rong Xu
2cf892fefa [PGO] Turn off comdat renaming in IR PGO by default
Summary:
In IR PGO we append the function hash to comdat functions to avoid the
potential hash mismatch. This turns out not legal in some cases: if the comdat
function is address-taken and used in comparison. Renaming changes the semantic.

This patch turns off comdat renaming by default.

To alleviate the hash mismatch issue, we now rename the profile variable
for comdat functions. Profile allows co-existing multiple versions of profiles
with different hash value. The inlined copy will always has the correct profile
counter. The out-of-line copy might not have the correct count. But we will
not have the bogus mismatch warning.

Reviewers: davidxl

Subscribers: llvm-commits, xur

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291588 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 19:30:20 +00:00
Mehdi Amini
df0b8bce48 Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:28:40 +00:00
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