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

6746 Commits

Author SHA1 Message Date
Amaury Sechet
a0396b8473 Make sure the functions' range is empty before going through it in the LLVM C API test
llvm-svn: 260947
2016-02-16 08:37:01 +00:00
Amaury Sechet
b292899083 Do some refactoring in constant generation in the C API echo test. NFC
llvm-svn: 260941
2016-02-16 07:33:23 +00:00
Amaury Sechet
ab5d74845c Generate functions in 2 steps in the C API echo test. NFC
llvm-svn: 260939
2016-02-16 07:08:49 +00:00
Amaury Sechet
34464e942c Restore the capability to manipulate datalayout from the C API
Summary:
This consist in variosu addition to the C API:

  LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M);
  void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL);
  LLVMTargetDataRef LLVMCreateTargetMachineData(LLVMTargetMachineRef T);

Reviewers: joker.eph, Wallbraker, echristo

Subscribers: axw

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

llvm-svn: 260936
2016-02-16 05:11:24 +00:00
Amaury Sechet
66d7c5f836 Use report_fatal_error more consistently in the C API echo test
llvm-svn: 260849
2016-02-14 10:06:34 +00:00
Amaury Sechet
9600819a46 Get constant cloning out of CloneValue so it can be used when creating globals.
llvm-svn: 260848
2016-02-14 09:30:42 +00:00
Amaury Sechet
20d11c6692 Move clone_params around
llvm-svn: 260846
2016-02-14 09:14:30 +00:00
Davide Italiano
d5038b8299 [llvm-size] Remove variable used only once.
The use of auto and the name were very weird anyway.

llvm-svn: 260789
2016-02-13 01:52:47 +00:00
Davide Italiano
e227c6b3fe [llvm-size] Make error handling uniform.
llvm-svn: 260786
2016-02-13 01:38:16 +00:00
David Majnemer
85466f02fc [llvm-pdbdump] Start to decode some streams
We can decode a little bit of the first stream now.

llvm-svn: 260754
2016-02-12 22:27:44 +00:00
Hans Wennborg
9d006a860e [CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF
When cmake is run with -DLLVM_ENABLE_PIC=OFF, build fails while
linking shared library libLTO.so, because its dependencies are built
with -fno-PIC. More details here: https://llvm.org/bugs/show_bug.cgi?id=26484.
This diff reverts r252652 (git 9fd4377ddb83aee3c049dc8757e7771edbb8ee71),
which removed check NOT LLVM_ENABLE_PIC before disabling build for libLTO.so.

Patch by Igor Sugak!

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

llvm-svn: 260703
2016-02-12 19:02:39 +00:00
Mehdi Amini
dcb378d5fc llvm-config: replace assertions with a helpful error message
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260700
2016-02-12 18:43:10 +00:00
Mike Aizatsky
9bd27f7534 [sancov] improved object files handling.
Multi-dso programs result in multiple coverage files dumped of the form
'<module_name>.<pid>.sancov'. When analyzing these coverage files it is
important to use correct corresponding object file.

This change removes the "-obj" sancov flag and lets user specify object
file names alongside coverage files. Sancov tool would match them using
<module_name> part of coverage file and short file name of the object
file.

Corresponding changes:
- compiler-rt: http://reviews.llvm.org/D17171
- docs: http://reviews.llvm.org/D17175

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

llvm-svn: 260628
2016-02-12 00:29:07 +00:00
Reid Kleckner
9e7cb55466 [codeview] Dump def range lengths in hex
It makes it easier to correlate with assembly dumps, which are typically
given with hex offsets.

llvm-svn: 260619
2016-02-11 23:40:14 +00:00
Amaury Sechet
acebdda8cc Add support for phi nodes in the LLVM C API test
Summary: This required to add binding to Instruction::removeFromParent so that instruction can be forward declared and then moved at the right place.

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

Subscribers: llvm-commits

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

llvm-svn: 260597
2016-02-11 21:37:54 +00:00
Quentin Colombet
3a3c260954 [CMake] Produce an empty library for GlobalISel when not building it.
The rational for this change is that LLVMBuild cannot express conditional 
dependencies. Therefore, when we start optionally using GlobalISel library for 
say AArch64, without that change, all the tools that use the AArch64 library 
would need to explicitly link with GlobalISel when we ask for it.

This does not scale.

Instead, we will set the dependencies between the target and GlobalISel and if 
we did not ask to build GlobalISel, the library will just be empty.

Thanks to Chris Bieneman and Mehdi Animi for the idea.

llvm-svn: 260566
2016-02-11 19:18:27 +00:00
Michael J. Spencer
e7d9c3a84d [readobj] Dump DT_JMPREL relocations when outputting dynamic relocations.
llvm-svn: 260489
2016-02-11 04:59:53 +00:00
Michael J. Spencer
4b64c43150 [readobj] Handle ELF files with no section table or with no program headers.
This adds support for finding the dynamic table and dynamic symbol table via
the section table or the program header table. If there's no section table an
attempt is made to figure out the length of the dynamic symbol table.

llvm-svn: 260488
2016-02-11 04:59:45 +00:00
Michael J. Spencer
73a3cc2d7b [readobj] Move dynamic table parsing to a new function. NFC.
llvm-svn: 260487
2016-02-11 04:59:37 +00:00
Michael J. Spencer
d1aa7af498 [readobj] Sort switch by enum value.
Sort by enum value, but keep related entries adjacent. This makes it
easier to compare against documentation.

llvm-svn: 260486
2016-02-11 04:59:32 +00:00
Michael J. Spencer
b431964b1b [readobj] Parse sections before dynamic table.
NFC. This code will be expanded to handle dynamic tables that don't have a
PT_DYNAMIC.

llvm-svn: 260485
2016-02-11 04:59:26 +00:00
Hemant Kulkarni
a10309f126 Fix const confusion while lambda function usage
llvm-svn: 260484
2016-02-11 03:41:34 +00:00
Davide Italiano
c17a3ed69c [llvm-nm] Simplify code logic. Rewrite a single function an inline.
llvm-svn: 260482
2016-02-11 02:56:02 +00:00
Hemant Kulkarni
90ba322b26 Fix build failure caused in r260430
llvm-svn: 260471
2016-02-11 00:01:47 +00:00
Davide Italiano
031ac1e310 [llvm-nm] Minor style change. Prefer EXIT_SUCCESS over 0.
llvm-svn: 260470
2016-02-10 23:56:18 +00:00
Davide Italiano
ca08541c7f [llvm-nm] Prefer range-based loop over explicit iterator.
llvm-svn: 260459
2016-02-10 23:16:17 +00:00
Teresa Johnson
c47e95e1b1 Restore "[ThinLTO] Use MD5 hash in function index." with fix
This restores commit r260408, along with a fix for a bot failure.

The bot failure was caused by dereferencing a unique_ptr in the same
call instruction parameter list where it was passed via std::move.
Apparently due to luck this was not exposed when I built the compiler
with clang, only with gcc.

llvm-svn: 260442
2016-02-10 21:55:02 +00:00
Hemant Kulkarni
2e703c67d0 [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260430
2016-02-10 20:40:55 +00:00
Teresa Johnson
02e161e44f Revert "[ThinLTO] Use MD5 hash in function index." due to bot failure
This reverts commit r260408. Bot failure that I need to investigate.

llvm-svn: 260412
2016-02-10 19:11:15 +00:00
Teresa Johnson
b1e839beb3 [ThinLTO] Use MD5 hash in function index.
Summary:
This patch uses the lower 64-bits of the MD5 hash of a function name as
a GUID in the function index, instead of storing function names. Any
local functions are first given a global name by prepending the original
source file name. This is the same naming scheme and GUID used by PGO in
the indexed profile format.

This change has a couple of benefits. The primary benefit is size
reduction in the combined index file, for example 483.xalancbmk's
combined index file was reduced by around 70%. It should also result in
memory savings for the index file in memory, as the in-memory map is
also indexed by the hash instead of the string.

Second, this enables integration with indirect call promotion, since the
indirect call profile targets are recorded using the same global naming
convention and hash. This will enable the function importer to easily
locate function summaries for indirect call profile targets to enable
their import and subsequent promotion.

The original source file name is recorded in the bitcode in a new
module-level record for use in the ThinLTO backend pipeline.

Reviewers: davidxl, joker.eph

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 260408
2016-02-10 18:57:54 +00:00
Hemant Kulkarni
7bee7c2cd0 Revert "[llvm-readobj] Option to emit readelf like output"
This reverts commit a58765909660a7195b32e0cc8c7476168b913750.

llvm-svn: 260397
2016-02-10 18:21:01 +00:00
Hemant Kulkarni
bb26477ebd [llvm-nm] Add -radix option
Differential Revision: http://reviews.llvm.org/D16822

llvm-svn: 260392
2016-02-10 17:51:39 +00:00
Hemant Kulkarni
212037f7cf [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260391
2016-02-10 17:51:28 +00:00
Rong Xu
846b326ad9 [PGO] Differentiate Clang instrumentation and IR level instrumentation profiles
This patch uses one bit in profile version to differentiate Clang
instrumentation and IR level instrumentation profiles.

PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so
that the compiler runtime can set the right profile kind.
For Maco-O platform, we generate the variable as linkonce_odr linkage as
COMDAT is not supported.

PGOInstrumenation now checks this bit to make sure it's an IR level
instrumentation profile.

The patch was submitted as r260164 but reverted due to a Darwin test breakage.
Original Differential Revision: http://reviews.llvm.org/D15540

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

llvm-svn: 260385
2016-02-10 17:18:30 +00:00
NAKAMURA Takumi
f197a07b5b llvm-config: Fix DLL prefix on cygming.
For example, LLVMSupport takes the form of LLVMSupport.dll, not libLLVMSupport.dll.

llvm-svn: 260351
2016-02-10 03:09:13 +00:00
NAKAMURA Takumi
b793573c04 llvm-config: Quick fix for cross compilation. Don't be confsed between host and target. It has been there since r252532.
FIXME: The clause may use conditions of host compiler, not HOST_TRIPLE.
llvm-svn: 260343
2016-02-10 01:12:55 +00:00
Lang Hames
5d09e23f7a [Orc] Add lazy-JITting support for i386.
This patch adds a new class, OrcI386, which contains the hooks needed to
support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT
re-entry code uses the FXSAVE/FXRSTOR instructions).

Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and
regression and unit tests are enabled for this architecture.

llvm-svn: 260338
2016-02-10 01:02:33 +00:00
Amaury Sechet
ecd50f3e0c Add support for struct in C API test
Summary: As per title. This also include extra support for insertvalue and extracvalue.

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

Subscribers: llvm-commits

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

llvm-svn: 260335
2016-02-10 00:38:50 +00:00
Amaury Sechet
cd1fa43291 Add binding for counting argument and find called value of call and invoke instruction from the C API.
Summary: As per title. This remove the need to rely on internal knowledge of call and invoke instruction to find called value and argument count.

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

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

llvm-svn: 260332
2016-02-10 00:09:37 +00:00
Amaury Sechet
dfe90fdcf0 Split clone value and instruction in the echo C API test
Summary: This is a bit of refactoring required to be able to generate instruction in forward basic block. This, for instance, is a requirement for phi in loops.

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

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

llvm-svn: 260324
2016-02-09 23:41:20 +00:00
Amaury Sechet
352aef6336 Add icmp and conditional branches in the C API echo test.
Summary:
Improving coverage.

Depends on D16912 .

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

Subscribers: llvm-commits

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

llvm-svn: 260321
2016-02-09 23:15:02 +00:00
Amaury Sechet
d4ff40d570 Add C binding for AllocaInst::getAllocatedType
Summary:
Comes with an awesome test.

Depends on D16912

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

Subscribers: llvm-commits

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

llvm-svn: 260313
2016-02-09 22:50:53 +00:00
Amaury Sechet
ef4c99d35b Improve the C API echo test tool to emit basic block is the right order.
Summary: As per title. Also add a facility method to get the name of a basic block from the C API.

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

Subscribers: llvm-commits

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

llvm-svn: 260309
2016-02-09 22:36:41 +00:00
Rafael Espindola
f2a7a6879a This brings back commit r259578.
But now it follows the llvm style, uses an early return and doesn't
include a file named 1.o.

llvm-svn: 260293
2016-02-09 21:39:49 +00:00
Rafael Espindola
177e57db60 Fix name style.
Functions start with a lower case, variables with an upper case.

llvm-svn: 260287
2016-02-09 21:35:14 +00:00
Rafael Espindola
4315fd4954 Update comment style.
llvm-svn: 260286
2016-02-09 21:32:56 +00:00
Rafael Espindola
d8ee2fc3b7 Revert "Correct size calculations for ELF files"
This reverts commit r259578.

There are enough issues with this small patch that it is better to
revert and then commit a fixed version (will be committed shortly).

llvm-svn: 260285
2016-02-09 21:30:10 +00:00
Ehsan Akhgari
48aefced4b llvm-config: Add preliminary Windows support
Summary:
This patch adds Windows support for a few of the llvm-config commands,
including cflags, ldflags, libs, and system-libs.

Currently llvm-config is untested, so this patch adds tests for the
commands that it fixes as well.

Reviewers: rnk

Subscribers: llvm-commits

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

llvm-svn: 260263
2016-02-09 19:41:14 +00:00
Simon Atanasyan
9bb8f93c03 [llvm-readobj][ELF] Show MIPS GOT content when there is another zero-sized section at the same address
It is possible to have .got section and one or more zero-sized section
at the same address. This patch first checks that GOT (or GOT PLT)
section should have non-zero size using corresponding dynamic tags. Then
it looks up not empty section at the specified address.

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

llvm-svn: 260245
2016-02-09 18:45:35 +00:00
Kevin Enderby
56ebb01b61 Fix a formatting problems with llvm-size and the -m option.
It was using format() with a string for 64-bit types but was
passed a 32-bit type in places when printing values for
32-bit Mach-O files.

rdar://24542509

llvm-svn: 260243
2016-02-09 18:33:15 +00:00
Davide Italiano
4b782ea519 [llvm-nm] Remove excessive parenthesis, noticed by David Blaikie.
llvm-svn: 260173
2016-02-08 23:50:23 +00:00
Rong Xu
6836bd6879 [PGO] Revert r260146 as it breaks Darwin platforms.
r260146 | xur | 2016-02-08 13:07:46 -0800 (Mon, 08 Feb 2016) | 13 lines
[PGO] Differentiate Clang instrumentation and IR level instrumentation profiles

llvm-svn: 260170
2016-02-08 23:11:16 +00:00
Davide Italiano
71895e096c [llvm-nm] Yet another attempt of simplifying code.
llvm-svn: 260166
2016-02-08 22:58:26 +00:00
Rong Xu
5b6f09e7f2 [PGO] Differentiate Clang instrumentation and IR level instrumentation profiles
This patch uses one bit in profile version to differentiate Clang
instrumentation and IR level instrumentation profiles.

PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so
that the compiler runtime can set the right profile kind.
PGOInstrumenation now checks this bit to make sure it's an IR level
instrumentation profile.

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

llvm-svn: 260146
2016-02-08 21:07:46 +00:00
David Blaikie
25a5770c88 [llvm-dwp] Merge cu_index from DWPs
This is almost feature complete - just missing tu_index merging now.

llvm-svn: 259971
2016-02-06 01:15:26 +00:00
Richard Smith
ba3a89e3dc llvm-bcanalyzer: Produce summary information for the BLOCKINFO block, it can be
a significant fraction of the file size (for files that otherwise have few
records). Also include an average size per record in the summary information.

llvm-svn: 259965
2016-02-06 00:46:09 +00:00
Davide Italiano
0455fd2804 [llvm-nm] Prefer empty() over size() == 0.
Thanks to David Blaikie for pointing this out!

llvm-svn: 259938
2016-02-05 22:10:42 +00:00
Davide Italiano
b7786a9541 [llvm-nm] Transform a switch() statement in a pair of if(s).
This is more uniform wrt what other tools do and makes the code
a little bit more readable.

llvm-svn: 259937
2016-02-05 22:07:09 +00:00
Davide Italiano
8e6ffab913 [llvm-nm] Simplify code logic. NFCI.
llvm-svn: 259917
2016-02-05 21:10:48 +00:00
Reid Kleckner
212c354887 [codeview] Dump a missing field and change its signedness
llvm-svn: 259904
2016-02-05 19:15:45 +00:00
Benjamin Kramer
9180c5c3f6 Prefix external symbols in llvm-c-test.
This makes it less likely to clash with other stuff that might be linked
in by change, e.g. ncurses exposes an external function called simply
"echo", so linking ncurses statically into the binary explodes in funny
ways.

llvm-svn: 259882
2016-02-05 13:31:14 +00:00
Amaury Sechet
9f9b1d8649 Add various binary operations in the LLVM C API echo test
Summary: This diff increase the tested surface of the C API.

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

Subscribers: llvm-commits

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

llvm-svn: 259863
2016-02-05 01:27:11 +00:00
Amaury Sechet
7a50d8e1d0 Add Support to llvm-c-test dependancies
Summary: As per title. It is required and don't get linked in in some builds.

Reviewers: chapuni, joker.eph

Subscribers: llvm-commits

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

llvm-svn: 259853
2016-02-05 00:19:50 +00:00
Easwaran Raman
6960cdccb8 Refactor profile summary support code. NFC.
Summary computation is not just for instrumented profiling and so I have moved
the ProfileSummary class to ProfileCommon.h (named so to allow code unrelated
to summary but common to instrumented and sampled profiling to be placed there)

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

llvm-svn: 259846
2016-02-04 23:34:31 +00:00
Amaury Sechet
e2c912cc97 Improve testing for the C API
Summary:
This basically add an echo test case in C. The support is limited right now, but full support would just be too much to review at once.

The echo test case simply get a module as input and try to output the same exact module. This allow to check the both reading and writing API are working as expected.

I want to improve this test over time to support more and more of the API, in order to improve coverage (coverage is quite poor right now).

Test Plan: Run the test.

Reviewers: chandlerc, bogner

Subscribers: llvm-commits

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

llvm-svn: 259844
2016-02-04 23:26:19 +00:00
David Majnemer
85fe175353 Correctly handle {Always,Never}StepIntoLine
llvm-svn: 259806
2016-02-04 17:57:12 +00:00
David Majnemer
2b3e2654f3 Add support for S_DEFRANGE and S_DEFRANGE_SUBFIELD
llvm-svn: 259805
2016-02-04 17:37:30 +00:00
David Majnemer
582e75c661 Make the dumper's output for variable ranges easier to read
llvm-svn: 259804
2016-02-04 17:29:13 +00:00
David Majnemer
7643865fe5 Print the OffsetStart field's relocation
llvm-svn: 259723
2016-02-03 22:45:21 +00:00
David Majnemer
06715d7c34 [llvm-readobj] Add support for dumping S_DEFRANGE symbols
llvm-svn: 259719
2016-02-03 22:36:46 +00:00
Hemant Kulkarni
944f75148f Correct size calculations for ELF files
llvm-svn: 259578
2016-02-02 21:41:49 +00:00
Eugene Zelenko
0ebce618ad Fix Clang-tidy readability-redundant-control-flow warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D16793

llvm-svn: 259539
2016-02-02 18:20:45 +00:00
Reid Kleckner
ac609ef508 [codeview] Wire up the .cv_inline_linetable directive
This directive emits the binary annotations that describe line and code
deltas in inlined call sites. Single-stepping through inlined frames in
windbg now works.

llvm-svn: 259535
2016-02-02 17:41:18 +00:00
Davide Italiano
bd28c13e3a [llvm-nm] Simplify the code a bit. NFCI.
Fix a style violation while I'm here.

llvm-svn: 259391
2016-02-01 19:22:16 +00:00
Frederic Riss
b74de3916b [dsymutil] Skip mach-o paired relocations
Noticed while working on scattered relocations.
I do not think these relocs can actually happen in the debug_info section,
but if they happen the code would mishandle them. Explicitely skip them
and warn if we encounter one.

llvm-svn: 259341
2016-02-01 04:43:14 +00:00
Frederic Riss
e4eb654c9f [dsymutil] Support scattered relocs.
Although it seems like clang will never emit scattered relocations in
the debug information (at least I couldn't find a way), we have too
support them for the benefit of other compilers.
As clang doesn't generate them, the included testcase was produced
from hacked up assembly.

llvm-svn: 259339
2016-02-01 03:44:22 +00:00
Frederic Riss
f067530e7a [dsymutil] Fix handling of common symbols.
llvm-dsymutil was misinterpreting the value of common symbols as their
address when it actually contains their size. This didn't impact
llvm-dsymutil's ability to link the debug information for common symbols
because these are always found by name and not by address. Things could
however go wrong when the size of a common object matched the object
file address of another symbol. Depending on the link order of the symbols
the common object might incorrectly evict this other object from the
address to symbol mapping, and then link the evicted symbol with a wrong
binary address.

Use the new ability to have symbols without an object file address to fix
this.

llvm-svn: 259318
2016-01-31 04:29:34 +00:00
Frederic Riss
b7d5b18cde [dsymutil] Allow debug map mappings with no object file address. NFC
This change just changes the data structure that ties symbol names,
object file address and linked binary addresses to accept mappings
with no object file address. Such symbol mappings are not fed into
the debug map yet, so this patch is NFC.
A subsequent patch will make use of this functionality for common
symbols.

llvm-svn: 259317
2016-01-31 04:29:22 +00:00
Matthias Braun
882ae69776 Avoid overly large SmallPtrSet/SmallSet
These sets perform linear searching in small mode so it is never a good
idea to use SmallSize/N bigger than 32.

llvm-svn: 259283
2016-01-30 01:24:31 +00:00
Davide Italiano
7d199a2261 [llvm-nm] Add a comment to explain why we initialize MC.
llvm-svn: 259266
2016-01-29 23:38:05 +00:00
Vedant Kumar
e1a3d86600 [Profiling] Add a -sparse mode to llvm-profdata merge
Add an option to llvm-profdata merge for writing out sparse indexed
profiles. These profiles omit InstrProfRecords for functions which are
never executed.

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

llvm-svn: 259258
2016-01-29 22:54:45 +00:00
Reid Kleckner
884e80edd3 [CodeView] Fix dumping the is_stmt bit from the line table
Bug pointed out by George Rimar.

llvm-svn: 259205
2016-01-29 16:39:04 +00:00
Akira Hatanaka
c49cf41b85 [llvm-bcanalyzer] Dump bitcode wrapper header
This patch enables llvm-bcanalyzer to print the bitcode wrapper header
if the file has one, which is needed to test the changes made in
r258627 (bitcode-wrapper-header-armv7m.ll is the test case for r258627).

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

llvm-svn: 259162
2016-01-29 05:55:09 +00:00
Reid Kleckner
52a5e5edf7 Reland "[CodeView] Use assembler directives for line tables"
This reverts commit r259126 and relands r259117.

This time with updated library dependencies.

llvm-svn: 259130
2016-01-29 00:49:42 +00:00
Reid Kleckner
5bd9b33ade Revert "[CodeView] Use assembler directives for line tables"
This reverts commit r259117.

The LineInfo constructor is defined in the codeview library and we have
to link against it now. Doing that isn't trivial, so reverting for now.

llvm-svn: 259126
2016-01-29 00:13:28 +00:00
Reid Kleckner
55ddd2b283 Add missing raw_ostream include
Prior to r259115 this was coming via LTOModule.h and MCContext.h.

Apparently this target is not built by 'check'. =(

llvm-svn: 259124
2016-01-29 00:03:34 +00:00
Reid Kleckner
152804f593 Silence gcc warning about ternary and enumerations
llvm-svn: 259123
2016-01-28 23:59:35 +00:00
Reid Kleckner
7cc33b4fa4 [CodeView] Use assembler directives for line tables
Adds a new family of .cv_* directives to LLVM's variant of GAS syntax:

- .cv_file: Similar to DWARF .file directives

- .cv_loc: Similar to the DWARF .loc directive, but starts with a
  function id. CodeView line tables are emitted by function instead of
  by compilation unit, so we needed an extra field to communicate this.
  Rather than overloading the .loc direction further, we decided it was
  better to have our own directive.

- .cv_stringtable: Emits the codeview string table at the current
  position. Currently this just contains the filenames as
  null-terminated strings.

- .cv_filechecksums: Emits the file checksum table for all files used
  with .cv_file so far. There is currently no support for emitting
  actual checksums, just filenames.

This moves the line table emission code down into the assembler.  This
is in preparation for implementing the inlined call site line table
format. The inline line table format encoding algorithm requires knowing
the absolute code offsets, so it must run after the assembler has laid
out the code.

David Majnemer collaborated on this patch.

llvm-svn: 259117
2016-01-28 23:31:52 +00:00
Davide Italiano
9af52352cb [llvm-nm] Remove redundant check for file validity.
We already perform it at the beginning of the function so we can't
arrive here with an invalid object. Also, add a test so that bugs
won't sneak in the future.

llvm-svn: 258982
2016-01-27 20:27:44 +00:00
Benjamin Kramer
7bb55f0a55 One more batch of self-containing headers.
llvm-svn: 258974
2016-01-27 19:29:56 +00:00
Benjamin Kramer
4b661f540a Make more headers self-contained.
A lot of this comes from the new complete type requirement of DenseMap.

llvm-svn: 258956
2016-01-27 18:03:37 +00:00
Benjamin Kramer
c98a806c74 Move SafeStack to CodeGen.
It depends on the target machinery, that's not available for
instrumentation passes.

llvm-svn: 258942
2016-01-27 16:53:42 +00:00
Benjamin Kramer
60da2d6edb Remove superfluous call to std::to_string that's breaking the cygwin build.
llvm-svn: 258928
2016-01-27 13:22:39 +00:00
Benjamin Kramer
e3023baf50 Move MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.
llvm-svn: 258917
2016-01-27 10:01:28 +00:00
Chris Bieneman
1b8d4f74aa Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Hemant Kulkarni
cf95660c3e Fix comparison warning (r258845)
llvm-svn: 258856
2016-01-26 20:38:15 +00:00
Hemant Kulkarni
01d2899e13 Fixes build break introduced by r258845
llvm-svn: 258854
2016-01-26 20:28:15 +00:00
Davide Italiano
d5e6621b4e [llvm-nm] Roll several conditions into a single if. NFCI.
llvm-svn: 258846
2016-01-26 19:57:42 +00:00
Hemant Kulkarni
e89fec8eee [llvm-readobj] Add -elf-section-groups option
Adds a way to inspect SHT_GROUP sections in ELF objects.
Displays signature, member sections of these sections.

Differential revision: http://reviews.llvm.org/D16555

llvm-svn: 258845
2016-01-26 19:46:39 +00:00
Davide Italiano
d54157738e [llvm-nm] Simplify. No functional changes intended.
llvm-svn: 258837
2016-01-26 19:28:51 +00:00
Eugene Zelenko
966902f532 Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.
Differential revision: reviews.llvm.org/D16568

llvm-svn: 258831
2016-01-26 18:48:36 +00:00
Kevin Enderby
bfbad8d3aa Update the comments for the macho-invalid-zero-ncmds test and fix
llvm-objdump when printing the Mach Header to print the unknown
cputype and cpusubtype fields as decimal instead of not printing
them at all.  And change the test to check for that.

llvm-svn: 258826
2016-01-26 18:20:49 +00:00
Benjamin Kramer
75511fc092 Reflect the MC/MCDisassembler split on the include/ level.
No functional change, just moving code around.

llvm-svn: 258818
2016-01-26 16:44:37 +00:00
Igor Laevsky
7660fa06ad Re-submit r256008 "Improve DWARFDebugFrame::parse to also handle __eh_frame."
Originally this change was causing failures on windows buildbots.
But those problems were fixed in r258806.

llvm-svn: 258811
2016-01-26 15:09:42 +00:00
Bradley Smith
849b958836 [ARM] Add DSP build attribute and extension targeting
This patch was originally committed as r257885, but was reverted due to windows
failures. The cause of these failures has been fixed under r258677, hence
re-committing the original patch.

llvm-svn: 258683
2016-01-25 11:26:11 +00:00
Davide Italiano
5033e73038 [llvm-size] Use stderr instead of stdout for error messages.
This matches the behavior of other tools: objdump, readobj etc..

llvm-svn: 258667
2016-01-25 01:24:15 +00:00
Davide Italiano
1b7063b775 [gold] Remove inconsistent llvm_unreachable().
Differential Revision:	 http://reviews.llvm.org/D16429

llvm-svn: 258561
2016-01-22 21:36:49 +00:00
Kevin Enderby
d50c4b11ba Fix MachOObjectFile::getSymbolName() to not call report_fatal_error()
but to return object_error::parse_failed.  Then made the code in llvm-nm
do for Mach-O files what is done in the darwin native tools which is to
print "bad string index" for bad string indexes.  Updated the error message
in the llvm-objdump test, and added tests to show llvm-nm prints
"bad string index" and a test to print the actual bad string index value
which in this case is 0xfe000002 when printing the fields as raw hex.

llvm-svn: 258520
2016-01-22 18:47:14 +00:00
Kevin Enderby
a1e729dabc Fix MachOObjectFile::getSymbolSection() to not call report_fatal_error()
but to return object_error::parse_failed.  Then made the code in llvm-nm
do for Mach-O files what is done in the darwin native tools which is to
print "(?,?)" or just "s" for bad section indexes.  Also added a test to show
it prints the bad section index of "42" when printing the fields as raw hex.

llvm-svn: 258434
2016-01-21 21:13:27 +00:00
Teresa Johnson
c88ea8cc50 Revert obsolete llvm-link -preserve-modules option/test
This testing mode is now obsolete with the change to linkInModule
to take a std::unique_ptr to Module.

llvm-svn: 258399
2016-01-21 14:28:52 +00:00
Andrew Wilkins
70a7a21fcd llvm-go: call llvm-config with components
Summary:
Add components back into calls to llvm-config,
which was accidentally removed in r258283.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 258383
2016-01-21 02:33:39 +00:00
Reid Kleckner
13f2abc913 [readobj] Print CodeOffset first, it's easier to read
llvm-svn: 258368
2016-01-20 23:21:14 +00:00
Quentin Colombet
8d3acd6266 [GlobalISel] Add the proper cmake plumbing.
This patch adds the necessary plumbing to cmake to build the sources related to
GlobalISel.

To build the sources related to GlobalISel, we need to add -DBUILD_GLOBAL_ISEL=ON.
By default, this is OFF, thus GlobalISel sources will not impact people that do
not explicitly opt-in.

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

llvm-svn: 258344
2016-01-20 20:58:56 +00:00
Simon Atanasyan
65cb28f51e [llvm-readobj][ELF] Teach llvm-readobj to show arch specific ELF section's flags
Some architecture specific ELF section flags might have the same value
(for example SHF_X86_64_LARGE and SHF_HEX_GPREL) and we have to check
machine architectures to select an appropriate set of possible flags.

The patch selects architecture specific flags into separate arrays
`ElfxxxSectionFlags` and combines `ElfSectionFlags` and `ElfxxxSectionFlags`
before pass to the `StreamWriter::printFlags()` method.

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

llvm-svn: 258334
2016-01-20 19:15:18 +00:00
Petr Pavlu
b38595a7e2 [LTO] Fix error reporting when a file passed to libLTO is invalid or non-existent
This addresses PR26060 where function lto_module_create() could return nullptr
but lto_get_error_message() returned an empty string.

The error() call after LTOModule::createFromFile() in llvm-lto is then removed
because any error from this function should go through the diagnostic handler in
llvm-lto which will exit the program. The error() call was added because this
previously did not happen when the file was non-existent. This is fixed by the
patch. (The situation that llvm-lto reports an error when the input file does
not exist is tested by llvm/tools/llvm-lto/error.ll).

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

llvm-svn: 258298
2016-01-20 09:03:42 +00:00
Andrew Wilkins
e690f5b8b2 tools/llvm-config: improve shared library support
Summary:

This is a re-commit of r257003, which was reverted,
along with the fixes from http://reviews.llvm.org/D15986.

r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

llvm-svn: 258283
2016-01-20 04:03:09 +00:00
Tobias Edler von Koch
ef41afb1e8 Add a change accidentally left out from r258100
Also remove an executable bit introduced by r258083.

llvm-svn: 258101
2016-01-18 23:35:24 +00:00
Sergei Larin
72115d5fb6 Add to the split module utility an SCC based method which allows not to globalize any local variables.
Summary:
    Currently llvm::SplitModule as the first step globalizes all local objects, which might not be desirable in some scenarios.
    This change adds a new flag to llvm::SplitModule that uses SCC approach to search for a balanced partition without the need to externalize symbols.
    Such partition might not be possible or fully balanced for a given number of partitions, and is a function of the module properties (global/local dependencies within the module).
    
    Joint development Tobias Edler von Koch (tobias@codeaurora.org) and Sergei Larin (slarin@codeaurora.org)
    
    Subscribers: llvm-commits, joker.eph
    
    Differential Revision: http://reviews.llvm.org/D16124

llvm-svn: 258083
2016-01-18 21:07:13 +00:00
Rafael Espindola
392af636a2 Use new function name. NFC.
llvm-svn: 258079
2016-01-18 20:55:24 +00:00
Simon Atanasyan
d7e809052f [llvm-readobj][ELF] s/dyn_rela_/dyn_rel_/ No functional changes.
Follow up to r258001. These template functions might return both REL and RELA
relocations. The 'rel' noun looks less ambiguous.

llvm-svn: 258060
2016-01-18 18:52:04 +00:00
Lang Hames
944463fffc Remove some stale comments and fix a typo as suggested by David Blaikie in his
review of r257343.

Thanks Dave!

llvm-svn: 258002
2016-01-17 01:49:46 +00:00
Simon Atanasyan
8a2e38211d [llvm-readobj][ELF] Teach llvm-readobj to show dynamic relocation in REL format
MIPS 32-bit ABI uses REL relocation record format to save dynamic
relocations. The patch teaches llvm-readobj to show dynamic relocations
in this format.

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

llvm-svn: 258001
2016-01-16 22:40:09 +00:00
Manuel Jacob
e6438acb66 GlobalValue: use getValueType() instead of getType()->getPointerElementType().
Reviewers: mjacob

Subscribers: jholewinski, arsenm, dsanders, dblaikie

Patch by Eduard Burtescu.

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

llvm-svn: 257999
2016-01-16 20:30:46 +00:00
George Rimar
2c81d923b3 Fixed CRLF->LF line endings from r257914. NFC.
llvm-svn: 257990
2016-01-16 10:38:32 +00:00
Davide Italiano
2af46a6b49 [llvm-readobj] Dump DT_RELACOUNT correctly.
llvm-svn: 257988
2016-01-16 06:06:36 +00:00
Xinliang David Li
121c2832bb [PGO] fix a bug in profile summary computation
Entry block count was not counted and is corrected. Also
introduce a new metric that is MaxInternalBlockCount which
show command shows (as before).

llvm-svn: 257987
2016-01-16 05:29:49 +00:00
George Rimar
69e98e04dd Revert of 57967
Initial commit message:
CRLF -> LF. NFC

llvm-svn: 257973
2016-01-16 00:49:19 +00:00
Peter Collingbourne
0fcf3c17e0 Introduce sanstats tool and llvm::CreateSanitizerStatReport function.
This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

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

llvm-svn: 257970
2016-01-16 00:31:11 +00:00
George Rimar
50785f88d1 CRLF -> LF. NFC
llvm-svn: 257967
2016-01-16 00:14:21 +00:00
Reid Kleckner
1df6da7658 [codeview] Handle multiple frame descriptions in readobj
llvm-svn: 257943
2016-01-15 22:09:13 +00:00
Lang Hames
7c2bab6e19 [Orc] Make FDRPCChannel final.
This class is in the LLI tool, and isn't subclassed.

llvm-svn: 257937
2016-01-15 21:35:24 +00:00
Rafael Espindola
5afc08c99f Bring back "Assert that we have all use/users in the getters."
This reverts commit r257751, bringing back r256105.

The problem the assert found was fixed in r257915.

Original commit message:

Assert that we have all use/users in the getters.

An error that is pretty easy to make is to use the lazy bitcode reader
and then do something like

if (V.use_empty())

The problem is that uses in unmaterialized functions are not accounted
for.

This patch adds asserts that all uses are known.

llvm-svn: 257920
2016-01-15 19:00:20 +00:00
Reid Kleckner
3937bf8e5a # This is a combination of 2 commits.
# The first commit's message is:

Revert "[ARM] Add DSP build attribute and extension targeting"

This reverts commit b11cc50c0b4a7c8cdb628abc50b7dc226ff583dc.

# This is the 2nd commit message:

Revert "[ARM] Add new system registers to ARMv8-M Baseline/Mainline"

This reverts commit 837d08454e3e5beb8581951ac26b22fa07df3cd5.

llvm-svn: 257916
2016-01-15 18:31:29 +00:00
George Rimar
4f2e6d2b92 Recommit r257912
Added forgotten ELFDumper.cpp to commit.

Initial commit message:
[llvm-readobj] Add support for TLSDESC_PLT and TLSDESC_GOT dynamic section tags to the llvm-readobj.

If module uses uses lazy TLSDESC relocations it should define DT_TLSDESC_PLT and DT_TLSDESC_GOT entries.
They were unknown for llvm-readobj before this patch.

Differential revision: http://reviews.llvm.org/D16224

llvm-svn: 257914
2016-01-15 18:21:34 +00:00
Reid Kleckner
94ce0c4f6b [codeview] Dump the file checksum substream
llvm-svn: 257910
2016-01-15 18:06:25 +00:00
Bradley Smith
8c53f2fbdf [ARM] Add DSP build attribute and extension targeting
llvm-svn: 257885
2016-01-15 10:28:25 +00:00
NAKAMURA Takumi
682ca73aef lli: use llvm::utostr() instead of std::to_string().
llvm-svn: 257857
2016-01-15 02:14:46 +00:00
Reid Kleckner
6237bdd778 [codeview] Translate file table offsets to filenames and print them
llvm-svn: 257846
2016-01-15 00:11:21 +00:00
Mike Aizatsky
c4cbbdf6fc [sancov] html report
Differential Revision: http://reviews.llvm.org/D16161

llvm-svn: 257824
2016-01-14 22:34:11 +00:00
Xinliang David Li
6b68a0ee43 [PGO] Move profile summary interface/impl into InstrProf.[*] /NFC
llvm-svn: 257819
2016-01-14 22:10:49 +00:00
Lang Hames
825d101c30 [Orc] Add support for EH-frame registration to the Orc Remote Target utility
classes.

OrcRemoteTargetClient::RCMemoryManager will now register EH frames with the
server automatically. This allows remote-execution of code that uses exceptions.

llvm-svn: 257816
2016-01-14 22:02:03 +00:00
Reid Kleckner
47170eaf07 [codeview] Dump function callees and add more labels to inlinee info
I kept forgetting which number is the line delta and which is the code
delta.

llvm-svn: 257813
2016-01-14 21:50:05 +00:00
Rui Ueyama
dca64dbccc Update to use new name alignTo().
llvm-svn: 257804
2016-01-14 21:06:47 +00:00
Reid Kleckner
fc79a7dd17 [codeview] Dump CodeView inlinee lines subsection
llvm-svn: 257790
2016-01-14 19:20:17 +00:00
Adrian Prantl
c706175b3a dsymutil: Provide better warnings when clang modules cannot be found.
rdar://problem/22823264

llvm-svn: 257784
2016-01-14 18:31:07 +00:00
Reid Kleckner
5d8ecd7f53 Use std::map::insert instead of emplace for libstdc++ 4.7
llvm-svn: 257780
2016-01-14 18:03:29 +00:00
Reid Kleckner
20ce4984a4 Print function names when they are referenced via TypeIndex
llvm-svn: 257778
2016-01-14 17:52:01 +00:00
Reid Kleckner
cd99f259ee [readobj] Add functionality to dump relocations inside of binary blobs
llvm-svn: 257777
2016-01-14 17:51:57 +00:00
Reid Kleckner
f586452768 [codeview] Print relocations against code and data offset fields
These fields are almost always zero. However, there are relocations
against them, and we should print the relocation symbol with it as
SYM+0xNN.

llvm-svn: 257776
2016-01-14 17:51:54 +00:00
Michael Zolotukhin
6f8164efbd Revert "Assert that we have all use/users in the getters."
This reverts commit fdb838f3f8a8b6896bbbd5285555874eb3b748eb.

llvm-svn: 257751
2016-01-14 09:02:45 +00:00
David Majnemer
203ad3282a [CodeView] Add support for dumping binary annotations
Binary annotations are encoded along the lines of UTF-8 and ECI but with
a few minor differences.

The algorithm specified in "ECMA-335 CLI Section II.3.2 - Blobs and
Signatures" is used to compress binary annotations.  Signed binary
annotations are encoded like unsigned annotations except the sign bit is
rotated left to reduce the number of bits needed to be encoded.

llvm-svn: 257742
2016-01-14 06:12:30 +00:00
NAKAMURA Takumi
4b1f1aa597 llvm-profdata.cpp: Fix comment lines. [-Wdocumentation]
llvm-svn: 257726
2016-01-14 00:36:59 +00:00
Reid Kleckner
7a79432e02 [codeview] Share more enums across the writer and the dumper
Moves some .def files into include/DebugInfo/CodeView.

Aslo remove a 'using namespace' directive from a header in readobj and
update the uses of the endian helper types to compensate.

llvm-svn: 257712
2016-01-13 23:44:57 +00:00
Easwaran Raman
be7342fab7 Display detailed profile summary in llvm-profdata tool.
This adds a detailed profile summary in llvm-profdata. The summary is in the
form of one or more triples of the form (P, N, M) which is interpreted as if
we look at the Top-N counts in the profile, their sum accounts for P percentage
of the sum of all counts in the program and the minimum count in the Top-N is M.

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

llvm-svn: 257680
2016-01-13 21:44:36 +00:00
Adrian Prantl
1438194582 dsymutil: Only warn about missing clang modules once.
rdar://problem/22269336

llvm-svn: 257664
2016-01-13 20:26:00 +00:00
Reid Kleckner
0f638161ba [readobj] Expand CodeView dumping functionality
This rewrites and expands the existing codeview dumping functionality in
llvm-readobj using techniques similar to those in lib/Object. This defines a
number of new records and enums useful for reading memory mapped codeview
sections in COFF objects.

The dumper is intended as a testing tool for LLVM as it grows more codeview
output capabilities.

Reviewers: majnemer

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

llvm-svn: 257658
2016-01-13 19:32:35 +00:00
Davide Italiano
3bab431a79 [llvm-readobj] Remove dead code. Add an assertion instead.
When we arrive at the end of the function, the validation of
the object has been done already. In theory, so, we should never
arrive here with something broken as the object isn't mutated.
Practice sometimes proves theory to be wrong, so leave an assertion
instead, as suggested by David Blaikie, to catch bugs.

llvm-svn: 257570
2016-01-13 04:11:36 +00:00
Davide Italiano
baadd9459c [llvm-objdump] Use report_error() and improve error coverage.
llvm-svn: 257561
2016-01-13 02:03:31 +00:00
David Majnemer
32661ec901 [CodeView] Improve the line table dumper
This change has us print out fields we didn't previously understand.  To
improve readability, we now group column information with it's
respective line.

llvm-svn: 257552
2016-01-13 01:05:16 +00:00
Kevin Enderby
3f9a07c662 For llvm-objdump, add the option -private-header (without the trailing ’s’)
to only print the first private header.

Which for Mach-O files only prints the Mach header and not the subsequent load
commands.  Which is used by scripts to match what the darwin otool(1) with the
-h flag does without the -l flag.

For non-Mach-O files it has the same functionality as -private-headers (with
the trailing ’s’).

rdar://24158331

llvm-svn: 257548
2016-01-13 00:25:36 +00:00
Rui Ueyama
ed7e9e65ed COFF: Teach llvm-objdump how to dump DLL forwarder symbols.
llvm-svn: 257539
2016-01-12 23:28:42 +00:00
Dan Gohman
44c4718de7 [WebAssembly] Add a EM_WEBASSEMBLY value, and several bits of code that use it.
A request has been made to the official registry, but an official value is
not yet available. This patch uses a temporary value in order to support
development. When an official value is recieved, the value of EM_WEBASSEMBLY
will be updated.

llvm-svn: 257517
2016-01-12 20:56:01 +00:00
Andrew Wilkins
a734d141fe Revert r257003
This revision breaks llvm-config if you set
BUILD_SHARED_LIBS=on in a CMake build. Backing
out until the fix is ready to land.

llvm-svn: 257457
2016-01-12 07:23:58 +00:00
NAKAMURA Takumi
1f8f7e6bc2 lli: Fix warnings. [-Wsign-compare]
llvm-svn: 257430
2016-01-12 01:23:30 +00:00
NAKAMURA Takumi
74d6cb4eba lli-child-target: Introduce a new dependency on RuntimeDyld.
llvm-svn: 257410
2016-01-11 23:12:30 +00:00
Rafael Espindola
59ed1d964f Add a missing error handling to llvm-lto.
llvm-svn: 257395
2016-01-11 22:08:22 +00:00
Lang Hames
d0ddff1135 XFAIL the LLI remote JIT tests on Win32.
llvm-svn: 257391
2016-01-11 21:41:34 +00:00
Lang Hames
380df1aad3 lli/ChildTarget now depends on OrcJIT. Add that component to the Makefile.
llvm-svn: 257360
2016-01-11 17:44:07 +00:00
Lang Hames
6195badb41 [LLI] Remove dependence on RemoteTarget.cpp from ChildTarget's Makefile.
RemoteTarget.cpp was removed in r257343.

llvm-svn: 257351
2016-01-11 17:00:31 +00:00
Lang Hames
0c18396b3b [LLI] Replace the LLI remote-JIT support with the new ORC remote-JIT components.
The new ORC remote-JITing support provides a superset of the old code's
functionality, so we can replace the old stuff. As a bonus, a couple of
previously XFAILed tests have started passing.

llvm-svn: 257343
2016-01-11 16:35:55 +00:00
Lang Hames
ecc377c6e6 [Orc] Rename OrcTargetSupport to OrcArchitectureSupport to avoid confusion with
the upcoming remote-target support classes.

llvm-svn: 257302
2016-01-11 00:56:15 +00:00
Lang Hames
7d118365e3 [Orc] Enable user-supplied memory managers in the CompileOnDemand layer.
Previously the CompileOnDemand layer was hard-coded to use a new
SectionMemoryManager for each function when it was called.

llvm-svn: 257265
2016-01-09 20:55:18 +00:00
Mike Aizatsky
d03c218611 [llvm-symbolizer] -print-source-context-lines option to print source code around the line.
Differential Revision: http://reviews.llvm.org/D15909

llvm-svn: 257236
2016-01-09 00:14:35 +00:00
Mike Aizatsky
a5855c0f74 [llvm-symbolizer] Print out non-address lines verbatim.
Differential Revision: http://reviews.llvm.org/D15876

llvm-svn: 257115
2016-01-07 23:57:41 +00:00
Andrew Wilkins
51a57d89a6 tools/llvm-config: improve shared library support
Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

llvm-svn: 257003
2016-01-07 00:18:56 +00:00
Davide Italiano
c1c5a1a0a8 [llvm-objdump] Mark noreturn function as such.
Match attribute in the header to make MSVC happy.

llvm-svn: 256560
2015-12-29 13:41:02 +00:00
Davide Italiano
5e3e0bcb69 [llvm-objdump] Use stderr and not stdout for fatal errors.
llvm-svn: 256423
2015-12-25 18:16:45 +00:00
Adrian Prantl
3787e623ca llvm-dwarfdump: Add support for dumping .dSYM bundles.
This replicates the logic of Darwin dwarfdump for manually opening up
.dSYM bundles without introducing any new dependencies.
<rdar://problem/20491670>

llvm-svn: 256350
2015-12-23 21:51:13 +00:00
Davide Italiano
55611bd554 [llvm-readobj] Use stderr and not stdout for error messages.
llvm-svn: 256347
2015-12-23 19:29:34 +00:00
Rafael Espindola
69b537cdd4 Disable use list order on the gold plugin.
It turns out that his is *really* slow. With this change the link of
clang with plugin-opt=emit-llvm goes from 41 to 26 seconds.

We can add an option to enable it again if needed.

llvm-svn: 256302
2015-12-22 23:45:49 +00:00
David Majnemer
47d3d1e5ef [MC, COFF] Support link /incremental conditionally
Today, we always take into account the possibility that object files
produced by MC may be consumed by an incremental linker.  This results
in us initialing fields which vary with time (TimeDateStamp) which harms
hermetic builds (e.g. verifying a self-host went well) and produces
sub-optimal code because we cannot assume anything about the relative
position of functions within a section (call sites can get redirected
through incremental linker thunks).

Let's provide an MCTargetOption which controls this behavior so that we
can disable this functionality if we know a-priori that the build will
not rely on /incremental.

llvm-svn: 256203
2015-12-21 22:09:27 +00:00
Davide Italiano
abd57b3a46 [llvm-objdump] Use appropriate helper. NFC.
llvm-svn: 256156
2015-12-21 14:10:54 +00:00
Davide Italiano
ff8004bbec [llvm-objdump] Move COFF function to where it belongs.
Ideally much more stuff should be moved out of llvm-objdump.cpp, but that
will happen later.

llvm-svn: 256118
2015-12-20 09:54:34 +00:00
Xinliang David Li
859c330e8f [PGO] Improve Indexed Profile Reader efficiency
With the support of value profiling added, the Indexed prof
reader gets less efficient. The prof reader initialization
used to be just reading the file header, but with VP support
added, initialization needs to walk through all profile keys
of ondisk hash table resulting in very poor locality and large
memory increase (keys are stored together with the profile data
in the mapped profile buffer). Even worse, when the reader is 
used by the compiler (not llvm-profdata too), the penalty becomes
very high as compilation of each single module requires touching
profile data buffer for the whole program. 

In this patch, the icall target values (MD5hash) are no longer eargerly 
converted back to name strings when the data is read into memory. New
interface is added to to profile reader so that InstrProfSymtab can be
lazily created for Indexed profile reader on-demand. Creating of the 
symtab is intended to be used by llvm-profdata tool for symbolic dumping
of  VP data. It can be used with compiler (for legacy out of tree uses)
too but not recommended due to compile time and memory reasons 
mentioned above.

Some other cleanups are also included: Function Addr to md5 map is now
consolated into InstrProfSymtab. InstrProfStringtab is no longer used and
eliminated.

llvm-svn: 256114
2015-12-20 06:22:13 +00:00
Davide Italiano
0a7e02f0db [llvm-objdump] Fail early if we can't parse the object header.
llvm-svn: 256108
2015-12-19 22:09:40 +00:00
Rafael Espindola
552e7f96b1 Assert that we have all use/users in the getters.
An error that is pretty easy to make is to use the lazy bitcode reader
and then do something like

if (V.use_empty())

The problem is that uses in unmaterialized functions are not accounted
for.

This patch adds asserts that all uses are known.

llvm-svn: 256105
2015-12-19 20:03:23 +00:00
Rafael Espindola
e392243a54 Deprecate a few C APIs.
This deprecates:
* LLVMParseBitcode
* LLVMParseBitcodeInContext
* LLVMGetBitcodeModuleInContext
* LLVMGetBitcodeModule

They are replaced with the functions with a 2 suffix which do not record
a diagnostic.

llvm-svn: 256065
2015-12-18 23:46:42 +00:00
Rafael Espindola
364ada1a48 Delete dead code: only functions are materializable.
llvm-svn: 256052
2015-12-18 22:44:07 +00:00
Rafael Espindola
914b00520f Use a lambda to reduce code duplication.
llvm-svn: 256050
2015-12-18 22:40:27 +00:00
Alexey Samsonov
2a592789eb [sancov] IWYU fix: add proper header inclusion.
llvm-svn: 256040
2015-12-18 22:02:08 +00:00
Rafael Espindola
a8daff187a Drop materializeAllPermanently.
This inlines materializeAll into the only caller
(materializeAllPermanently) and renames materializeAllPermanently to
just materializeAll.

llvm-svn: 256024
2015-12-18 20:13:39 +00:00
Pete Cooper
cda523f460 Revert "Improve DWARFDebugFrame::parse to also handle __eh_frame."
This reverts commit r256008.

Its breaking multiple buildbots, although works for me locally.

llvm-svn: 256013
2015-12-18 19:45:38 +00:00
Pete Cooper
70c961d67d Improve DWARFDebugFrame::parse to also handle __eh_frame.
LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's.

This code improves DWARFDebugFrame::parse to do the same for parsing.

This also allows llvm-objdump to support the --dwarf=frames option which objdump supports.  This
option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse.

http://reviews.llvm.org/D15535

Reviewed by Rafael Espindola.

llvm-svn: 256008
2015-12-18 18:51:08 +00:00
Rafael Espindola
493b2dfc10 Add a test for LLVMGetBitcodeModule.
llvm-svn: 255985
2015-12-18 03:57:26 +00:00
Eric Christopher
359dea2a6b Reorganize the C API headers to improve build times.
Type specific declarations have been moved to Type.h and error handling
routines have been moved to ErrorHandling.h. Both are included in Core.h
so nothing should change for projects directly including the headers,
but transitive dependencies may be affected.

llvm-svn: 255965
2015-12-18 01:46:52 +00:00
Teresa Johnson
0dce8d436c [ThinLTO] Metadata linking for imported functions
Summary:
Second patch split out from http://reviews.llvm.org/D14752.

Maps metadata as a post-pass from each module when importing complete,
suturing up final metadata to the temporary metadata left on the
imported instructions.

This entails saving the mapping from bitcode value id to temporary
metadata in the importing pass, and from bitcode value id to final
metadata during the metadata linking postpass.

Depends on D14825.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, llvm-commits, joker.eph

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

llvm-svn: 255909
2015-12-17 17:14:09 +00:00
Davide Italiano
27e94a3dee [llvm-objdump] Use report_fatal_error() for a more uniform error handling.
llvm-svn: 255871
2015-12-17 01:59:50 +00:00
Rafael Espindola
f7a0054c75 Change linkInModule to take a std::unique_ptr.
Passing in a std::unique_ptr should help find errors when the module
is used after being linked into another module.

llvm-svn: 255842
2015-12-16 23:16:33 +00:00
Nathan Slingerland
648ea4f74f [PGO] Handle and report overflow during profile merge for all types of data
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user.

Reviewers: davidxl, dnovillo, silvas

Subscribers: llvm-commits

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

llvm-svn: 255825
2015-12-16 21:45:43 +00:00
Teresa Johnson
c78d28935d Use LLVM style variable name (NFC)
Fixes variable name from r255779.

llvm-svn: 255824
2015-12-16 21:37:48 +00:00
Chris Bieneman
acfa604132 [CMake] Adding llvm-profdata to the list of tools clang needs.
Bootstrapping clang to generate PGO data (patches coming soon), requires llvm-profdata targets to be generated before clang.

llvm-svn: 255794
2015-12-16 18:30:36 +00:00
Reid Kleckner
a0000e2429 Reland "[llvm-readobj] Simplify usage of -codeview flag"
Relands r255790 with fixed tests.

llvm-svn: 255793
2015-12-16 18:28:12 +00:00
Reid Kleckner
e80fed4166 Revert "[llvm-readobj] Simplify usage of -codeview flag"
This reverts commit r255790.

llvm-svn: 255791
2015-12-16 18:19:34 +00:00
Reid Kleckner
958c5136d5 [llvm-readobj] Simplify usage of -codeview flag
llvm-svn: 255790
2015-12-16 18:18:39 +00:00
Teresa Johnson
110b342ed8 Add RAII wrapper for gold plugin file management
Suggested in review of r255256.

llvm-svn: 255779
2015-12-16 16:34:06 +00:00
Mike Aizatsky
f3003a8493 [sancov] blacklist support.
Summary:
Using the blacklist the user can filter own unwanted functions
from all outputs. By default blacklist contains "fun:__sancov*" line.

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

llvm-svn: 255732
2015-12-16 00:31:48 +00:00
Davide Italiano
8485ad1cb8 [llvm-objdump/MachODump] Shrink code a little bit. NFC.
llvm-svn: 255701
2015-12-15 23:14:21 +00:00
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