Commit Graph

6675 Commits

Author SHA1 Message Date
Mehdi Amini
73cf01b193 libLTO: add a ThinLTOCodeGenerator on the model of LTOCodeGenerator.
This is intended to provide a parallel (threaded) ThinLTO scheme
for linker plugin use through the libLTO C API.

The intent of this patch is to provide a first implementation as a
proof-of-concept and allows linker to start supporting ThinLTO by
definiing the libLTO C API. Some part of the libLTO API are left
unimplemented yet. Following patches will add support for these.

The current implementation can link all clang/llvm binaries.

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-09 01:37:22 +00:00
Zachary Turner
a20f3bcccd [llvm-pdbdump] Dump line table information.
This patch adds the -lines command line option which will dump
source/line information for each compiland and source file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 21:42:24 +00:00
Benjamin Kramer
b644c0ae0a [gold] Avoid assertion failures when taking a pointer to an empty vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262926 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 14:02:46 +00:00
Filipe Cabecinhas
8a96b704a3 [llvm-config] Get rid of code related to the Makefile builds
Summary: I left --build-system for backwards compat, in case there are scripts using it. Feel free to ask for its removal too.

Reviewers: chapuni, tstellarAMD

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262924 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 11:49:24 +00:00
Quentin Colombet
a7b1d455cc [llvm-config] Teach llvm-config about global-isel.
llvm-config can know tell whether or not a build has been configured to support
global-isel.
Use '--has-global-isel' for that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262877 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 00:02:50 +00:00
Teresa Johnson
b5cf7d3d51 Fix bot failure from r262721: unintented change in gold-plugin save-temps
The split code gen task ID should not be appended to save-temps output
file when the parallelism factor is 1 (not actually splitting).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 18:16:00 +00:00
Teresa Johnson
4fbd8ea38e [ThinLTO] Ensure prevailing linkonce emitted as weak in ThinLTO backends
Summary:
Since IR files are all compiled into separate independent object files
in ThinLTO mode, the prevailing linkonce symbols must be emitted in its
object file even if it is no longer referenced there, e.g. if no
references remain in the module after inlining, since it may be
referenced by another ThinLTO compiled object file. This is done by
changing LDPR_PREVAILING_DEF_IRONLY* symbols to LDPR_PREVAILING_DEF,
which converts the prevailing linkonce to weak. We also don't need the
other prevailing IRONLY handling for internalization, which is not
currently performed for ThinLTO.

Test case included.

Reviewers: davidxl, rafael

Subscribers: rafael, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 17:48:35 +00:00
Teresa Johnson
2209e677a1 [ThinLTO] Launch importing backends in parallel threads from gold plugin
Summary:
Launch ThinLTO backends (LTO and codegen pipelines with importing) in
parallel using a ThreadPool, after creating the combined index.
The number of threads is controlled by the existing -jobs gold plugin
option, or the hardware concurrency if not specified.

The old behavior of exiting after creating the combined index can be
invoked via a new thinlto-index-only plugin option.

This commit involves just the ThinLTO-specific pieces of D15390, the NFC
and other restructuring pieces were committed independently:
  r262677: Add hardware_concurrency interface to llvm::thread (NFC)
  r262719: Change split code gen to use ThreadPool
  r262721: Refactor gold-plugin codegen to prepare for ThinLTO threads (NFC)

Reviewers: pcc, joker.eph, rafael

Subscribers: rafael, davidxl, llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 17:06:02 +00:00
Teresa Johnson
07943597a8 Refactor gold-plugin codegen to prepare for ThinLTO threads (NFC)
This is the NFC part remaining from D15390, which refactors the
current codegen() into a CodeGen class with various modular methods and
other helper functions that will be used by the follow-on ThinLTO piece.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262721 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 16:36:06 +00:00
Evgeniy Stepanov
f0c747b6dc [gold] Handle modules that are not included in the link.
Gold has a newly added LDPT_GET_SYMBOLS_V3 callback that can
distinguish between a module that is not included in the link, and
one that is included but has its entire interface preempted by others.

Fixes PR26674.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262676 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 00:23:29 +00:00
Davide Italiano
ac6554cf16 [llvm-nm] Restore the previous behaviour (pre r262525).
It broke some buildbots.

Pointy-hat to:  me


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262529 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 22:33:49 +00:00
Davide Italiano
cf5219da54 [llvm-nm] Fix rendering of -s grouping with all the othe options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262525 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 21:59:31 +00:00
David Blaikie
7ade1db315 llvm-dwp: Add missing copyright notice to llvm-dwp.cpp
Addressing feedback on IRC by Sean Silva.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 22:29:00 +00:00
Tim Northover
9645a0d878 Fix typo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262405 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 21:45:22 +00:00
David Blaikie
c9b39e6bdd Revert "llvm-dwp: Keep ObjectFiles alive until object emission their contents can be referenced directly rather than copied"
Accidentally committed.

This reverts commit r262389.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 21:24:04 +00:00
Jacques Pienaar
e0accec873 [lanai] Add ELF enum value and relocations.
Add ELF enum value and relocations for Lanai backed.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend" (http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 21:21:42 +00:00
David Blaikie
6475ea0b50 llvm-dwp: Keep ObjectFiles alive until object emission their contents can be referenced directly rather than copied
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 20:40:02 +00:00
Rafael Espindola
18903ff9fb Move ObjectYAML code to a new library.
It is only ever used by obj2yaml and yaml2obj. No point in linking it
everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 19:15:06 +00:00
Petr Pavlu
3a3e8ddebb [LTO] Fix error reporting from lto_module_create_in_local_context()
Function lto_module_create_in_local_context() would previously
rely on the default LLVMContext being created for it by
LTOModule::makeLTOModule(). This context exits the program on
error and is not arranged to update sLastStringError in
tools/lto/lto.cpp.

Function lto_module_create_in_local_context() now creates an
LLVMContext by itself, sets it up correctly to its needs and then
passes it to LTOModule::createInLocalContext() which takes
ownership of the context and keeps it present for the lifetime of
the returned LTOModule.

Function LTOModule::makeLTOModule() is modified to take a
reference to LLVMContext (instead of a pointer) and no longer
creates a default context when nullptr is passed to it. Method
LTOModule::createInContext() that takes a pointer to LLVMContext
is removed because it allows to pass a nullptr to it. Instead
LTOModule::createFromBuffer() (that takes a reference to
LLVMContext) should be used.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 13:13:49 +00:00
Mike Aizatsky
4470c2730c [sancov] print_coverage_points command.
Differential Revision: http://reviews.llvm.org/D17670

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 02:21:44 +00:00
Chris Bieneman
b9c9a2934f [CMake] Add the gold plugin before clang
This is needed to connect dependencies between the LLVMgold plugin and the clang stage-2 builds due to limitations in ExternalProject_Add.

Patch by Mike Edwards

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 21:07:04 +00:00
Chris Bieneman
995ce72c12 [CMake] Assigning the LTO component to lto.h
This makes it so lto.h is installed when you run the install-LTO target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 21:07:02 +00:00
David Blaikie
6802c0801c llvm-dwp: provide diagnostics for duplicate DWO IDs
These diagnostics aren't perfect - in the case of merging several dwos
into dwps and those dwps into more dwps - just getting the message about
the original source file name might not be much help (since it's the
same in both dwos, by definition - but doesn't tell you which chain of
dwps to backtrack)

It might be worth adding the DW_AT_dwo_id to the split debug info to
improve the diagnostic experience - might help track down the duplicates
better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 07:30:15 +00:00
David Blaikie
132af4d0cd llvm-dwp: Support empty .dwo files
Though a bit odd, this is handy for a few reasons - for example, in a
build system that wants consistent input/output of build steps, but
where split-dwarf might be overriden/disabled by the user on a per-file
basis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 07:04:58 +00:00
Hemant Kulkarni
70c478d920 Reverts change r261907 and r261918
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261927 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 20:47:07 +00:00
Hemant Kulkarni
afe723d425 Fix endianness issue on BE machines introduced by r261907
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261918 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 18:56:01 +00:00
Hemant Kulkarni
ce1dab33de [llvm-readobj] Enable GNU style sections and relocations printing
http://reviews.llvm.org/D17523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 18:02:00 +00:00
Justin Bogner
da5e92486c PM: Implement a basic loop pass manager
This creates the new-style LoopPassManager and wires it up with dummy
and print passes.

This version doesn't support modifying the loop nest at all. It will
be far easier to discuss and evaluate the approaches to that with this
in place so that the boilerplate is out of the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261831 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 07:23:08 +00:00
Benjamin Kramer
b0ce7c7fb5 Fix some abuse of auto flagged by clang's -Wrange-loop-analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22 13:11:58 +00:00
Mike Aizatsky
6e95686683 fixing msvc warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261396 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 02:11:49 +00:00
Mike Aizatsky
78fadfc347 [sancov] sanitizer html report cosmetic improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 22:55:08 +00:00
David Blaikie
ff94d6e4ff llvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of linear searches through a vector
Figured this would be a problem, but didn't want to jump the gun - large
inputs demonstrate it pretty easily (mostly for type units, but might as
well do the same for CUs too). A random sample 6m27s -> 27s change.

Also, by checking this up-front for CUs (rather than when building the
cu_index) we can probably provide better error messages (see FIXMEs),
hopefully providing the name of the CUs rather than just their
signature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 21:09:26 +00:00
Davide Italiano
b75f2ffaf4 [llvm-nm] In C++, main implicitly returns 0. Pointed out by David Blaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261300 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 02:22:54 +00:00
David Blaikie
8e4a86a83f llvm-dwp: Don't test compression when zlib isn't available
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 02:03:45 +00:00
David Blaikie
fb07a71142 llvm-dwp: Support compressed input
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 01:51:44 +00:00
Mike Aizatsky
a30ffcf5ff [sancov] widening default blacklist.
Differential Revision: http://reviews.llvm.org/D17426

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 01:03:12 +00:00
Mike Aizatsky
c0110eaff6 [sancov] Adding covered/uncovered tables to coverage report.
Summary:
This change adds 3 tables to html report:
- list of covered files with number of functions covered.
- list of not covered files
- list of not covered functions.

I tried to put most coverage-calculating functionality into
SourceCoverageData.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 00:26:20 +00:00
Richard Trieu
1b96cbe208 Remove uses of builtin comma operator.
Cleanup for upcoming Clang warning -Wcomma.  No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 22:09:30 +00:00
Amaury Sechet
10ae0ad505 Add support for invoke/landingpad/resume in C API test
Summary: As per title. There was a lot of part missing in the C API, so I had to extend the invoke and landingpad API.

Reviewers: echristo, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 20:38:32 +00:00
Benjamin Kramer
1af94fd91c Add parentheses around arithmetic in operand of '|'.
This avoids a operator precedence warning for mixing + and | in an
expression. I checked that this matches the definition in the Split
DWARF proposal.

Patch by Cong Liu!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 13:23:17 +00:00
Chandler Carruth
67a41f0919 [PM/AA] Teach the new pass manager to use pass-by-lambda for registering
analysis passes, support pre-registering analyses, and use that to
implement parsing and pre-registering a custom alias analysis pipeline.

With this its possible to configure the particular alias analysis
pipeline used by the AAManager from the commandline of opt. I've updated
the test to show this effectively in use to build a pipeline including
basic-aa as part of it.

My big question for reviewers are around the APIs that are used to
expose this functionality. Are folks happy with pass-by-lambda to do
pass registration? Are folks happy with pre-registering analyses as
a way to inject customized instances of an analysis while still using
the registry for the general case?

Other thoughts of course welcome. The next round of patches will be to
add the rest of the alias analyses into the new pass manager and wire
them up here so that they can be used from opt. This will require
extending the (somewhate limited) functionality of AAManager w.r.t.
module passes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 09:45:17 +00:00
Amaury Sechet
a032454a7d Add upport for bitcast in the C API echo test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 23:55:59 +00:00
Amaury Sechet
185aa0ed1a Add support for memory operations (load/store/gep) in C API echo test
Summary: As per title.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 22:51:03 +00:00
Michael J. Spencer
0f322f0cff [readobj] Remove uneeded braces in case statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261170 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 22:30:41 +00:00
Amaury Sechet
cd12c6c06f Make sure functions are generated even there is no global in the C API echo test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 22:30:05 +00:00
Amaury Sechet
eef93799c2 Add support for global variables in the C API echo test
Summary: As per title

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261164 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 22:13:33 +00:00
Easwaran Raman
233e7d3773 Add a profile summary class specific to instrumentation profiles.
Modify ProfileSummary class to make it not instrumented profile specific.
Add a new InstrumentedProfileSummary class that inherits from ProfileSummary.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261119 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 18:18:47 +00:00
Rafael Espindola
f90cf923f6 Represent the dynamic table itself with a DynRegionInfo.
The dynamic table is also an array of a fixed structure, so it can be
represented with a DynReginoInfo.

No major functionality change. The extra error checking is covered by
existing tests with a broken dynamic program header.

Idea extracted from r260488. I did the extra cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261107 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 16:48:00 +00:00
Rafael Espindola
bf33cfed0e Add a unwrapOrError utility and use it to simplify ELFDumper.cpp.
Utility extracted from r260488.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 16:21:49 +00:00
Rafael Espindola
7ecc477012 Change how readobj stores info about dynamic symbols.
We used to keep both a section and a pointer to the first symbol.

The oddity of keeping a section for dynamic symbols is because there is
a DT_SYMTAB but no DT_SYMTABZ, so to print the table we have to find the
size via a section table.

The reason for still keeping a pointer to the first symbol is because we
want to be able to print relocation tables even if the section table is
missing (it is mandatory only for files used in linking).

With this patch we keep just a DynRegionInfo. This then requires
changing a few places that were asking for a Elf_Shdr but actually just
needed the first symbol.

The test change is to delete the program header pointer.
Now that we use the information of both DT_SYMTAB and .dynsym, we don't
depend on the sh_entsize of .dynsym if we see DT_SYMTAB.

Note: It is questionable if it is worth it putting the effort to report
broken sh_entsize given that in files with no section table we have to
assume it is sizeof(Elf_Sym), but that is for another change.

Extracted from r260488.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261099 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 15:38:21 +00:00