Commit Graph

6377 Commits

Author SHA1 Message Date
Davide Italiano
3aa1034794 [llvm-readobj] report_error() does not return, so we can simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 23:36:52 +00:00
David Blaikie
2b76269756 [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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:41:53 +00:00
David Blaikie
32ad075fd5 [llvm-dwp] clang-format this to catch anything I've missed along the way
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:06:30 +00:00
David Blaikie
543e02b438 [llvm-dwp] Support debug_tu_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:05:45 +00:00
Keno Fischer
3687382a34 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254819 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 01:38:12 +00:00
Keno Fischer
357108cbea [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:06:37 +00:00
Derek Schuff
a7a95fed0f Add TransformUtils to list of required libraries for llc
This dependency was added in r254774

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:47:58 +00:00
Rafael Espindola
c55f4fb805 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:08:53 +00:00
Keno Fischer
6f41c1352b [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:56:46 +00:00
David Blaikie
a2b2c5abb0 [llvm-dwp] Implement the required on-disk probed hash table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:30:23 +00:00
Reid Kleckner
efb247f17c Fix llvm-readobj build on Windows, match noreturn attribute on reportError in headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254769 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:29:53 +00:00
David Blaikie
19d1511e67 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:16:42 +00:00
Davide Italiano
f6712106fa [llvm-readobj] reportError() never returns. Mark with the correct attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254752 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 19:29:49 +00:00
Davide Italiano
2b50cdde67 [llvm-readobj/ELF] Simplify Verdef handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 19:27:58 +00:00
Mike Aizatsky
03d76d50e6 fixing Makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 19:11:54 +00:00
Mike Aizatsky
76bae99a61 adding MC dependencies in hopes to pacify the hexagon build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 18:50:18 +00:00
Mike Aizatsky
4d585624eb 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 18:35:37 +00:00
David Blaikie
2a3cc32f71 [llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 17:20:04 +00:00
Rafael Espindola
608d7b4f4a 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 16:14:31 +00:00
Rafael Espindola
c6a202e859 Move a call to getGlobalContext out of lib/LTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 02:42:28 +00:00
Lang Hames
51540fbf42 [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254693 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 02:15:39 +00:00
Nathan Slingerland
8061fe5c67 Revert "[llvm-profdata] Add support for weighted merge of profile data"
This reverts commit b7250858d9.

Reverting in order to investigate Windows test failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254687 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 02:13:58 +00:00
Rafael Espindola
f015928ee8 Simplify the error handling in llvm-lto a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254675 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 00:45:57 +00:00
Nathan Slingerland
b7250858d9 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 00:00:20 +00:00
Davide Italiano
0956a120f5 [llvm-objdump] Use report_fatal_error() if we can't find a target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254654 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 22:13:40 +00:00
Mehdi Amini
2d8142d991 Rename Set variable to be plural
Thanks Sean Silva for catching this.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 02:40:39 +00:00
Mehdi Amini
d4c7e117aa 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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254581 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 02:37:23 +00:00
David Blaikie
dc56408249 [llvm-dwp] Include only the non-empty columns in the cu_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 22:01:56 +00:00
David Blaikie
5001b2a939 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 06:21:34 +00:00
Mehdi Amini
accfde3ad6 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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254486 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 04:34:28 +00:00
Rafael Espindola
76c60c37de 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254449 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 19:50:54 +00:00
David Blaikie
8e31526513 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 19:17:58 +00:00
David Blaikie
0fb89f7b82 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 18:07:07 +00:00
Sanjoy Das
b1ce35cdfb 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 07:49:23 +00:00
David Blaikie
316c5ff46f [llvm-dwp] Add missing Makefile for the old configure+make build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 01:07:20 +00:00
David Blaikie
bb823837e0 [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)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 00:48:39 +00:00
David Blaikie
629180472c llvm-dwp: Initial layout
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 00:48:34 +00:00
Rafael Espindola
66bd82e422 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-27 20:28:19 +00:00
Hal Finkel
c818be073d [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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-26 19:23:49 +00:00
Richard Diamond
5efecd1377 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-25 22:49:48 +00:00
Rafael Espindola
e77aaecb56 Don't create implicit comdats.
comdats are explicitly represented for some time now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253924 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 22:01:51 +00:00
Sanjoy Das
96ddcceb80 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253920 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 21:47:51 +00:00
Xinliang David Li
55f78334c1 [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253913 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 20:47:38 +00:00
Teresa Johnson
846661215e [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 19:19:11 +00:00
Teresa Johnson
02d1c40fad Remove unused function parameter (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253889 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 17:42:49 +00:00
Davide Italiano
e5dedf932d [llvm-rtdyld] Refactor to reduce indentation.
Suggested by: David Blaikie.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-22 01:58:33 +00:00
Teresa Johnson
f1f60632b0 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253796 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 21:55:48 +00:00
Davide Italiano
82d936682d [llvm-rtdyld] Fail early if we can't load dynamic libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 05:58:19 +00:00
Davide Italiano
9fed20c129 [llvm-rtdyld] Turn assertion into errors, it seems more appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253766 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 05:49:07 +00:00
Davide Italiano
87daa918a1 [llvm-rtdyld] Improve error handling, use Error().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253765 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 05:44:41 +00:00