Commit Graph

140985 Commits

Author SHA1 Message Date
Davide Italiano
63830bcae9 [ELF] Convert ELF.h to Expected<T>.
This has two advantages:
1) We slowly move away from ErrorOr to the new handling interface,
in the hope of having an uniform error handling in LLVM, eventually.
2) We're starting to have *meaningful* error messages for invalid
object ELF files, rather than a generic "parse error". At some point
we should include also the offset to improve the quality of the
diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 05:10:28 +00:00
Saleem Abdulrasool
68e337a67b test: use separate input file for test
Rather than using sed to generate the input and pipe the result to
strings, use the static input instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287079 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 04:08:46 +00:00
Konstantin Zhuravlyov
925ac794ff [AMDGPU] Refactor v_mac_{f16, f32} patterns into a class NFC
Differential Revision: https://reviews.llvm.org/D26711


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 03:39:12 +00:00
Matthias Braun
826ceabdec AArch64: Use DeadRegisterDefinitionsPass before regalloc.
Doing this before register allocation reduces register pressure as we do
not even have to allocate a register for those dead definitions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 03:38:27 +00:00
Richard Smith
79e3fcdc81 Fix build break when the host C compiler is C89.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 03:36:29 +00:00
Konstantin Zhuravlyov
7f4d4fdf3f [AMDGPU] Handle f16 select{_cc}
- Select `select` to `v_cndmask_b32`
- Expand `select_cc`
- Refactor patterns

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287074 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 03:16:26 +00:00
Dean Michael Berris
30d8d0833f [XRay][docs] Define requirements on installed log handlers.
Summary:
We update the documentation to define what the requirements are for the
provided XRay log handler. This is to make it clear that the function
pointer provided must do internal synchronisation and that there are no
guarantees provided by XRay on when the function shall be invoked once
it has been installed as a log handler.

Reviewers: rSerge, rengolin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 02:18:23 +00:00
Quentin Colombet
8934fe31f3 [RegAllocGreedy] Record missed hint for late recoloring.
In https://reviews.llvm.org/D25347, Geoff noticed that we still have
useless copy that we can eliminate after register allocation. At the
time the allocation is chosen for those copies, they are not useless
but, because of changes in the surrounding code, later on they might
become useless.
The Greedy allocator already has a mechanism to deal with such cases
with a late recoloring. However, we missed to record the some of the
missed hints.

This commit fixes that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 01:07:12 +00:00
Rui Ueyama
1a2f700e22 Align Modi and FileInfo substreams on 32-byte offsets.
This is required by DbiStream, but DbiStreamBuilder didn't align
these substreams, so the output of DbiSTreamBuilder couldn't be
read by DbiStream.

Test will be added to LLD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:59:27 +00:00
Vyacheslav Klochkov
747716a482 Fixed the lost FastMathFlags for CALL operations in SLPVectorizer.
Reviewer: Michael Zolotukhin.
Differential Revision: https://reviews.llvm.org/D26575



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:55:50 +00:00
Justin Lebar
eb77a4a537 [BypassSlowDivision] Handle division by constant numerators better.
Summary:
We don't do BypassSlowDivision when the denominator is a constant, but
we do do it when the numerator is a constant.

This patch makes two related changes to BypassSlowDivision when the
numerator is a constant:

 * If the numerator is too large to fit into the bypass width, don't
   bypass slow division (because we'll never run the smaller-width
   code).

 * If we bypass slow division where the numerator is a constant, don't
   OR together the numerator and denominator when determining whether
   both operands fit within the bypass width.  We need to check only the
   denominator.

Reviewers: tra

Subscribers: llvm-commits, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287062 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:44:47 +00:00
Justin Lebar
c18d950852 [BypassSlowDivision] Simplify partially-tautological if statement.
if (A || (B && A)) --> if (A).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:44:43 +00:00
Rui Ueyama
d0211181aa Fix Modi and File count if there are more than 65535 modules/files.
These numbers are intended to be capped at 65535, but
`std::max<uint16_t>(UINT16_MAX, N)` always returns N for any N because
the expression is the same as `std::max((uint16_t)UINT16_MAX, (uint16_t)N)`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:38:33 +00:00
Joerg Sonnenberger
8833323011 Always use relative jump table encodings on PowerPC64.
For the default, small and medium code model, use the existing
difference from the jump table towards the label. For all other code
models, setup the picbase and use the difference between the picbase and
the block address.

Overall, this results in smaller data tables at the expensive of one or
two more arithmetic operation at the jump site. Given that we only create
jump tables with a lot more than two entries, it is a net win in size.
For larger code models the assumption remains that individual functions
are no larger than 2GB.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:37:30 +00:00
Jan Vesely
ea73d16588 AMDGPU/GCN: Exit early in hazard recognizer if there is no vreg argument
wbinvl.* are vector instruction that do not sue vector registers.

v2: check only M?BUF instructions

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287056 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 23:55:15 +00:00
Sanjay Patel
e9b0d8061c [x86] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 23:09:53 +00:00
Kevin Enderby
0156bda17b General clean up of Mach-O error handling in llvm-objdump.
To get a good error message for all files that could contain Mach-O
files the code in llvm-objdump needs to use the archive member name
and name of the architecture of a slice of a universal file in those cases
where the error come from a Mach-O file in an archive or a universal file.

Most of this is fixed by moving the call to checkSymbolTable() into
ProcessMachO() and calling it when the operation needs the symbol
table.  And then calling the form of report_error() that has the
ArchiveName and ArchitectureName arguments.  One other place
needed to call this form of report_error() also with these arguments.

Also changed the code in MachODump.cpp to not use report_fatal_error()
and use report_error() instead to make the code smaller and cleaner.  All
cases of this are for errors with the symbol table which should now never
be tripped since checkSymbolTable() should be called first to get a good
error message in these cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 23:07:41 +00:00
Sanjay Patel
b572c5c132 [x86] auto-generate better checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 23:01:11 +00:00
Sanjay Patel
df7f96e084 [x86] auto-generate better checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287048 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 22:42:20 +00:00
Filipe Cabecinhas
ce26290c52 [AddressSanitizer] Add support for (constant-)masked loads and stores.
This patch adds support for instrumenting masked loads and stores under
ASan, if they have a constant mask.

isInterestingMemoryAccess now supports returning a mask to be applied to
the loads, and instrumentMop will use it to generate additional checks.

Added tests for v4i32 v8i32, and v4p0i32 (~v4i64) for both loads and
stores (as well as a test to verify we don't add checks to non-constant
masks).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287047 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 22:37:30 +00:00
Sanjay Patel
c8094cab48 [x86] auto-generate better checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287046 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 22:33:16 +00:00
Amaury Sechet
b451ba82e0 [C API] Prevent nullptr dereferences in C API for counting attributes.
See https://reviews.llvm.org/D26392

Patch by @maleadt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287044 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 22:19:59 +00:00
Peter Collingbourne
0f03473737 Object: replace backslashes with slashes in embedded relative thin archive paths on Windows.
This makes these thin archives portable between *nix and Windows.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:36:35 +00:00
Chad Rosier
eb47aeba1e [AArch64] Add support for Qualcomm's Falkor CPU.
Differential Revision: https://reviews.llvm.org/D26673

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287036 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:34:12 +00:00
Tom Stellard
1d353ca419 AMDGPU/SI: Fix pattern for i16 = sign_extend i1
Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:25:56 +00:00
Sanjay Patel
0e5d70c02c [x86] add tests for FP-logic equivalent instruction replacement
The ANDN test needs at least 3 different fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:19:28 +00:00
Chad Rosier
17fd000f82 [AArch64] Refactor test per Matthias' request.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:18:18 +00:00
Kostya Serebryany
dd850be3cf [sanitizer-coverage] make sure asan does not instrument coverage guards (reported in https://github.com/google/oss-fuzz/issues/84)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:12:50 +00:00
Kuba Brecka
4a7eeb4052 Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizes
Sometimes, llvm-symbolizer gives wrong results due to incorrect sizes of some symbols. The reason for that was an incorrectly sorted array in computeSymbolSizes. The comparison function used subtraction of unsigned types, which is incorrect. Let's change this to return explicit -1 or 1.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287028 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:07:03 +00:00
Tim Northover
7e53cdde40 GlobalISel: remove unused variable to silence warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:06:07 +00:00
Tim Northover
3b2bb1a2bc llvm-objdump: deal with unexpected object files more gracefully.
Specifically, we don't want to segfault on release builds, so print the problem
instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 20:26:01 +00:00
Matt Arsenault
7036e8dad1 AMDGPU: Enable store clustering
Also respect the TII hook for these like the generic code does
in case we want a flag later to disable this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287021 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 20:22:55 +00:00
Haicheng Wu
4436dc3b23 [AArch64] Lower multiplication by a constant int to shl+add+shl
Lower a = b * C where C = (2^n + 1) * 2^m to

add     w0, w0, w0, lsl n
lsl     w0, w0, m

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 20:16:48 +00:00
Matt Arsenault
339cf19d8c AMDGPU: Analyze mubuf with immediate soffset
Fixes giving up on clustering common addr64 accesses with
constant 0 soffset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 20:14:27 +00:00
Matt Arsenault
123bf00b81 AMDGPU: Fix return after else
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287015 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:58:54 +00:00
Wei Mi
a96c2c70b0 Revert r286999 which caused buildbot test failures. Some testcases need to be made target specific.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:42:05 +00:00
Matt Arsenault
7946b1057f AMDGPU: Replace assert(false) with unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287013 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:34:37 +00:00
Davide Italiano
4e7cf47168 [ELF] Rewrite isMips64EL() using isMipsELF64(). NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:15:18 +00:00
Stanislav Mekhanoshin
79f84ef39d [AMDGPU] Add wave barrier builtin
The wave barrier represents the discardable barrier. Its main purpose is to
carry convergent attribute, thus preventing illegal CFG optimizations. All lanes
in a wave come to convergence point simultaneously with SIMT, thus no special
instruction is needed in the ISA. The barrier is discarded during code generation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:00:15 +00:00
Sanjay Patel
1b2455de46 [x86] auto-generate checks; NFC
Also, fix the test params to use an attribute rather than a CPU model
and remove the AVX run because that does nothing but check for a 'v'
prefix in all of these tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 18:44:53 +00:00
Wei Mi
6c7170194a [LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop.
In RateRegister of existing LSR, if a formula contains a Reg which is a SCEVAddRecExpr,
and this SCEVAddRecExpr's loop is an outerloop, the formula will be marked as Loser
and dropped.

Suppose we have an IR that %for.body is outerloop and %for.body2 is innerloop. LSR only
handle inner loop now so only %for.body2 will be handled.

Using the logic above, formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) will be dropped
no matter what because reg({1,+, %size}<%for.body>) is a SCEVAddRecExpr type reg related
with outerloop. Only formula like
reg(%array) + 1*reg({{1,+, %size}<%for.body>,+,1}<nuw><nsw><%for.body2>) will be kept
because the SCEVAddRecExpr related with outerloop is folded into the initial value of the
SCEVAddRecExpr related with current loop.

But in some cases, we do need to share the basic induction variable
reg{0 ,+, 1}<%for.body2> among LSR Uses to reduce the final total number of induction
variables used by LSR, so we don't want to drop the formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) unconditionally.

From the existing comment, it tries to avoid considering multiple level loops at the same time.
However, existing LSR only handles innermost loop, so for any SCEVAddRecExpr with a loop other
than current loop, it is an invariant and will be simple to handle, and the formula doesn't have
to be dropped.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 18:35:53 +00:00
Pawel Bylica
93f763c0e2 Integer legalization: fix MUL expansion
Summary:
This fixes the runtime results produces by the fallback multiplication expansion introduced in r270720.

For tests I created a fuzz tester that compares the results with Boost.Multiprecision.

Reviewers: hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 18:29:24 +00:00
Zaara Syeda
34888b1f1a vector load store with length (left justified) llvm portion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 17:54:19 +00:00
Sanjay Patel
8ce3284288 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286989 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 17:47:13 +00:00
Wei Mi
334f714ef9 [IndVars] Change the order to compute WidenAddRec in widenIVUse.
When both WidenIV::getWideRecurrence and WidenIV::getExtendedOperandRecurrence
return non-null but different WideAddRec, if getWideRecurrence is called
before getExtendedOperandRecurrence, we won't bother to call
getExtendedOperandRecurrence again. But As we know it is possible that after
SCEV folding, we cannot prove the legality using the SCEVAddRecExpr returned
by getWideRecurrence. Meanwhile if getExtendedOperandRecurrence returns non-null
WideAddRec, we know for sure that it is legal to do widening for current instruction.
So it is better to put getExtendedOperandRecurrence before getWideRecurrence, which
will increase the chance of successful widening.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 17:34:52 +00:00
Diana Picus
2e14486c47 [ARM] GlobalISel: Remove unused members. NFCI
This silences some warnings that I didn't see with my host compiler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 16:42:10 +00:00
Craig Topper
5c8c06592a [AVX-512] Add AVX-512 vector shift intrinsics to memory santitizer.
Just needed to add the intrinsics to the exist switch. The code is generic enough to support the wider vectors with no changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 16:27:33 +00:00
Simon Pilgrim
5ecd47336f [X86][SSE] Improve SINT_TO_FP of boolean vector results (signum)
This patch helps avoids poor legalization of boolean vector results (e.g. 8f32 -> 8i1 -> 8i16) that feed into SINT_TO_FP by inserting an early SIGN_EXTEND and so help improve the truncation logic.

This is not necessary for AVX512 targets where boolean vectors are legal - AVX512 manages to lower ( sint_to_fp vXi1 ) into some form of ( select mask, 1.0f , 0.0f ) in most cases.

Fix for PR13248

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286979 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 16:24:40 +00:00
Sanjay Patel
33942aedc5 [InstCombine] add tests for bitcasted selects; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 16:01:16 +00:00
Pablo Barrio
31e986bef3 Revert "[JumpThreading] Unfold selects that depend on the same condition"
This reverts commit ac54d0066c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 15:42:23 +00:00