1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

6389 Commits

Author SHA1 Message Date
Nathan Slingerland
b95c2eec31 [llvm-profdata] Add support for weighted merge of profile data (2nd try)
Summary:
This change adds support for specifying a weight when merging profile data with the llvm-profdata tool.
Weights are specified by using the --weighted-input=<weight>,<filename> option. Input files not specified
with this option (normal positional list after options) are given a default weight of 1.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: davidxl, dnovillo, bogner, silvas

Subscribers: silvas, davidxl, llvm-commits

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

llvm-svn: 255659
2015-12-15 17:37:09 +00:00
Craig Topper
466a91c686 Use CmpInst::Predicate instead of 'unsigned short' in some places. NFC
llvm-svn: 255623
2015-12-15 06:11:33 +00:00
Reid Kleckner
0c98151b50 [llvm-readobj] s/FunctionName/LinkageName/ for codeview dumping
The symbol being printed in this field comes from the main symbol table,
not 0xF1 subsection. Use LinkageName to make that a lot clearer.

llvm-svn: 255596
2015-12-15 01:23:55 +00:00
Mike Aizatsky
4bb54a6d86 sancov: coverage can be reported by multiple functions.
Differential Revision: http://reviews.llvm.org/D15430

llvm-svn: 255582
2015-12-14 23:55:04 +00:00
Rafael Espindola
5b397256de Use diagnostic handler in the LLVMContext
This patch converts code that has access to a LLVMContext to not take a
diagnostic handler.

This has a few advantages

* It is easier to use a consistent diagnostic handler in a single program.
* Less clutter since we are not passing a handler around.

It does make it a bit awkward to implement some C APIs that return a
diagnostic string. I will propose new versions of these APIs and
deprecate the current ones.

llvm-svn: 255571
2015-12-14 23:17:03 +00:00
Pete Cooper
77ebe023c7 Factor out some duplication. NFC.
llvm-svn: 255569
2015-12-14 23:10:52 +00:00
Pete Cooper
9826aaba7a Start implementing FDE dumping when printing the eh_frame.
This code adds some simple decoding of the FDE's in an eh_frame.

There's still more to be done in terms of error handling and verification.

Also, we need to be able to decode the CFI's.

llvm-svn: 255550
2015-12-14 21:49:49 +00:00
Pete Cooper
91dbcd5e25 Print the eh_frame section in MachoDump.
This is the start of work to dump the contents of the eh_frame section.

It currently emits CIE entries.  FDE entries will come later.

It also needs improved error checking which will follow soon.

http://reviews.llvm.org/D15502

Reviewed by Kevin Enderby and Lang Hames.

llvm-svn: 255546
2015-12-14 21:39:27 +00:00
Diego Novillo
c2f8d731bc Fix formatting. NFC.
llvm-svn: 255541
2015-12-14 20:37:15 +00:00
David Majnemer
49dcd13916 [IR] Remove terminatepad
It turns out that terminatepad gives little benefit over a cleanuppad
which calls the termination function.  This is not sufficient to
implement fully generic filters but MSVC doesn't support them which
makes terminatepad a little over-designed.

Depends on D15478.

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

llvm-svn: 255522
2015-12-14 18:34:23 +00:00
David Blaikie
bf4705c1bc [llvm-dwp] Deduplicate type units
It's O(N^2) because it does a simple walk through the existing types to
find duplicates, but that will be fixed in a follow-up commit to use a
mapping data structure of some kind.

llvm-svn: 255482
2015-12-14 07:42:00 +00:00
Davide Italiano
34358effbc [llvm-objdump/MachoDump] Simplify.
llvm-svn: 255443
2015-12-12 21:50:11 +00:00
David Majnemer
bf189bdcd7 [IR] Reformulate LLVM's EH funclet IR
While we have successfully implemented a funclet-oriented EH scheme on
top of LLVM IR, our scheme has some notable deficiencies:
- catchendpad and cleanupendpad are necessary in the current design
  but they are difficult to explain to others, even to seasoned LLVM
  experts.
- catchendpad and cleanupendpad are optimization barriers.  They cannot
  be split and force all potentially throwing call-sites to be invokes.
  This has a noticable effect on the quality of our code generation.
- catchpad, while similar in some aspects to invoke, is fairly awkward.
  It is unsplittable, starts a funclet, and has control flow to other
  funclets.
- The nesting relationship between funclets is currently a property of
  control flow edges.  Because of this, we are forced to carefully
  analyze the flow graph to see if there might potentially exist illegal
  nesting among funclets.  While we have logic to clone funclets when
  they are illegally nested, it would be nicer if we had a
  representation which forbade them upfront.

Let's clean this up a bit by doing the following:
- Instead, make catchpad more like cleanuppad and landingpad: no control
  flow, just a bunch of simple operands;  catchpad would be splittable.
- Introduce catchswitch, a control flow instruction designed to model
  the constraints of funclet oriented EH.
- Make funclet scoping explicit by having funclet instructions consume
  the token produced by the funclet which contains them.
- Remove catchendpad and cleanupendpad.  Their presence can be inferred
  implicitly using coloring information.

N.B.  The state numbering code for the CLR has been updated but the
veracity of it's output cannot be spoken for.  An expert should take a
look to make sure the results are reasonable.

Reviewers: rnk, JosephTremoulet, andrew.w.kaylor

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

llvm-svn: 255422
2015-12-12 05:38:55 +00:00
Davide Italiano
5f81084374 [llvm-objdump/MachODump] Reduce code duplication.
llvm-svn: 255380
2015-12-11 22:27:59 +00:00
Frederic Riss
1db2534294 [dsymutil] Ignore absolute symbols in the debug map
Quoting from the comment added to the code:

    // Objective-C on i386 uses artificial absolute symbols to
    // perform some link time checks. Those symbols have a fixed 0
    // address that might conflict with real symbols in the object
    // file. As I cannot see a way for absolute symbols to find
    // their way into the debug information, let's just ignore those.

llvm-svn: 255350
2015-12-11 17:50:37 +00:00
Teresa Johnson
99c029d45a [ThinLTO] Release files in gold plugin during combined index (take 2)
Ensure we release the files even when they don't hold a function index
summary section, by restructuring the control flow a little bit.

llvm-svn: 255256
2015-12-10 16:11:23 +00:00
Rafael Espindola
c944447e56 Slit lib/Linker in two.
A linker normally has two stages: symbol resolution and "moving stuff".

In lib/Linker there is the complication of lazy linking some globals,
but it was still far more mixed than it needed to.

This splits the linker into a lower level IRMover and the linker proper.
The IRMover just takes a list of globals to move and a callback that
lets the user control what is lazy linked.

The main motivation is that now tools/gold (and soon lld) can use their
own symbol resolution to instruct IRMover what to do.

llvm-svn: 255254
2015-12-10 14:19:35 +00:00
Teresa Johnson
f07f0a51b6 [ThinLTO] Release files read when creating combined index in gold plugin
This wasn't causing an issue since at HEAD we exit the linker completely
after creating the combined index.

llvm-svn: 255156
2015-12-09 21:11:42 +00:00
David Blaikie
22d53c1a98 [llvm-dwp] Sink debug_types.dwo emission into the code parsing the type signatures (NFC)
This is a preliminary change towards deduplicating type units based on
their signatures. Next change will skip emission of types when their
signature has already been seen.

llvm-svn: 255154
2015-12-09 21:02:33 +00:00
Teresa Johnson
cd4a1a051d Delay context construction to when/if it is needed in gold plugin (NFC)
llvm-svn: 255146
2015-12-09 19:49:40 +00:00
Teresa Johnson
b82193e4a3 clang-format order of gold-plugin includes (NFC)
llvm-svn: 255144
2015-12-09 19:45:55 +00:00
Steven Wu
1b8163c1b8 Fix the order of destructors in LibLTOCodeGenerator
Summary:
The order of destructors in LTOCodeGenerator gets changed in r254696.
It is possible for LTOCodeGenerator to have a MergedModule created in
the OwnedContext, in which case the module must be destructed before
the context.

Reviewers: rafael, dexonsmith

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 255092
2015-12-09 03:37:51 +00:00
Rafael Espindola
d48cb08f15 Simplify testMergedProgram.
It now receives and returns std::unique_ptr.

llvm-svn: 255087
2015-12-09 00:55:05 +00:00
Rafael Espindola
25ea9f2b63 Simplify memory management. NFC.
This passes std::unique_ptr to predicates that are expected to delete
their argument.

llvm-svn: 255086
2015-12-09 00:51:06 +00:00
Rafael Espindola
8f77f17d0f Return std::unique_ptr from SplitFunctionsOutOfModule. NFC.
llvm-svn: 255084
2015-12-09 00:34:10 +00:00
Rafael Espindola
0f559f82b6 Simplify memory management. NFC.
llvm-svn: 255082
2015-12-09 00:18:41 +00:00
Rafael Espindola
510595dffd Simplify memory management a bit. NFC.
llvm-svn: 255079
2015-12-09 00:08:22 +00:00
Rafael Espindola
f20bc23b7c Return a std::unique_ptr from CloneModule. NFC.
llvm-svn: 255078
2015-12-08 23:57:17 +00:00
Davide Italiano
6c5eaeb369 [llvm-objdump/MachO] Don't cut'n'paste the same code over and over.
Use the appropriate helper instead.

llvm-svn: 254990
2015-12-08 02:45:59 +00:00
NAKAMURA Takumi
af1e01a62f Let llvm-lto installed. A few tests in clang/test are using it.
llvm-svn: 254963
2015-12-07 23:07:16 +00:00
Sanjay Patel
51a4d88a44 fix 'the the '; NFC
llvm-svn: 254928
2015-12-07 19:21:39 +00:00
Lang Hames
096bda3427 [Orc] Removing traces of takeOwnershipOfBuffers left after r251560.
Patch by Joshua Gerrard. Thanks Joshua!

llvm-svn: 254919
2015-12-07 17:35:56 +00:00
Davide Italiano
cba3a5e757 [llvm-objdump/MachoDump] Make code much more concise.
llvm-svn: 254888
2015-12-07 00:03:28 +00:00
Lang Hames
dde8f900ec [Orc] Rename IndirectStubsManagerBase to IndirectStubsManager.
No functional change.

llvm-svn: 254885
2015-12-06 19:44:45 +00:00
Davide Italiano
e9b03aa261 [llvm-readobj] report_error() does not return, so we can simplify.
llvm-svn: 254868
2015-12-05 23:36:52 +00:00
David Blaikie
7190459ba5 [llvm-dwp] Add coverage for both the presence and absence of type units, and fix/remove the emission of a broken tu_index when no type units are present
llvm-svn: 254833
2015-12-05 03:41:53 +00:00
David Blaikie
28d7901eef [llvm-dwp] clang-format this to catch anything I've missed along the way
llvm-svn: 254828
2015-12-05 03:06:30 +00:00
David Blaikie
09b741f7b6 [llvm-dwp] Support debug_tu_index
llvm-svn: 254827
2015-12-05 03:05:45 +00:00
Keno Fischer
a14938b8f9 [opt] Fix run-twice option for non-idempotent passes
Cloning the module was supposed to guard against the possibility
that the passes may be non-idempotent. However, for some reason
I decided to put that AFTER the passes had already run on the
module, defeating the point entirely. Fix that by moving up the
CloneModule as is done in llc.

llvm-svn: 254819
2015-12-05 01:38:12 +00:00
Keno Fischer
a15fc0e9a6 [opt] Fix sanitizer complaints about r254774
`Out` can be null if no output is requested, so move any access
to it inside the conditional. Thanks to Justin Bogner for finding
this.

llvm-svn: 254804
2015-12-05 00:06:37 +00:00
Derek Schuff
9062c61b6e Add TransformUtils to list of required libraries for llc
This dependency was added in r254774

llvm-svn: 254786
2015-12-04 22:47:58 +00:00
Rafael Espindola
2c7e9b8d27 Always pass a diagnostic handler to the linker.
Before this patch the diagnostic handler was optional. If it was not
passed, the one in the LLVMContext was used.

That is probably not a pattern we want to follow. If each area has an
optional callback, there is a sea of callbacks and it is hard to follow
which one is called.

Doing this also found cases where the callback is a nice addition, like
testing that no errors or warnings are reported.

The other option is to always use the diagnostic handler in the
LLVMContext. That has a few problems

* To implement the C API we would have to set the diag handler and then
  set it back to the original value.
* Code that creates the context might be far away from code that wants
  the diagnostics.

I do have a patch that implements the second option and will send that as
an RFC.

llvm-svn: 254777
2015-12-04 22:08:53 +00:00
Keno Fischer
5b8c01f61a [llc/opt] Add an option to run all passes twice
Summary: Lately, I have submitted a number of patches to fix bugs that
only occurred when using the same pass manager to compile multiple
modules (generally these bugs are failure to reset some persistent
state). Unfortunately I don't think there is currently a way to test
that from the command line. This adds a very simple flag to both llc
and opt, under which the tools will simply re-run their respective
pass pipelines using the same pass manager on (a clone of the same
module). Additionally, we verify that both outputs are bitwise the
same.

Reviewers: yaron.keren

Subscribers: loladiro, yaron.keren, kcc, llvm-commits

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

llvm-svn: 254774
2015-12-04 21:56:46 +00:00
David Blaikie
138abe01f5 [llvm-dwp] Implement the required on-disk probed hash table
llvm-svn: 254770
2015-12-04 21:30:23 +00:00
Reid Kleckner
9e23002c7a Fix llvm-readobj build on Windows, match noreturn attribute on reportError in headers
llvm-svn: 254769
2015-12-04 21:29:53 +00:00
David Blaikie
d59ffbc983 [llvm-dwp] Include the debug_line.dwo section
This probably shouldn't be generated in the .dwo file for CUs, only for
TUs, but it's in the sample .dwos (generated by clang) so dwp should
reflect that.

Arguably the DWP tool could be smart enough to know that the CUs
shouldn't need a debug_line.dwo section and skip that even when it's
legitimately generated for TUs, but that's a bit more off-book.

llvm-svn: 254767
2015-12-04 21:16:42 +00:00
Davide Italiano
cc32563ec2 [llvm-readobj] reportError() never returns. Mark with the correct attribute.
llvm-svn: 254752
2015-12-04 19:29:49 +00:00
Davide Italiano
ea8ac55c67 [llvm-readobj/ELF] Simplify Verdef handling.
llvm-svn: 254751
2015-12-04 19:27:58 +00:00
Mike Aizatsky
f03ab7c63f fixing Makefile
llvm-svn: 254749
2015-12-04 19:11:54 +00:00
Mike Aizatsky
9dfa27dd2d adding MC dependencies in hopes to pacify the hexagon build.
llvm-svn: 254745
2015-12-04 18:50:18 +00:00
Mike Aizatsky
0372f5b7df sancov -not-covered-functions.
Summary: The command prints out list of functions that were not entered.
To do this, addresses are first converted to function locations. Set
operations are used for function locations.

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

review

llvm-svn: 254742
2015-12-04 18:35:37 +00:00
David Blaikie
3fd553d9d8 [llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry
llvm-svn: 254731
2015-12-04 17:20:04 +00:00
Rafael Espindola
b4f7892e3a Modernize the C++ APIs for creating LTO modules.
This is a continuation of r253367.

These functions return is owned by the caller, so they return
std::unique_ptr now.

The call can fail, so the return is wrapped in ErrorOr.

They have a context where to report diagnostics, so they don't need to
take a string out parameter.

With this there are no call to getGlobalContext in lib/LTO.

llvm-svn: 254721
2015-12-04 16:14:31 +00:00
Rafael Espindola
b0476044d6 Move a call to getGlobalContext out of lib/LTO.
llvm-svn: 254696
2015-12-04 02:42:28 +00:00
Lang Hames
84deb31665 [Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager.
This class is turning into a useful interface, rather than an implementation
detail, so I'm dropping the 'Base' suffix.

No functional change.

llvm-svn: 254693
2015-12-04 02:15:39 +00:00
Nathan Slingerland
5a941550ef Revert "[llvm-profdata] Add support for weighted merge of profile data"
This reverts commit b7250858d96b8ce567681214273ac0e62713c661.

Reverting in order to investigate Windows test failure.

llvm-svn: 254687
2015-12-04 02:13:58 +00:00
Rafael Espindola
dda25171b9 Simplify the error handling in llvm-lto a bit.
llvm-svn: 254675
2015-12-04 00:45:57 +00:00
Nathan Slingerland
e6205d97d7 [llvm-profdata] Add support for weighted merge of profile data
This change adds support for an optional weight when merging profile data with the llvm-profdata tool.
Weights are specified by adding an option ':<weight>' suffix to the input file names.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: dnovillo, bogner, davidxl

Subscribers: llvm-commits

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

llvm-svn: 254669
2015-12-04 00:00:20 +00:00
Davide Italiano
723a59df2a [llvm-objdump] Use report_fatal_error() if we can't find a target.
llvm-svn: 254654
2015-12-03 22:13:40 +00:00
Mehdi Amini
b83f3402b0 Rename Set variable to be plural
Thanks Sean Silva for catching this.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 254584
2015-12-03 02:40:39 +00:00
Mehdi Amini
07b85fee55 Remove "ExportingModule" from ThinLTO Index (NFC)
There is no real reason the index has to have the concept of an
exporting Module. We should be able to have one single unique
instance of the Index, and it should be read-only after creation
for the whole ThinLTO processing.
The linker plugin should be able to process multiple modules (in
parallel or in sequence) with the same index.

The only reason the ExportingModule was present seems to be to
implement hasExportedFunctions() that is used by the Module linker
to decide what to do with the current Module.
For now I replaced it with a query to the map of Modules path to
see if this module was declared in the Index and consider that if
it is the case then it is probably exporting function.
On the long term the Linker interface needs to evolve and this
call should not be needed anymore.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 254581
2015-12-03 02:37:23 +00:00
David Blaikie
e5f9d70f7f [llvm-dwp] Include only the non-empty columns in the cu_index
llvm-svn: 254555
2015-12-02 22:01:56 +00:00
David Blaikie
3719678673 [llvm-dwp] Emit a rather fictional debug_cu_index
This is very rudimentary support for debug_cu_index, but it is enough to
allow llvm-dwarfdump to find the offsets for  contributions and
correctly dump debug_info.

It will need to actually find the real signature of the unit and build
the real hash table with the right number of buckets, as per the DWP
specification.

It will also need to be expanded to cover the tu_index as well.

llvm-svn: 254489
2015-12-02 06:21:34 +00:00
Mehdi Amini
34766825ef Change ModuleLinker to take a set of GlobalValues to import instead of a single one
For efficiency reason, when importing multiple functions for the same Module,
we can avoid reparsing it every time.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 254486
2015-12-02 04:34:28 +00:00
Rafael Espindola
e3fda2ca99 Use references now that it is natural to do so.
The linker never takes ownership of a module or changes which module it
is refering to, making it natural to use references.

llvm-svn: 254449
2015-12-01 19:50:54 +00:00
David Blaikie
2b4f493936 [llvm-dwp] Deduplicate strings in the debug_str.dwo section
Also, ensure that references to those strings in debug_str_offsets.dwo
correctly refer to the deduplicated strings.

llvm-svn: 254441
2015-12-01 19:17:58 +00:00
David Blaikie
3fa2e45f02 [llvm-dwp] Correctly update debug_str_offsets.dwo when linking dwo files
This doesn't deduplicate strings in the debug_str section, nor does it
properly wire up the index so that debug_info can /find/ these strings,
but it does correct the str_offsets specifically.

Follow up patches to address those related/next issues.

llvm-svn: 254431
2015-12-01 18:07:07 +00:00
Sanjoy Das
e90f281076 Introduce a range version of std::any_of, and use it in SCEV
Reviewers: dblaikie, pcc

Subscribers: llvm-commits

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

llvm-svn: 254390
2015-12-01 07:49:23 +00:00
David Blaikie
eab138be65 [llvm-dwp] Add missing Makefile for the old configure+make build
llvm-svn: 254358
2015-12-01 01:07:20 +00:00
David Blaikie
0483eddbd1 [llvm-dwp] Initial partial prototype
This just concatenates the common DWP sections without doing any of the
fancy DWP things like:

1) update str_offsets
2) deduplicating strings
3) merging/creating cu/tu_index

Patches for these will follow shortly.

(also not sure about target triple/object file type for this tool - do I
really need a whole triple just to write an object file that contains
purely static/hardcoded bytes in each section? & I guess I should just
pick it based on the first input, maybe, rather than hardcoding for now
- but we only produce .dwo on ELF platforms with objcopy for now anyway)

llvm-svn: 254355
2015-12-01 00:48:39 +00:00
David Blaikie
63f8ae8d2b llvm-dwp: Initial layout
llvm-svn: 254354
2015-12-01 00:48:34 +00:00
Rafael Espindola
4a063d8813 Simplify the linking of recursive data.
Now the ValueMapper has two callbacks. The first one maps the
declaration. The ValueMapper records the mapping and then materializes
the body/initializer.

llvm-svn: 254209
2015-11-27 20:28:19 +00:00
Hal Finkel
2deea83231 [bugpoint] Fix "Alias must point to a definition" problems
GlobalAliases may reference function definitions, but not function declarations.

bugpoint would sometimes create invalid IR by deleting a function's body (thus
mutating a function definition into a declaration) without first 'fixing' any
GlobalAliases that reference that function definition.

This change iteratively prevents that issue. Before deleting a function's body,
it scans the module for GlobalAliases which reference that function. When
found, it eliminates them using replaceAllUsesWith.

Fixes PR20788.

Patch by Nick Johnson!

llvm-svn: 254171
2015-11-26 19:23:49 +00:00
Richard Diamond
3e341c0824 Fix a use-after-free in llvm-config.
Summary:
This could happen if `GetComponentNames` is true, because `Name` from
`VisitComponent` would reference a stack instance of `std::string` in
`ComputeLibsForComponents`.

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 254108
2015-11-25 22:49:48 +00:00
Rafael Espindola
bdc0b27af4 Don't create implicit comdats.
comdats are explicitly represented for some time now.

llvm-svn: 253924
2015-11-23 22:01:51 +00:00
Sanjoy Das
1cbdd0c307 [RuntimeDyld] Don't allocate unnecessary stub buffer space
Summary:
For relocation types that are known to not require stub functions, there
is no need to allocate extra space for the stub functions.

Reviewers: lhames, reames, maksfb

Subscribers: llvm-commits

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

llvm-svn: 253920
2015-11-23 21:47:51 +00:00
Xinliang David Li
0f29a15199 [PGO] Add --text option for llvm-profdata show|merge commands
The new option is similar to the SampleProfile dump option.

- dump raw/indexed format into text profile format
- merge the profile and output into text profile format.

Note that Value Profiling data text format is not yet designed. 
That functionality will be added later.

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

llvm-svn: 253913
2015-11-23 20:47:38 +00:00
Teresa Johnson
c0ecb3ad3f [ThinLTO] Deduplicate function index loading into shared helper (NFC)
Add a shared helper routine to read the function index from a file
and create/return the function index object. Use it in llvm-link and
llvm-lto.

llvm-svn: 253903
2015-11-23 19:19:11 +00:00
Teresa Johnson
eb6d97a346 Remove unused function parameter (NFC)
llvm-svn: 253889
2015-11-23 17:42:49 +00:00
Davide Italiano
c54fa3bc34 [llvm-rtdyld] Refactor to reduce indentation.
Suggested by: David Blaikie.

llvm-svn: 253808
2015-11-22 01:58:33 +00:00
Teresa Johnson
2b4369dd03 [ThinLTO] Handle bitcode without function summary sections gracefully
Summary:
Several fixes to the handling of bitcode files without function summary
sections so that they are skipped during ThinLTO processing in llvm-lto
and the gold plugin when appropriate instead of aborting.

1 Don't assert when trying to add a FunctionInfo that doesn't have
  a summary attached.
2 Skip FunctionInfo structures that don't have attached function summary
  sections when trying to create the combined function summary.
3 In both llvm-lto and gold-plugin, check whether a bitcode file has
  a function summary section before trying to parse the index, and skip
  the bitcode file if it does not.
4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug
  where we returned to early while looking for the summary section.

Also added llvm-lto and gold-plugin based tests for cases where we
don't have function summaries in the bitcode file. I verified that
either the first couple fixes described above are enough to avoid the
crashes, or fixes 1,3,4. But have combined them all here for added
robustness.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 253796
2015-11-21 21:55:48 +00:00
Davide Italiano
85b71754f5 [llvm-rtdyld] Fail early if we can't load dynamic libraries.
llvm-svn: 253767
2015-11-21 05:58:19 +00:00
Davide Italiano
5ad0793df9 [llvm-rtdyld] Turn assertion into errors, it seems more appropriate.
llvm-svn: 253766
2015-11-21 05:49:07 +00:00
Davide Italiano
1fff355fac [llvm-rtdyld] Improve error handling, use Error().
llvm-svn: 253765
2015-11-21 05:44:41 +00:00
Davide Italiano
1fdfc74500 [llvm-rtdyld] Use report_fatal_error().
This is a first step towards saner/uniform error reporting in llvm-rtdyld.

llvm-svn: 253759
2015-11-21 02:15:51 +00:00
Teresa Johnson
54750f488f llvm-link option and test for recent metadata mapping bug
Summary:
Add a -preserve-modules option to llvm-link that simulates LTO
clients that don't destroy modules as they are linked. This enables
reproduction of a recent bug introduced by a metadata linking change
that was only caught when the modules weren't destroyed before
writing bitcode (LTO on Windows).

See http://llvm.org/viewvc/llvm-project?view=revision&revision=253170
for more details on the original bug and the fix.

Confirmed the new test added here reproduces the failure using the new
option when I suppress the fix.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 253740
2015-11-21 00:35:38 +00:00
Davide Italiano
7bcdf96df0 [llvm-rtdyld] Message() is used only once. Inline. NFC.
llvm-svn: 253736
2015-11-20 23:12:15 +00:00
Teresa Johnson
45c27ecc06 [ThinLTO] Add MODULE_CODE_METADATA_VALUES record
Summary:
This is split out from the ThinLTO metadata mapping patch
http://reviews.llvm.org/D14752.

To avoid needing to parse the module level metadata during function
importing, a new module-level record is added which holds the
number of module-level metadata values. This is required because
metadata value ids are assigned implicitly during parsing, and the
function-level metadata ids start after the module-level metadata ids.

I made a change to this version of the code compared to D14752
in order to add more consistent and thorough assertion checking of the
new record value. We now unconditionally use the record value to
initialize the MDValueList size, and handle it the same in parseMetadata
for all module level metadata cases (lazy loading or not).

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, llvm-commits, joker.eph

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

llvm-svn: 253668
2015-11-20 14:51:27 +00:00
Tobias Edler von Koch
4bb34e0b6f [LTO] Add options to llvm-lto to select output format and dump merged module
This introduces two new options:
- "llvm-lto -save-merged-module -o outfile" dumps the LTO Module to
  outfile.merged.bc prior to CodeGen and after LTO optimizations have been run.
- "llvm-lto -filetype=asm -o outfile" makes llvm-lto emit assembly instead of
  object code in outfile.

Both are intended for use in lit tests.

llvm-svn: 253624
2015-11-20 00:13:05 +00:00
Mehdi Amini
4a5d6965a4 Remove unused function parameter (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253569
2015-11-19 15:42:34 +00:00
NAKAMURA Takumi
ce69d484e2 gold-plugin.cpp: Fix diagnosticHandler corresponding to r253540.
llvm-svn: 253553
2015-11-19 10:43:44 +00:00
Mehdi Amini
b5fccc4f2e Do not require a Context to extract the FunctionIndex from Bitcode (NFC)
The LLVMContext was only used for Diagnostic. Pass a DiagnosticHandler
instead.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 253540
2015-11-19 05:52:29 +00:00
Reid Kleckner
c49dc4bb0d Fix UMR in llvm-nm on IR object files in printDarwinSymbol
llvm-svn: 253529
2015-11-19 00:51:50 +00:00
Nathan Slingerland
7993025023 [llvm-profdata] Use SmallSet rather that std::set for keeping track of profdata merge errors
Missed bit of feedback from D14720.

Use SmallSet<std::error_code> rather than std::set<...> in order to be more efficient.

llvm-svn: 253474
2015-11-18 17:10:24 +00:00
David Majnemer
dc709fc7ad Fix LLD testsuite fallout from r253429
llvm-svn: 253432
2015-11-18 04:35:32 +00:00
David Majnemer
0ee82e9395 [llvm-objdump] Use the COFF export table for additional symbols
Most linked executables do not have a symbol table in COFF.
However, it is pretty typical to have some export entries.  Use those
entries to inform the disassembler about potential function definitions
and call targets.

llvm-svn: 253429
2015-11-18 02:49:19 +00:00
Nathan Slingerland
837191e935 [llvm-profdata] Fix unhandled enumeration values warning
Fix this:

llvm/tools/llvm-profdata/llvm-profdata.cpp:78:15: warning: 12 enumeration values not handled in switch: 'success', 'eof', 'unrecognized_format'... [-Wswitch]
      switch (instrError) {
                    ^

llvm-svn: 253413
2015-11-18 00:52:45 +00:00
David Blaikie
133cb3aa66 Generalize ownership/passing semantics to allow dsymutil to own abbreviations via unique_ptr
While still allowing CodeGen/AsmPrinter in llvm to own them using a bump
ptr allocator. (might be nice to replace the pointers there with
something that at least automatically calls their dtors, if that's
necessary/useful, rather than having it done explicitly (I think a typed
BumpPtrAllocator already does this, or maybe a unique_ptr with a custom
deleter, etc))

llvm-svn: 253409
2015-11-18 00:34:10 +00:00
Nathan Slingerland
a23131f082 [llvm-profdata] Show hint for other mismatch errors when merging instr profdata
Missed bit of feedback from D14720.

Show the same "Make sure that all profile
data to be merged is generated from the same binary." hint for hash mismatch
and value site count mismatch as we now do for counter mismatch when merging
incompatible instrumentation profile data.

llvm-svn: 253400
2015-11-17 23:37:09 +00:00
Nathan Slingerland
9c743e7e7f [llvm-profdata] Improve error messaging when merging mismatched profile data
Summary:
This change tries to make the root cause of instrumented profile data merge failures clearer.

Previous:

$ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata
test_1.profraw: foo: Function count mismatch
test_1.profraw: bar: Function count mismatch
test_1.profraw: baz: Function count mismatch
...

Changed:

$ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata
test_1.profraw: foo: Function basic block count change detected (counter mismatch)
Make sure that all profile data to be merged is generated from the same binary.
test_1.profraw: bar: Function basic block count change detected (counter mismatch)
test_1.profraw: baz: Function basic block count change detected (counter mismatch)
...

Reviewers: dnovillo, davidxl, bogner

Subscribers: llvm-commits

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

llvm-svn: 253384
2015-11-17 22:08:53 +00:00