Commit Graph

141634 Commits

Author SHA1 Message Date
Rong Xu
e72670cb54 [PGO] Fix PGO use ICE when there are unreachable BBs
For -O0 there might be unreachable BBs, which breaks the assumption that all the
BBs have an auxiliary data structure.  In this patch, we add another interface
called findBBInfo() so that a nullptr can be returned for the unreachable BBs
(and the callers can ignore those BBs).

This fixes the bug reported
https://llvm.org/bugs/show_bug.cgi?id=31209

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288528 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 19:10:29 +00:00
Ulrich Weigand
49c2555361 [SystemZ] Support remaining atomic instructions
Add assembler support for all atomic instructions that weren't already
supported.  Some of those could be used to implement codegen for 128-bit
atomic operations, but this isn't done here yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 18:24:16 +00:00
Ulrich Weigand
4b7476c294 [SystemZ] Support floating-point control register instructions
Add assembler support for instructions manipulating the FPC.

Also add codegen support via the GCC compatibility builtins:
  __builtin_s390_sfpc
  __builtin_s390_efpc



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288525 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 18:21:53 +00:00
Ulrich Weigand
1f697f43c9 [SystemZ] Refactor hasSideEffects setting
Move setting of hasSideEffects out of SystemZInstrFormats.td,
to allow use of the format classes for instructions where this
flag shouldn't be set.  NFC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 18:19:22 +00:00
Matt Arsenault
76a17e03e0 AMDGPU: Implement isCheapAddrSpaceCast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 18:12:53 +00:00
Sanjay Patel
2fbac671c1 [x86] add common check prefix to reduce duplication; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:58:26 +00:00
Adam Nemet
55f24b0567 [LTOs] Allow generation of hotness information
The flag is passed by the clang driver.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:53:56 +00:00
Adam Nemet
371623998c Make LTO opt-remarks tests matching stricter
This ensures that we don't generate the hotness attribute by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:53:49 +00:00
Sanjay Patel
b65cc896d9 fix check-label
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:50:14 +00:00
Sanjay Patel
0acff68bfd [x86] add tests to show missing demanded bits analysis; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:48:48 +00:00
Simon Pilgrim
88afddf69a [InstCombine] Add vector urem tests
Demonstrate missed opportunity for urem -> and combine for powerof2 or zero non-uniform constant dividers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:16:21 +00:00
Simon Pilgrim
d2c7981604 [InstCombine] Regenerate vector srem tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 17:12:56 +00:00
Renato Golin
66e793d0de Revert "[SLP] Fix for PR6246: vectorization for scalar ops on vector elements."
This reverts commit r288497, as it broke the AArch64 build of Compiler-RT's
builtins (twice: once in r288412 and once in r288497). We should investigate
this offline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 16:56:26 +00:00
Nicolai Haehnle
42285f5cb7 [DAGCombiner] do not fold (fmul (fadd X, 1), Y) -> (fmad X, Y, Y) by default
Summary:
When X = 0 and Y = inf, the original code produces inf, but the transformed
code produces nan. So this transform (and its relatives) should only be
used when the no-infs-fp-math flag is explicitly enabled.

Also disable the transform using fmad (intermediate rounding) when unsafe-math
is not enabled, since it can reduce the precision of the result; consider this
example with binary floating point numbers with two bits of mantissa:

  x = 1.01
  y = 111

  x * (y + 1) = 1.01 * 1000 = 1010 (this is the exact result; no rounding occurs at any step)

  x * y + x = 1000.11 + 1.01 =r 1000 + 1.01 = 1001.01 =r 1000 (with rounding towards zero)

The example relies on rounding towards zero at least in the second step.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98578

Reviewers: RKSimon, tstellarAMD, spatel, arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 16:06:18 +00:00
Simon Pilgrim
7ac6b09c0f Tidyup code with indentation and clang-format. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 15:44:30 +00:00
Daniel Cederman
1832d9a947 [Sparc] Fix parsing of double-precision %f18, %f20, and %f22
Summary: They are currently being parsed as %f14, %f16, and %f18.

Reviewers: venkatra, jyknight

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 15:05:26 +00:00
Simon Pilgrim
3be9b42b56 [X86][SSE] Renamed shuffle combine test.
We're trying to combine to vpunpckhbw not vpunpckhwd

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 14:43:39 +00:00
Teresa Johnson
a74d10f3f6 CODE_OWNERS: Take ownership of IR Linker as discussed on llvm-dev
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288500 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 14:06:53 +00:00
Simon Pilgrim
5b129466c2 [X86][SSE] Add support for extracting constant bit data from broadcasted constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 13:16:08 +00:00
Alexey Bataev
a985f0f28e [SLP] Fix for PR6246: vectorization for scalar ops on vector elements.
When trying to vectorize trees that start at insertelement instructions
function tryToVectorizeList() uses vectorization factor calculated as
MinVecRegSize/ScalarTypeSize. But sometimes it does not work as tree
cost for this fixed vectorization factor is too high.
Patch tries to improve the situation. It tries different vectorization
factors from max(PowerOf2Floor(NumberOfVectorizedValues),
MinVecRegSize/ScalarTypeSize) to MinVecRegSize/ScalarTypeSize and tries
to choose the best one.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288497 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 12:20:22 +00:00
Simon Pilgrim
3feaca6736 [X86] Refactored getTargetConstantBitsFromNode to allow for expansion. NFCI.
getTargetConstantBitsFromNode currently only extracts constant pool vector data, but it will need to be generalized to support broadcast and scalar constant pool data as well.

Converted Constant bit extraction and Bitset splitting to helper lambda functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 11:58:05 +00:00
Simon Pilgrim
f0760b2c4c [SLPVectorizer][X86] Add tests for vectorization of buildvector of scalar fp-ops (PR6246)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288492 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 10:54:46 +00:00
Craig Topper
1244527f8c [AVX-512] Add EVEX vpshuflw/vpshufhw/vpshufd instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 07:57:11 +00:00
Craig Topper
9c40e33b57 [AVX-512] Add EVEX PSHUFB instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 07:06:30 +00:00
Craig Topper
579edc5817 [AVX-512] Add masked VINSERTF/VINSERTI instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 06:24:38 +00:00
Peter Collingbourne
a705e0edef IR: Move NumElements field from {Array,Vector}Type to SequentialType.
Now that PointerType is no longer a SequentialType, all SequentialTypes
have an associated number of elements, so we can move that information to
the base class, allowing for a number of simplifications.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 03:20:58 +00:00
Dehao Chen
2a9507e648 Change LoopUnrollPass cost from int to unsigned to make it consistent. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 03:17:07 +00:00
Peter Collingbourne
9c9ec72b63 IR: Change PointerType to derive from Type rather than SequentialType.
As proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/106640.html

This is for a couple of reasons:

- Values of type PointerType are unlike the other SequentialTypes (arrays
  and vectors) in that they do not hold values of the element type. By moving
  PointerType we can unify certain aspects of how the other SequentialTypes
  are handled.
- PointerType will have no place in the SequentialType hierarchy once
  pointee types are removed, so this is a necessary step towards removing
  pointee types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 03:05:41 +00:00
Peter Collingbourne
f5bbb38c1a Fix GlobalISel build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 02:55:30 +00:00
Matt Arsenault
749e583e8c ConstantFolding: Factor code into helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 02:26:02 +00:00
Peter Collingbourne
06115803f9 IR: Change the gep_type_iterator API to avoid always exposing the "current" type.
Instead, expose whether the current type is an array or a struct, if an array
what the upper bound is, and if a struct the struct type itself. This is
in preparation for a later change which will make PointerType derive from
Type rather than SequentialType.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 02:24:42 +00:00
Paul Robinson
89cbbcf86d [DWARF] Put linkage-name on abstract origin even when there's a declaration.
In r266692, we made it possible to emit linkage names for just inlined
functions, putting the attribute on the abstract origin. Make sure we
don't think the linkage-name was already emitted on a declaration.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 01:55:17 +00:00
Teresa Johnson
7d2e3aa58e [ThinLTO] Stop importing constant global vars as copies in the backend
Summary:
We were doing an optimization in the ThinLTO backends of importing
constant unnamed_addr globals unconditionally as a local copy (regardless
of whether the thin link decided to import them). This should be done in
the thin link instead, so that resulting exported references are marked
and promoted appropriately, but will need a summary enhancement to mark
these variables as constant unnamed_addr.

The function import logic during the thin link was trying to handle
this proactively, by conservatively marking all values referenced in
the initializer lists of exported global variables as also exported.
However, this only handled values referenced directly from the
initializer list of an exported global variable. If the value is itself
a constant unnamed_addr variable, we could end up exporting its
references as well. This caused multiple issues. The first is that the
transitively exported references weren't promoted. Secondly, some could
not be promoted/renamed (e.g. they had a section or other constraint).
recursively, instead of just adding the first level of initializer list
references to the ExportList directly.

Remove this optimization and the associated handling in the function
import backend. SPEC measurements indicate we weren't getting much
from it in any case.

Fixes PR31052.

Reviewers: mehdi_amini

Subscribers: krasin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 01:02:30 +00:00
Matt Arsenault
2d19570610 AMDGPU: Use wider scalar spills for SGPR spilling
Since the spill is for the whole wave, these
don't have the swizzling problems that vector stores do
and a single 4-byte allocation is enough to spill a 64 element
register. This should reduce the number of spill instructions and
put all the spills for a register in the same cacheline.

This should save allocated private size, but for now it doesn't.
The extra slots are allocated for each component, but never used
because the frame layout is essentially finalized before frame
indices are replaced. For always using the scalar store path,
this should probably be moved into processFunctionBeforeFrameFinalized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 00:54:45 +00:00
Wolfgang Pieb
40c40efab9 When instructions are hoisted out of loops by MachineLICM, remove their debug loc.
This prevents erratic stepping behavior as well as incorrect source attribution
for sample profiling.

Reviewers: dblakie

Subscribers: llvm-commit

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 00:37:57 +00:00
Justin Bogner
d937b699b8 SDAG: Avoid a large, usually empty SmallVector in a recursive function
This SmallVector is using up 128 bytes on the stack every time despite
almost always being empty[1], and since this function can recurse quite
deeply that adds up to a lot of overhead. We've seen this run afoul of
ulimits in some cases with ASAN on.

Replacing the SmallVector with a std::vector trades an occasional heap
allocation for vastly less stack usage.

[1]: I gathered some stats on an internal test suite and the vector
was non-empty in only 45,000 of 10,000,000 calls to this function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 00:11:01 +00:00
Geoff Berry
c7cf225724 [AArch64] Fold more spilled/refilled COPYs.
Summary:
Make AArch64InstrInfo::foldMemoryOperandImpl more general by folding all
full COPYs between register classes of the same size that are either
spilled or refilled.

Reviewers: MatzeB, qcolombet

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 23:43:55 +00:00
Dan Gohman
14b34deb68 [MC] Refactor emitELFSize to make usage more consistent. NFC.
Move the cast<MCSymbolELF> inside emitELFSize, so that: 
 - it's done in one place instead of at each call
 - it's more consistent with similar functions like EmitCOFFSafeSEH
 - ambiguity between cast<> and dyn_cast<> is avoided (which also
   eliminates an unnecessary dyn_cast call)

This also makes it easier to experiment with using ".size" directives on
non-ELF targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 23:39:08 +00:00
Peter Collingbourne
a11b564b77 llvm-modextract: Call keep() on the output stream before exiting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 23:13:11 +00:00
Oleg Ranevskyy
c31c930cdf [ARM] Fix for 64-bit CAS expansion on ARM32 with -O0
Summary:
This patch fixes comparison of 64-bit atomic with its expected value in CMP_SWAP_64 expansion.

Currently, the low words are compared with CMP, while the high words are compared with SBC. SBC expects the carry flag to be set if CMP detects a difference. CMP might leave the carry unset for unequal arguments though if the first one is >= than the second. This might cause the comparison logic to detect false equality.

Example of the broken C++ code:
```
std::atomic<long long> at(2);

long long ll = 1;
std::atomic_compare_exchange_strong(&at, &ll, 3);
```
Even though the atomic `at` and the expected value `ll` are not equal and `atomic_compare_exchange_strong` returns `false`, `at` is changed to 3.

The patch replaces SBC with CMPEQ.

Reviewers: t.p.northover

Subscribers: aemerson, rengolin, llvm-commits, asl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:58:35 +00:00
Artem Belevich
bc5dae7253 Revert "[SLP] Fix for PR6246: vectorization for scalar ops on vector elements."
This reverts r288412 which causes severe compile-time regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:52:15 +00:00
Matthias Braun
c139fdb8e4 RegisterCoalscer: Only coalesce complete reserved registers.
The coalescer eliminates copies from reserved registers of the form:
   %vregX = COPY %rY
in the case where %rY is a reserved register. However this turns out to
be invalid if only some of the subregisters are reserved (see also
https://reviews.llvm.org/D26648).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:39:51 +00:00
Eugene Zelenko
1750ec944f Fix broken buildbots because of r288424 (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:26:55 +00:00
Eugene Zelenko
9ed0c7a3a9 [ADT, Support, TableGen] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:13:24 +00:00
David Blaikie
2af4e8b52a [dsymutil] Simplify a lazy-init condition/expression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 22:04:16 +00:00
David Blaikie
e348b776d1 [debug info] Minor cleanup from D27170/r288399
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 21:59:09 +00:00
Chih-Hung Hsieh
bc7dc480be [SelectionDAG] getRawSubclassData should not return HasDebugValue.
This change fixes a regression in r279537 and
makes getRawSubclassData behave like r279536.
Without this change, the fp128-g.ll test case will have an
infinite loop involving SoftenFloatRes_LOAD.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 21:56:33 +00:00
Tim Northover
f01615356a AArch64: fix 128-bit cmpxchg at -O0 (again, again).
This time the issue is fortunately just a simple mistake rather than a horrible
design spectre. I thought SUBS/SBCS provided sufficient NZCV flags for
comparing two 64-bit values, but they don't.

The fix is slightly clunkier in AArch64 because we can't use conditional
execution to emit a pair of CMPs. Traditionally an "icmp ne i128" would map to
an EOR/EOR/ORR/CBNZ, but that uses more registers so it's easier to go with a
CSET/CINC/CBNZ combination. Slightly less efficient, but this is -O0 anyway.

Thanks to Anton Korobeynikov for pointing out the issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 21:31:59 +00:00
Mehdi Amini
963225ef0f Improve documentation on MSVC workaround for AlignedCharArray (NFC)
The comment only mentioned "old version of MSVC".

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 20:54:29 +00:00
Benjamin Kramer
b5626bf5c1 Fix unused variable warning in Release builds. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 20:49:34 +00:00