Commit Graph

140770 Commits

Author SHA1 Message Date
Erik Eckstein
345d21cba1 Make the FunctionComparator of the MergeFunctions pass a stand-alone utility.
This is pure refactoring. NFC.

This change moves the FunctionComparator (together with the GlobalNumberState
utility) in to a separate file so that it can be used by other passes.
For example, the SwiftMergeFunctions pass in the Swift compiler:
https://github.com/apple/swift/blob/master/lib/LLVMPasses/LLVMMergeFunctions.cpp

Details of the change:

*) The big part is just moving code out of MergeFunctions.cpp into FunctionComparator.h/cpp
*) Make FunctionComparator member functions protected (instead of private)
   so that a derived comparator class can use them.

Following refactoring helps to share code between the base FunctionComparator
class and a derived class:

*) Add a beginCompare() function
*) Move some basic function property comparisons into a separate function compareSignature()
*) Do the GEP comparison inside cmpOperations() which now has a new
   needToCmpOperands reference parameter

https://reviews.llvm.org/D25385



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 21:15:13 +00:00
Rui Ueyama
6b8a0789f7 Fix -Wpessimizing-move warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286629 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 20:39:02 +00:00
Vyacheslav Klochkov
35cecc31aa Fixed the lost FastMathFlags for FCmp operations in SLPVectorizer.
Reviewer: Michael Zolotukhin.
Differential Revision: https://reviews.llvm.org/D26543


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:55:29 +00:00
Chad Rosier
ed7a0c4856 [AArch64] Update a FIXME comment to reflect current state. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:52:45 +00:00
Peter Collingbourne
aeb2eff8d2 Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Differential Revision: https://reviews.llvm.org/D26539

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:50:39 +00:00
Peter Collingbourne
9b252f03d9 Bitcode: Clean up error handling for certain bitcode query functions.
The functions getBitcodeTargetTriple(), isBitcodeContainingObjCCategory(),
getBitcodeProducerString() and hasGlobalValueSummary() now return errors
via their return value rather than via the diagnostic handler.

To make this work, re-implement these functions using non-member functions
so that they can be used without the LLVMContext required by BitcodeReader.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286623 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:50:24 +00:00
Peter Collingbourne
3352395b1c Bitcode: Prepare to move bitcode readers to free functions.
Make initStream() a free function, and change BitcodeReaderBase ctor to take
a BitstreamCursor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:50:10 +00:00
Lang Hames
b35b701639 [ORC] Revert r286620 while I investigate a bot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:46:46 +00:00
Lang Hames
d8314f03b1 [ORC] Refactor the ORC RPC utilities to add some new features.
(1) Add support for function key negotiation.

The previous version of the RPC required both sides to maintain the same
enumeration for functions in the API. This means that any version skew between
the client and server would result in communication failure.

With this version of the patch functions (and serializable types) are defined
with string names, and the derived function signature strings are used to
negotiate the actual function keys (which are used for efficient call
serialization). This allows clients to connect to any server that supports a
superset of the API (based on the function signatures it supports).

(2) Add a callAsync primitive.

The callAsync primitive can be used to install a return value handler that will
run as soon as the RPC function's return value is sent back from the remote.

(3) Launch policies for RPC function handlers.

The new addHandler method, which installs handlers for RPC functions, takes two
arguments: (1) the handler itself, and (2) an optional "launch policy". When the
RPC function is called, the launch policy (if present) is invoked to actually
launch the handler. This allows the handler to be spawned on a background
thread, or added to a work list. If no launch policy is used, the handler is run
on the server thread itself. This should only be used for short-running
handlers, or entirely synchronous RPC APIs.

(4) Zero cost cross type serialization.

You can now define serialization from any type to a different "wire" type. For
example, this allows you to call an RPC function that's defined to take a
std::string while passing a StringRef argument. If a serializer from StringRef
to std::string has been defined for the channel type this will be used to
serialize the argument without having to construct a std::string instance.

This allows buffer reference types to be used as arguments to RPC calls without
requiring a copy of the buffer to be made.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:42:44 +00:00
Sanjay Patel
a27bda70c2 [InstCombine] add tests to show size-increasing select transforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:37:54 +00:00
Chad Rosier
687ce7f4a1 [AArch64] Add test to show narrow zero store merging is disabled with strict align. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286617 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:25:48 +00:00
Geoff Berry
beb51d459e [AArch64] Fix bugs in isel lowering replaceSplatVectorStore.
Summary:
Fix off-by-one indexing error in loop checking that inserted value was a
splat vector.

Add code to check that INSERT_VECTOR_ELT nodes constructing the splat
vector have the expected constant index values.

Reviewers: t.p.northover, jmolloy, mcrosier

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286616 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:25:20 +00:00
Reid Kleckner
d758cd3129 [sancov] Don't instrument MSVC CRT stdio config helpers
They get called before initialization, which is a problem for winasan.

Test coming in compiler-rt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286615 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:18:45 +00:00
Evgeniy Stepanov
81323af362 [cfi] Implement cfi-icall using inline assembly.
The current implementation is emitting a global constant that happens
to evaluate to the same bytes + relocation as a jump instruction on
X86. This does not work for PIE executables and shared libraries
though, because we end up with a wrong relocation type. And it has no
chance of working on ARM/AArch64 which use different relocation types
for jump instructions (R_ARM_JUMP24) that is never generated for
data.

This change replaces the constant with module-level inline assembly
followed by a hidden declaration of the jump table. Works fine for
ARM/AArch64, but has some drawbacks.
* Extra symbols are added to the static symbol table, which inflate
the size of the unstripped binary a little. Stripped binaries are not
affected. This happens because jump table declarations must be
external (because their body is in the inline asm).
* Original functions that were anonymous are now named
<original name>.cfi, and it affects symbolization sometimes. This is
necessary because the only user of these functions is the (inline
asm) jump table, so they had to be added to @llvm.used, which does
not allow unnamed functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 18:49:09 +00:00
Adrian Prantl
aa0c77bc73 Fix comments according to the LLVM coding guidelines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 18:22:51 +00:00
Adrian Prantl
ec6378facd Revert "Use private linkage for MergedGlobals variables" on Darwin.
This is a partial revert of r244615 (http://reviews.llvm.org/D11942),
which caused a major regression in debug info quality.

Turning the artificial __MergedGlobal symbols into private symbols
(l__MergedGlobal) means that the linker will not include them in the
symbol table of the final executable. Without a symbol table entry
dsymutil is not be able to process the debug info for any of the
merged globals and thus drops the debug info for all of them.

This patch is enabling the old behavior for all MachO targets while
leaving all other targets unaffected.

rdar://problem/29160481
https://reviews.llvm.org/D26531

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286607 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 17:50:09 +00:00
Chad Rosier
d22d099fff [AArch64] Remove lots of redundant code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 17:49:34 +00:00
Sanjay Patel
d78e6da29d [InstCombine] fix formatting of FoldOpIntoSelect(); NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286604 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 17:42:16 +00:00
Greg Clayton
2104040e03 Fixed issues found by Paul Robinson with my patch for:
https://reviews.llvm.org/D26526

- Fixed DW_FORM_strp to be correctly sized and extracted for DWARF64
- Added some missing strp variants as well
- Fixed comment typo



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286603 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 17:38:14 +00:00
Chad Rosier
e58d246e9c [AArch64] Early return and minor renaming/refactoring to ease code review. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286601 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 17:07:37 +00:00
Greg Clayton
0818f49f3d Fix windows buildbot where warnings are errors. We had a switch statement where all enumerations were handled, but some compilers don't recognize this. Simplify the logic so that all compilers will know a return value is returned in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286600 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 16:55:31 +00:00
Greg Clayton
f5acbc29d8 Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes()
In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64.

This patch cleans up code so that everyone is using one of the new DWARFFormValue functions:

static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr);
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32);

This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form.

This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64.

To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values.

https://reviews.llvm.org/D26526




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 16:21:37 +00:00
Nemanja Ivanovic
3726719543 [PowerPC] Add vector conversion builtins to altivec.h - LLVM portion
This patch corresponds to review:
https://reviews.llvm.org/D26307

Adds all the intrinsics used for various conversion builtins that will
be added to altivec.h. These are type conversions between various types of
vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286596 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 14:41:19 +00:00
NAKAMURA Takumi
49e462805d llvm-strings: Fix r286556 to add required libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 14:17:37 +00:00
John Brawn
00180413cf Fix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hosts
Pass -m elf_x86_64 to gold, as is done in other tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 14:12:15 +00:00
Chad Rosier
0906927bc7 [AArch64] Enable merging of adjacent zero stores for all subtargets.
This optimization merges adjacent zero stores into a wider store.

e.g.,

strh wzr, [x0]
strh wzr, [x0, #2]
; becomes
str wzr, [x0]

e.g.,

str wzr, [x0]
str wzr, [x0, #4]
; becomes
str xzr, [x0]

Previously, this was only enabled for Kryo and Cortex-A57.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286592 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 14:10:12 +00:00
Sam Kolton
45849f5ed4 [AMDGPU] TargetStreamer: Fix .note section name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 13:41:52 +00:00
Ulrich Weigand
93f9010c1f [SystemZ] Support CL(G)T instructions
This adds support for the compare logical and trap (memory)
instructions that were added as part of the miscellaneous
instruction extensions feature with zEC12.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 12:48:26 +00:00
Ulrich Weigand
864946f0ea [SystemZ] Support load-and-zero-rightmost-byte facility
This adds support for the LZRF/LZRG/LLZRGF instructions that were
added on z13, and uses them for code generation were appropriate.

SystemZDAGToDAGISel::tryRISBGZero is updated again to prefer LLZRGF
over RISBG where both would be possible.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 12:46:28 +00:00
Ulrich Weigand
90353577ef [SystemZ] Use LLGT(R) instructions
This adds support for the 31-to-64-bit zero extension instructions
LLGT and LLGTR and uses them for code generation where appropriate.

Since this operation can also be performed via RISBG, we have to
update SystemZDAGToDAGISel::tryRISBGZero so that we prefer LLGT
over RISBG in case both are possible.  The patch includes some
simplification to the tryRISBGZero code; this is not intended
to cause any (further) functional change in codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 12:43:51 +00:00
Simon Pilgrim
aa9211b5c6 [SelectionDAG] Add support for vector demandedelts in BSWAP opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 11:51:29 +00:00
Simon Pilgrim
970d6e800d [X86] Add knownbits vector BSWAP test
In preparation for demandedelts support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286579 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 11:33:21 +00:00
Simon Pilgrim
912c7ec127 [SelectionDAG] Add support for vector demandedelts in UREM/SREM opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 11:23:43 +00:00
Simon Pilgrim
afe6870832 [X86] Add knownbits vector UREM/SREM tests
In preparation for demandedelts support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286577 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 11:11:40 +00:00
Simon Pilgrim
5809b919f1 [SelectionDAG] Add support for vector demandedelts in UDIV opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 10:47:24 +00:00
Simon Pilgrim
a597cc62da [X86] Add knownbits vector UDIV test
In preparation for demandedelts support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286575 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 10:39:15 +00:00
Diana Picus
286599a8f9 [ARM] Add plumbing for GlobalISel
Add GlobalISel skeleton, up to the point where we can select a ret void.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 08:27:37 +00:00
Adam Nemet
29e1623323 [opt-viewer] Make it work in the absence of hotness information
In this case the index page is sorted by the source location.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286572 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 06:11:56 +00:00
Mehdi Amini
36197284a5 Fix gold plugin after Error API changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 06:04:30 +00:00
Teresa Johnson
895b529ff6 Fix examples files to reflect header split in r286566.
I missed these files in examples/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 06:02:04 +00:00
Teresa Johnson
85a1c2100f Add missing file from r286566
Add the new BitcodeWriter.h header, which was missed in my r286566
commit, and should fix all the bot failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286569 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 05:46:30 +00:00
Teresa Johnson
a547919737 Split Bitcode/ReaderWriter.h into separate reader and writer headers
Summary:
Split ReaderWriter.h which contains the APIs into both the BitReader and
BitWriter libraries into BitcodeReader.h and BitcodeWriter.h.

This is to address Chandler's concern about sharing the same API header
between multiple libraries (BitReader and BitWriter). That concern is
why we create a single bitcode library in our downstream build of clang,
which led to r286297 being reverted as it added a dependency that
created a cycle only when there is a single bitcode library (not two as
in upstream).

Reviewers: mehdi_amini

Subscribers: dlj, mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 05:34:58 +00:00
Mandeep Singh Grang
c75e3c2fd2 [opt-viewer] PEPify opt-viewer.py
Reviewers: anemet

Subscribers: fhahn

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:51:27 +00:00
Mehdi Amini
274b04e1a0 Fix build failure, update llvm-strings for the new Error API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:50:18 +00:00
Mehdi Amini
5652444405 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:29:25 +00:00
Mehdi Amini
df0b8bce48 Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:28:40 +00:00
Mehdi Amini
90ab4b2ee2 CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR
This is need because of clang-tblgen

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:27:59 +00:00
Davide Italiano
582d2b4b31 [ADT/MathExtras] Make buildbot happy again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:03:29 +00:00
Saleem Abdulrasool
ca29721046 llvm-strings: explicitly include cctype
Include the cctype header to try to fix windows bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:00:59 +00:00
Saleem Abdulrasool
6a1b55e1ea llvm-strings: introduce basic strings tool
This is a replacement to binutils' string tool.  It prints strings found in a
binary (object file, executable, or archive library).  It is rather bare and
not functionally equivalent, however, it lays the groundwork necessary for the
strings tool, enabling iterative development of features to reach feature
parity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 03:44:12 +00:00