6 years agoFix `llvm-config` to adapt to the install environment.
Richard Diamond [Mon, 9 Nov 2015 23:15:38 +0000 (23:15 +0000)]
Fix `llvm-config` to adapt to the install environment.

This patch does a couple of things:

  - Adds a new argument `--shared-mode` which accepts a list of components and prints whether or not the provided components need to be linked statically or shared.
  - Fixes `--libnames` when CMake BUILD_SHARED_LIBS is used.
  - Fixes `--libnames`, `--libs`, and `--libfiles` for dylib when static components aren't installed.
  - Fixes `--libnames`, `--libs`, `--libfiles`, and `--components` to use LLVM_DYLIB_COMPONENTS as the component manifest for dylib linking.
  - Uses the host platform's usual convention for filename extensions and such, instead of always defaulting to Unix-izms.

Because I don't own a Mac, I am not able to test the Mac platform dependent stuff locally. If someone would be willing to run a build for me on their machine (unless there's a better option), I'd appreciate it.

Reviewers: jfb, brad.king, whitequark, beanz

Subscribers: beanz, jauhien, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252532 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCombine ifdefs around dl_iterate_phdr in Unix/Signals.inc
Reid Kleckner [Mon, 9 Nov 2015 23:10:29 +0000 (23:10 +0000)]
Combine ifdefs around dl_iterate_phdr in Unix/Signals.inc

This avoids the need to have two dummy implementations of

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252531 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Don't emit CATCHRET from visitCatchPad
David Majnemer [Mon, 9 Nov 2015 23:07:48 +0000 (23:07 +0000)]
[WinEH] Don't emit CATCHRET from visitCatchPad

Instead, emit a CATCHPAD node which will get selected to a target
specific sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252528 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDeprecate Autoconf
Chris Bieneman [Mon, 9 Nov 2015 21:54:55 +0000 (21:54 +0000)]
Deprecate Autoconf

As per the very positive feedback from llvm-dev (http://lists.llvm.org/pipermail/llvm-dev/2015-November/092150.html), this commit officially deprecates the LLVM autoconf-based build system.

Anyone still using it should switch to CMake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252520 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agospecify triple so Windows bots won't be sad
Sanjay Patel [Mon, 9 Nov 2015 21:53:58 +0000 (21:53 +0000)]
specify triple so Windows bots won't be sad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252519 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd templated read/write to support::endian.
Rafael Espindola [Mon, 9 Nov 2015 21:34:45 +0000 (21:34 +0000)]
Add templated read/write to support::endian.

Expose read and write functions that take endianess as a template

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252517 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] try harder to match bitwise 'or' into an LEA
Sanjay Patel [Mon, 9 Nov 2015 21:16:49 +0000 (21:16 +0000)]
[x86] try harder to match bitwise 'or' into an LEA

The motivation for this patch starts with the epic fail example in PR18007:

...unfortunately, this patch makes no difference for that case, but it solves some
simpler cases. We'll get there some day. :)

The current 'or' matching code was using computeKnownBits() via
isBaseWithConstantOffset() -> MaskedValueIsZero(), but that's an unnecessarily limited use.
We can do more by copying the logic in ValueTracking's haveNoCommonBitsSet(), so we can
treat the 'or' as if it was an 'add'.

There's a TODO comment here because we should lift the bit-checking logic into a helper
function, so it's not duplicated in DAGCombiner.

An example of the better LEA matching:

leal (%rdi,%rdi), %eax
andl $1, %esi
orl %esi, %eax


andl $1, %esi
leal (%rsi,%rdi,2), %eax

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252515 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Separating statement to match what clang-format would do.
Colin LeMahieu [Mon, 9 Nov 2015 21:06:28 +0000 (21:06 +0000)]
[Hexagon] Separating statement to match what clang-format would do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252513 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Tweak funclet prologue/epilogue insertion to pass verifier
Reid Kleckner [Mon, 9 Nov 2015 21:04:00 +0000 (21:04 +0000)]
[WinEH] Tweak funclet prologue/epilogue insertion to pass verifier

For some reason we'd never run MachineVerifier on WinEH code, and you
explicitly have to ask for it with llc. I added it to a few test cases
to get some coverage.

Fixes PR25461.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252512 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Re-committing r252249 (Clone funclets with multiple parents) with additional...
Andrew Kaylor [Mon, 9 Nov 2015 19:59:02 +0000 (19:59 +0000)]
[WinEH] Re-committing r252249 (Clone funclets with multiple parents) with additional fixes for determinism problems

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252508 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fix -Wmicrosoft-enum-value warning with explicit enum type
Reid Kleckner [Mon, 9 Nov 2015 19:44:38 +0000 (19:44 +0000)]
[Hexagon] Fix -Wmicrosoft-enum-value warning with explicit enum type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252505 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoWindows-specific test for sys::path::remove_dots.
Mike Aizatsky [Mon, 9 Nov 2015 19:36:53 +0000 (19:36 +0000)]
Windows-specific test for sys::path::remove_dots.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252504 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agodon't repeat function names in comments; NFC
Sanjay Patel [Mon, 9 Nov 2015 19:18:26 +0000 (19:18 +0000)]
don't repeat function names in comments; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252502 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agofix formatting; NFC
Sanjay Patel [Mon, 9 Nov 2015 18:59:30 +0000 (18:59 +0000)]
fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252500 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMoving FileManager::removeDotPaths to llvm::sys::path::remove_dots
Mike Aizatsky [Mon, 9 Nov 2015 18:56:31 +0000 (18:56 +0000)]
Moving FileManager::removeDotPaths to llvm::sys::path::remove_dots

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252499 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[sanitizer] Use same shadow offset for ASAN on aarch64
Adhemerval Zanella [Mon, 9 Nov 2015 18:03:48 +0000 (18:03 +0000)]
[sanitizer] Use same shadow offset for ASAN on aarch64

This patch makes ASAN for aarch64 use the same shadow offset for all
currently supported VMAs (39 and 42 bits).  The shadow offset is the
same for 39-bit (36).  Similar to ppc64 port, aarch64 transformation
also requires to use an add instead of 'or' for 42-bit VMA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252495 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd discriminators for call instructions that are from the same line and same basic...
Dehao Chen [Mon, 9 Nov 2015 17:30:38 +0000 (17:30 +0000)]
Add discriminators for call instructions that are from the same line and same basic block.

Summary: Call instructions that are from the same line and same basic block needs to have separate discriminators to distinguish between different callsites.

Reviewers: davidxl, dnovillo, dblaikie

Subscribers: dblaikie, probinson, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252492 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSimplify. NFC.
Chad Rosier [Mon, 9 Nov 2015 16:56:06 +0000 (16:56 +0000)]
Simplify. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252491 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoGlobalOpt should maintain externally_initialized when splitting aggregates
Oliver Stannard [Mon, 9 Nov 2015 16:47:16 +0000 (16:47 +0000)]
GlobalOpt should maintain externally_initialized when splitting aggregates

When GlobalOpt splits an internal, global variable with an aggregate type, it
should propagate the externally_initialized flag to the newly created globals.

This makes the pass safe for our downstream use of this flag, while still
allowing some useful optimisations (such as removing dead parts of the split
aggregate) to be performed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252490 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCreate Makefile variables for 'share' and 'libexec'
Jonathan Roelofs [Mon, 9 Nov 2015 16:10:00 +0000 (16:10 +0000)]
Create Makefile variables for 'share' and 'libexec'

in preparation for a Clang commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252473 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LoopVectorize] Address post-commit feedback on r250032
James Molloy [Mon, 9 Nov 2015 14:32:05 +0000 (14:32 +0000)]
[LoopVectorize] Address post-commit feedback on r250032

Implemented as many of Michael's suggestions as were possible:
  * clang-format the added code while it is still fresh.
  * tried to change Value* to Instruction* in many places in computeMinimumValueSizes - unfortunately there are several places where Constants need to be handled so this wasn't possible.
  * Reduce the pass list on loop-vectorization-factors.ll.
  * Fix a bug where we were querying MinBWs for I->getOperand(0) but using MinBWs[I].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252469 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAllow LLE/LD and the loop versioning infrastructure to use SCEV predicates
Silviu Baranga [Mon, 9 Nov 2015 13:26:09 +0000 (13:26 +0000)]
Allow LLE/LD and the loop versioning infrastructure to use SCEV predicates

LAA currently generates a set of SCEV predicates that must be checked by users.
In the case of Loop Distribute/Loop Load Elimination, no such predicates could have
been emitted, since we don't allow stride versioning. However, in the future there
could be SCEV predicates that will need to be checked.

This change adds support for SCEV predicate versioning in the Loop Distribute, Loop
Load Eliminate and the loop versioning infrastructure.

Reviewers: anemet

Subscribers: mssimpso, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252467 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Add UABDL patterns for log2 shuffle.
Charlie Turner [Mon, 9 Nov 2015 13:10:52 +0000 (13:10 +0000)]
[AArch64] Add UABDL patterns for log2 shuffle.

This matches the sum-of-absdiff patterns emitted by the vectoriser using log2 shuffles.

Relies on D14207 to be able to match the `extract_subvector(..., 0)`

Reviewers: t.p.northover, jmolloy

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252465 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Handle extract_subvector(..., 0) in ISel.
Charlie Turner [Mon, 9 Nov 2015 12:45:11 +0000 (12:45 +0000)]
[AArch64] Handle extract_subvector(..., 0) in ISel.

Lowering this pattern early to an `EXTRACT_SUBREG` was making it impossible to match larger patterns in tblgen that use `extract_subvector(..., 0)` as part of the their input pattern.

It seems like there will exist somewhere a better way of specifying this pattern over all relevant register value types, but I didn't manage to find it.

Reviewers: t.p.northover, jmolloy

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252464 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[EABI] Add LLVM support for -meabi flag
Renato Golin [Mon, 9 Nov 2015 12:40:30 +0000 (12:40 +0000)]
[EABI] Add LLVM support for -meabi flag

"GCC requires the freestanding environment provide memcpy, memmove, memset
and memcmp": https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Standards.html

Hence in GNUEABI targets LLVM should not convert 'memops' to their equivalent
'__aeabi_memops'. This convertion violates GCC contract.

The -meabi flag controls whether or not LLVM will modify 'memops' in GNUEABI

Without -meabi: use the triple default EABI.
With -meabi=default: use the triple default EABI.
With -meabi=gnu: use 'memops'.
With -meabi=4 or -meabi=5: use '__aeabi_memops'.
With -meabi set to an unknown value: same as -meabi=default.

Patch by Vinicius Tinti.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252462 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[ARM] Combine CMOV into BFI where possible"
Renato Golin [Mon, 9 Nov 2015 12:19:10 +0000 (12:19 +0000)]
Revert "[ARM] Combine CMOV into BFI where possible"

This reverts commit r252057, as it broke ARM self-hosting buildbots, probably
due to a code-gen fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252460 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Always promote f16 if not legal
Oliver Stannard [Mon, 9 Nov 2015 11:03:18 +0000 (11:03 +0000)]
[CodeGen] Always promote f16 if not legal

We don't currently have any runtime library functions for operations on
f16 values (other than conversions to and from f32 and f64), so we
should always promote it to f32, even if that is not a legal type. In
that case, the f32 values would be softened to f32 library calls.

SoftenFloatRes_FP_EXTEND now needs to check the promoted operand's type,
as it may ne a no-op or require a different library call.

getCopyFromParts and getCopyToParts now need to cope with a
floating-point value stored in a larger integer part, as is the case for
any target that needs to store an f16 value in a 32-bit integer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252459 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Adding override to methods.
Colin LeMahieu [Mon, 9 Nov 2015 07:10:24 +0000 (07:10 +0000)]
[Hexagon] Adding override to methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252453 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Removing XFAIL on Hexagon target.
Colin LeMahieu [Mon, 9 Nov 2015 06:15:55 +0000 (06:15 +0000)]
[Hexagon] Removing XFAIL on Hexagon target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252450 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fixing warnings.
Colin LeMahieu [Mon, 9 Nov 2015 05:47:56 +0000 (05:47 +0000)]
[Hexagon] Fixing warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252448 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Removing extra gen line.
Colin LeMahieu [Mon, 9 Nov 2015 05:31:39 +0000 (05:31 +0000)]
[Hexagon] Removing extra gen line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252447 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Maybe the makefile?
Colin LeMahieu [Mon, 9 Nov 2015 05:16:08 +0000 (05:16 +0000)]
[Hexagon] Maybe the makefile?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252446 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Adding LLVMBuild.txt reference to HexagonAsmParser.
Colin LeMahieu [Mon, 9 Nov 2015 04:31:02 +0000 (04:31 +0000)]
[Hexagon] Adding LLVMBuild.txt reference to HexagonAsmParser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252444 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Enabling ASM parsing on Hexagon backend and adding instruction parsing...
Colin LeMahieu [Mon, 9 Nov 2015 04:07:48 +0000 (04:07 +0000)]
[Hexagon] Enabling ASM parsing on Hexagon backend and adding instruction parsing tests.  General updating of the code emission.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252443 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd a method to the BitcodeReader to parse only the identification block
Mehdi Amini [Mon, 9 Nov 2015 02:46:41 +0000 (02:46 +0000)]
Add a method to the BitcodeReader to parse only the identification block

Summary: Mimic parseTriple(); and exposes it to LTOModule.cpp

Reviewers: dexonsmith, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252442 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Generalize matching for grammars without mnemonic-lead statements
Colin LeMahieu [Mon, 9 Nov 2015 00:46:46 +0000 (00:46 +0000)]
[AsmParser] Generalize matching for grammars without mnemonic-lead statements

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252440 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Backends can parameterize ASM tokenization.
Colin LeMahieu [Mon, 9 Nov 2015 00:31:07 +0000 (00:31 +0000)]
[AsmParser] Backends can parameterize ASM tokenization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252439 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Provide target direct access to mnemonic token. Allow assignment parsing...
Colin LeMahieu [Mon, 9 Nov 2015 00:15:45 +0000 (00:15 +0000)]
[AsmParser] Provide target direct access to mnemonic token.  Allow assignment parsing to be hooked by target.  Allow target to specify if identifier is a label.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252435 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PGO] Instr func name var creation code refactoring
Xinliang David Li [Mon, 9 Nov 2015 00:01:22 +0000 (00:01 +0000)]
[PGO]  Instr func name var creation code refactoring

Move the code from cfe to LLMV and become shared interfaces.
There is no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252433 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Allow tokens to be put back in to the token stream.
Colin LeMahieu [Sun, 8 Nov 2015 23:48:23 +0000 (23:48 +0000)]
[AsmParser] Allow tokens to be put back in to the token stream.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252432 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RuntimeDyld] Add support for R_X86_64_PC8 relocation.
Maksim Panchenko [Sun, 8 Nov 2015 19:34:17 +0000 (19:34 +0000)]
[RuntimeDyld] Add support for R_X86_64_PC8 relocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252423 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAppease hosts without HAVE_BACKTRACE nor ENABLE_BACKTRACES.
NAKAMURA Takumi [Sun, 8 Nov 2015 09:45:06 +0000 (09:45 +0000)]

  llvm/lib/Support/Signals.cpp:66:13: warning: unused function 'printSymbolizedStackTrace' [-Wunused-function]
  llvm/lib/Support/Signals.cpp:52:13: warning: function 'findModulesAndOffsets' has internal linkage but is not defined [-Wundefined-internal]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252418 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Fix LoopPreIncPrep not to depend on SCEV constant simplifications
Hal Finkel [Sun, 8 Nov 2015 08:04:40 +0000 (08:04 +0000)]
[PowerPC] Fix LoopPreIncPrep not to depend on SCEV constant simplifications

Under most circumstances, if SCEV can simplify X-Y to a constant, then it can
also simplify Y-X to a constant. However, there is no guarantee that this is
always true, and concensus is not to consider that a correctness bug in SCEV
(although it is undesirable).

PPCLoopPreIncPrep gathers pointers used to access memory (via loads, stores and
prefetches) into buckets, where in each bucket the relative pointer offsets are
constant. We used to keep each bucket as a multimap, where SCEV's subtraction
operation was used to define the ordering predicate. Instead, use a fixed SCEV
base expression for each bucket, record the constant offsets from that base
expression, and adjust it later, if desirable, once all pointers have been

Doing it this way should be more compile-time efficient than the previous
scheme (in addition to making the implementation less sensitive to SCEV
simplification quirks).

Fixes PR25170.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252417 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LoopStrengthReduce] Don't bother fixing up PHIs from EH Pad preds
David Majnemer [Sun, 8 Nov 2015 05:04:07 +0000 (05:04 +0000)]
[LoopStrengthReduce] Don't bother fixing up PHIs from EH Pad preds

We cannot really insert fixup code into a PHI's predecessor.

This fixes PR25445.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252416 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake bugpoint ehpad/token friendly
David Majnemer [Sun, 8 Nov 2015 04:16:12 +0000 (04:16 +0000)]
Make bugpoint ehpad/token friendly

Tokens shouldn't be blindly replaced with undef/null.  Also, don't try
to remove EH pad instructions from the top of basic blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252414 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Update PHIs of CATCHRET successors
David Majnemer [Sun, 8 Nov 2015 02:36:00 +0000 (02:36 +0000)]
[WinEH] Update PHIs of CATCHRET successors

The TailDuplication machine pass ran across a malformed CFG: a PHI node
referred it's predecessor's predecessor instead of it's predecessor.
This occurred because we split the edge in X86ISelLowering when we
processed the CATCHRET but forgot to do something about the PHI nodes.

This fixes PR25444.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252413 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoErase unused FunctionDIs variables after r252219.
Yaron Keren [Sat, 7 Nov 2015 10:21:25 +0000 (10:21 +0000)]
Erase unused FunctionDIs variables after r252219.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252401 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Bitcode] Add enums for call instruction markers and flags. NFC.
Akira Hatanaka [Sat, 7 Nov 2015 02:48:49 +0000 (02:48 +0000)]
[Bitcode] Add enums for call instruction markers and flags. NFC.

This commit adds enums in LLVMBitCodes.h to improve readability and
maintainability. This is a follow-up to r252368 which was discussed


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252395 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTry to fix build more -- like r252392 but for WebAssembly.
Nico Weber [Sat, 7 Nov 2015 02:47:31 +0000 (02:47 +0000)]
Try to fix build more -- like r252392 but for WebAssembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252394 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUnbreak the build
Sanjoy Das [Sat, 7 Nov 2015 02:26:53 +0000 (02:26 +0000)]
Unbreak the build

My code clashed with some ilist iterator changes upstream.  Fix by
adding an explicit "&*" coercion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252392 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FunctionAttrs] Add comment and clarify assertion message; NFC
Sanjoy Das [Sat, 7 Nov 2015 01:56:07 +0000 (01:56 +0000)]
[FunctionAttrs] Add comment and clarify assertion message; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252389 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OperandBundles] Rename accessor, NFC
Sanjoy Das [Sat, 7 Nov 2015 01:56:04 +0000 (01:56 +0000)]
[OperandBundles] Rename accessor, NFC

Rename getOperandBundle to getOperandBundleAt since that's more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252388 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FunctionAttrs] Add handling for operand bundles
Sanjoy Das [Sat, 7 Nov 2015 01:56:00 +0000 (01:56 +0000)]
[FunctionAttrs] Add handling for operand bundles

Teach the FunctionAttrs to do the right thing for IR with operand

Reviewers: reames, chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252387 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FunctionAttrs] Fix an iterator wraparound bug
Sanjoy Das [Sat, 7 Nov 2015 01:55:53 +0000 (01:55 +0000)]
[FunctionAttrs] Fix an iterator wraparound bug

This change fixes an iterator wraparound bug in

Ideally, ++'ing off the `end()` of an iplist should result in a failed
assert, but currently iplist seems to silently wrap to the head of the
list on `end()++`.  This is why the bad behavior is difficult to

Reviewers: chandlerc, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252386 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Update exception pointer registers
Joseph Tremoulet [Sat, 7 Nov 2015 01:11:31 +0000 (01:11 +0000)]
[WinEH] Update exception pointer registers

The CLR's personality routine passes these in rdx/edx, not rax/eax.

Make getExceptionPointerRegister a virtual method parameterized by
personality function to allow making this distinction.

Similarly make getExceptionSelectorRegister a virtual method parameterized
by personality function, for symmetry.

Reviewers: pgavlin, majnemer, rnk

Subscribers: jyknight, dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252383 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReapply "ADT: Require explicit ilist iterator/pointer conversions"
Duncan P. N. Exon Smith [Sat, 7 Nov 2015 00:59:29 +0000 (00:59 +0000)]
Reapply "ADT: Require explicit ilist iterator/pointer conversions"

This reverts commit r252373, reapplying r252372 now that I've updated
clang-tools-extra.  Original commit message follows.

ADT: Require explicit ilist iterator/pointer conversions

Disallow implicit conversions between ilist iterators and element
points.  Explicit conversions still work of course.

This is the first step toward removing the undefined behaviour in
`ilist` and `iplist`:

The motivation for removing the implicit iterators is that I came across
real bugs (that were *really* getting lucky).  More details and some
brief discussion later in that thread:

Note: if you have out-of-tree code, it should be fairly easy to revert
this patch downstream while you update your out-of-tree call sites.
Note that these conversions are occasionally latent bugs (that may
happen to "work" now, but only because of getting lucky with UB;
follow-ups will change your luck).  When they are valid, I suggest using
`->getIterator()` to go from pointer to iterator, and `&*` to go from
iterator to pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252380 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoexamples: Remove implicit ilist iterator conversions, NFC
Duncan P. N. Exon Smith [Sat, 7 Nov 2015 00:55:46 +0000 (00:55 +0000)]
examples: Remove implicit ilist iterator conversions, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252379 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Teach FoldPHIArgZextsIntoPHI about EHPads
David Majnemer [Sat, 7 Nov 2015 00:52:53 +0000 (00:52 +0000)]
[InstCombine] Teach FoldPHIArgZextsIntoPHI about EHPads

FoldPHIArgZextsIntoPHI cannot insert an instruction after the PHI if
there is an EHPad in the BB.  Doing so would result in an instruction
inserted after a terminator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252377 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "ADT: Require explicit ilist iterator/pointer conversions"
Duncan P. N. Exon Smith [Sat, 7 Nov 2015 00:09:14 +0000 (00:09 +0000)]
Revert "ADT: Require explicit ilist iterator/pointer conversions"

This reverts commit r252372.  Apparently I missed clang-tools-extra.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252373 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoADT: Require explicit ilist iterator/pointer conversions
Duncan P. N. Exon Smith [Sat, 7 Nov 2015 00:02:32 +0000 (00:02 +0000)]
ADT: Require explicit ilist iterator/pointer conversions

Disallow implicit conversions between ilist iterators and element
points.  Explicit conversions still work of course.

This is the first step toward removing the undefined behaviour in
`ilist` and `iplist`:

The motivation for removing the implicit iterators is that I came across
real bugs (that were *really* getting lucky).  More details and some
brief discussion later in that thread:

Note: if you have out-of-tree code, it should be fairly easy to revert
this patch downstream while you update your out-of-tree call sites.
Note that these conversions are occasionally latent bugs (that may
happen to "work" now, but only because of getting lucky with UB;
follow-ups will change your luck).  When they are valid, I suggest using
`->getIterator()` to go from pointer to iterator, and `&*` to go from
iterator to pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252372 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoADT: Remove last implicit ilist iterator conversions, NFC
Duncan P. N. Exon Smith [Sat, 7 Nov 2015 00:01:16 +0000 (00:01 +0000)]
ADT: Remove last implicit ilist iterator conversions, NFC

Some implicit ilist iterator conversions have crept back into Analysis,
Transforms, Hexagon, and llvm-stress.  This removes them.

I'll commit a patch immediately after this to disallow them (in a
separate patch so that it's easy to revert if necessary).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252371 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Don't insert an instruction after a terminator
David Majnemer [Fri, 6 Nov 2015 23:59:23 +0000 (23:59 +0000)]
[InstCombine] Don't insert an instruction after a terminator

We tried to insert a cast of a phi in a block whose terminator is an
EHPad.  This is invalid.  Do not attempt the transform in these

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252370 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd 'notail' marker for call instructions.
Akira Hatanaka [Fri, 6 Nov 2015 23:55:38 +0000 (23:55 +0000)]
Add 'notail' marker for call instructions.

This marker prevents optimization passes from adding 'tail' or
'musttail' markers to a call. Is is used to prevent tail call
optimization from being performed on the call.


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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252368 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r252366: [Support] Use GetTempDir to get the temporary dir path on Windows.
Pawel Bylica [Fri, 6 Nov 2015 23:44:23 +0000 (23:44 +0000)]
Revert r252366: [Support] Use GetTempDir to get the temporary dir path on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252367 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support] Use GetTempDir to get the temporary dir path on Windows.
Pawel Bylica [Fri, 6 Nov 2015 23:21:49 +0000 (23:21 +0000)]
[Support] Use GetTempDir to get the temporary dir path on Windows.

In general GetTempDir follows the same logic as the replaced code: checks env variables TMP, TEMP, USERPROFILE in order. However, it also perform other checks like making separators native (\), making the path absolute, etc.

This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables).

Reviewers: chapuni, rafael, aaron.ballman

Subscribers: rafael, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252366 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64][FastISel] Don't even try to select vector icmps.
Ahmed Bougacha [Fri, 6 Nov 2015 23:16:53 +0000 (23:16 +0000)]
[AArch64][FastISel] Don't even try to select vector icmps.

We used to try to constant-fold them to i32 immediates.
Given that fast-isel doesn't otherwise support vNi1, when selecting
the result users, we'd fallback to SDAG anyway.
However, if the users were in another block, we'd insert broken
cross-class copies (GPR32 to FPR64).

Give up, let SDAG agree with itself on a vNi1 legalization strategy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252364 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fold (trunc (i32 (zextload i16))) into vbroadcast.
Ahmed Bougacha [Fri, 6 Nov 2015 23:16:48 +0000 (23:16 +0000)]
[X86] Fold (trunc (i32 (zextload i16))) into vbroadcast.

When matching non-LSB-extracting truncating broadcasts, we now insert
the necessary SRL. If the scalar resulted from a load, the SRL will be
folded into it, creating a narrower, offset, load.

However, i16 loads aren't Desirable, so we get i16->i32 zextloads.
We already catch i16 aextloads; catch these as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252363 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] SRL non-LSB extracts when folding to truncating broadcasts.
Ahmed Bougacha [Fri, 6 Nov 2015 23:16:43 +0000 (23:16 +0000)]
[X86] SRL non-LSB extracts when folding to truncating broadcasts.

Now that we recognize this, we can support it instead of bailing out.
That is, we can fold:
  (v8i16 (shufflevector
    (v8i16 (bitcast (v4i32 (build_vector X, Y, ...)))),
  (v8i16 (vbroadcast (i16 (trunc (srl Y, 16)))))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252362 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Don't fold non-LSB extracts into truncating broadcasts.
Ahmed Bougacha [Fri, 6 Nov 2015 23:16:38 +0000 (23:16 +0000)]
[X86] Don't fold non-LSB extracts into truncating broadcasts.

We used to incorrectly assume that the offset we're extracting from
was a multiple of the element size. So, we'd fold:
  (v8i16 (shufflevector
    (v8i16 (bitcast (v4i32 (build_vector X, Y, ...)))),
  (v8i16 (vbroadcast (i16 (trunc Y))))
whereas we should have extracted the higher bits from X.

Instead, bail out if the assumption doesn't hold.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252361 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDAGCombiner: Check shouldReduceLoadWidth before combining (and (load), x) -> extload
Tom Stellard [Fri, 6 Nov 2015 21:58:37 +0000 (21:58 +0000)]
DAGCombiner: Check shouldReduceLoadWidth before combining (and (load), x) -> extload

Reviewers: resistor, arsenm

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252349 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Use more explicit types in testcases.
Dan Gohman [Fri, 6 Nov 2015 21:32:42 +0000 (21:32 +0000)]
[WebAssembly] Use more explicit types in testcases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252345 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Add more explicit pushes to the tests.
Dan Gohman [Fri, 6 Nov 2015 21:26:50 +0000 (21:26 +0000)]
[WebAssembly] Add more explicit pushes to the tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252344 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Don't RAUW tokens with undef
David Majnemer [Fri, 6 Nov 2015 21:26:32 +0000 (21:26 +0000)]
[InstCombine] Don't RAUW tokens with undef

Let SimplifyCFG remove unreachable BBs which define token instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252343 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SimplifyLibCalls] Don't hardcode the function name.
Davide Italiano [Fri, 6 Nov 2015 21:05:07 +0000 (21:05 +0000)]
[SimplifyLibCalls] Don't hardcode the function name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252342 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ShrinkWrapping] Teach shrink-wrapping how to analyze RegMask.
Quentin Colombet [Fri, 6 Nov 2015 21:00:13 +0000 (21:00 +0000)]
[ShrinkWrapping] Teach shrink-wrapping how to analyze RegMask.

Previously we were conservatively assuming that RegMask operands clobber
callee saved registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252341 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMachineScheduler: Add regpressure information to debug dump
Matthias Braun [Fri, 6 Nov 2015 20:59:02 +0000 (20:59 +0000)]
MachineScheduler: Add regpressure information to debug dump

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252340 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Refactor VOP[12C] tablegen definitions
Tom Stellard [Fri, 6 Nov 2015 20:56:18 +0000 (20:56 +0000)]
AMDGPU/SI: Refactor VOP[12C] tablegen definitions

Pass the VOPProfile object all the through to *_m multiclasses.  This will
allow us to do more simplifications in the future.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252339 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix SLPVectorizer commutativity reordering
Mehdi Amini [Fri, 6 Nov 2015 20:17:51 +0000 (20:17 +0000)]
Fix SLPVectorizer commutativity reordering

The SLPVectorizer had a very crude way of trying to benefit
from associativity: it tried to optimize for splat/broadcast
or in order to have the same operator on the same side.
This is benefitial to the cost model and allows more vectorization
to occur.
This patch improve the logic and make the detection optimal (locally,
we don't look at the full tree but only at the immediate children).

Should fix https://llvm.org/bugs/show_bug.cgi?id=25247

Reviewers: mzolotukhin

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252337 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImproved the operands commute transformation for X86-FMA3 instructions.
Andrew Kaylor [Fri, 6 Nov 2015 19:47:25 +0000 (19:47 +0000)]
Improved the operands commute transformation for X86-FMA3 instructions.
All 3 operands of FMA3 instructions are commutable now.

Patch by Slava Klochkov

Reviewers: Quentin Colombet(qcolombet), Ahmed Bougacha(ab).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252335 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Make expression-stack pushing explicit
Dan Gohman [Fri, 6 Nov 2015 19:45:01 +0000 (19:45 +0000)]
[WebAssembly] Make expression-stack pushing explicit

Modelling of the expression stack is evolving. This patch takes another
step by making pushes explicit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252334 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ValueTracking] Add parameters to isImpliedCondition; NFC
Sanjoy Das [Fri, 6 Nov 2015 19:01:08 +0000 (19:01 +0000)]
[ValueTracking] Add parameters to isImpliedCondition; NFC

This change makes the `isImpliedCondition` interface similar to the rest
of the functions in ValueTracking (in that it takes a DataLayout,
AssumptionCache etc.).  This is an NFC, intended to make a later diff
less noisy.

Depends on D14369

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252333 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ValueTracking] De-pessimize isImpliedCondition around unsigned compares
Sanjoy Das [Fri, 6 Nov 2015 19:01:03 +0000 (19:01 +0000)]
[ValueTracking] De-pessimize isImpliedCondition around unsigned compares

Currently `isImpliedCondition` will optimize "I +_nuw C < L ==> I < L"
only if C is positive.  This is an unnecessary restriction -- the
implication holds even if `C` is negative.

Reviewers: reames, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252332 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ValueTracking] Add a framework for encoding implication rules
Sanjoy Das [Fri, 6 Nov 2015 19:00:57 +0000 (19:00 +0000)]
[ValueTracking] Add a framework for encoding implication rules

This change adds a framework for adding more smarts to
`isImpliedCondition` around inequalities.  Informally,
`isImpliedCondition` will now try to prove "A < B ==> C < D" by proving
"C <= A && B <= D", since then it follows "C <= A < B <= D".

While this change is in principle NFC, I could not think of a way to not
handle cases like "i +_nsw 1 < L ==> i < L +_nsw 1" (that ValueTracking
did not handle before) while keeping the change understandable.  I've
added tests for these cases.

Reviewers: reames, majnemer, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252331 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Docs] Change ARM build info to CMake
Renato Golin [Fri, 6 Nov 2015 18:39:34 +0000 (18:39 +0000)]
[Docs] Change ARM build info to CMake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252329 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Cleanup includes
Matt Arsenault [Fri, 6 Nov 2015 18:23:00 +0000 (18:23 +0000)]
AMDGPU: Cleanup includes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252328 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Create emergency stack slots during frame lowering
Matt Arsenault [Fri, 6 Nov 2015 18:17:45 +0000 (18:17 +0000)]
AMDGPU: Create emergency stack slots during frame lowering

Test has a bogus verifier error which will be fixed by later commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252327 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Remove unused scratch resource operands
Matt Arsenault [Fri, 6 Nov 2015 18:07:53 +0000 (18:07 +0000)]
AMDGPU: Remove unused scratch resource operands

The SGPR spill pseudos don't actually use them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252324 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Add pass to detect used kernel features
Matt Arsenault [Fri, 6 Nov 2015 18:01:57 +0000 (18:01 +0000)]
AMDGPU: Add pass to detect used kernel features

Mark kernels that use certain features that require user
SGPRs to support with kernel attributes. We need to know
before instruction selection begins because it impacts
the kernel calling convention lowering.

For now this only detects the workitem intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252323 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Fix hardcoded alignment of spill.
Matt Arsenault [Fri, 6 Nov 2015 17:54:47 +0000 (17:54 +0000)]
AMDGPU: Fix hardcoded alignment of spill.

Instead of forcing 4 alignment when spilled, set register class

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252322 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Hack for VS_32 register pressure
Matt Arsenault [Fri, 6 Nov 2015 17:54:43 +0000 (17:54 +0000)]
AMDGPU: Hack for VS_32 register pressure

For some reason VS_32 ends up factoring into the pressure heuristics
even though we should never see a virtual register with this class.

When SGPRs are reserved for register spilling, this for some reason
triggers reg-crit scheduling.

Setting isAllocatable = 0 may help with this since that seems to remove
it from the default implementation's generated table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252321 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRestore "Move metadata linking after lazy global materialization/linking."
Teresa Johnson [Fri, 6 Nov 2015 17:50:53 +0000 (17:50 +0000)]
Restore "Move metadata linking after lazy global materialization/linking."

This reverts commit r251965.

Restore "Move metadata linking after lazy global materialization/linking."

This restores commit r251926, with fixes for the LTO bootstrapping bot

The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.

This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from

Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).

Reviewers: dexonsmith, rafael, tra

Subscribers: tobiasvk, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252320 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRestore "Move metadata linking after lazy global materialization/linking."
Teresa Johnson [Fri, 6 Nov 2015 17:50:48 +0000 (17:50 +0000)]
Restore "Move metadata linking after lazy global materialization/linking."

This reverts commit r251965.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252319 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Mark funclet entries and exits as clobbering all registers
Reid Kleckner [Fri, 6 Nov 2015 17:06:38 +0000 (17:06 +0000)]
[WinEH] Mark funclet entries and exits as clobbering all registers

In this implementation, LiveIntervalAnalysis invents a few register
masks on basic block boundaries that preserve no registers. The nice
thing about this is that it prevents the prologue inserter from thinking
it needs to spill all XMM CSRs, because it doesn't see any explicit
physreg defs in the MI.

Reviewers: MatzeB, qcolombet, JosephTremoulet, majnemer

Subscribers: MatzeB, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252318 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LIR] Simplify code by making DataLayout globally accessible. NFC.
Chad Rosier [Fri, 6 Nov 2015 16:33:57 +0000 (16:33 +0000)]
[LIR] Simplify code by making DataLayout globally accessible. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252317 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64]Enable the narrow ld promotion only on profitable microarchitectures
Jun Bum Lim [Fri, 6 Nov 2015 16:27:47 +0000 (16:27 +0000)]
[AArch64]Enable the narrow ld promotion only on profitable microarchitectures

The benefit from converting narrow loads into a wider load (r251438) could be
micro-architecturally dependent, as it assumes that a single load with two bitfield
extracts is cheaper than two narrow loads. Currently, this conversion is
enabled only in cortex-a57 on which performance benefits were verified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252316 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoBring r252305 back with a test fix.
Rafael Espindola [Fri, 6 Nov 2015 15:30:45 +0000 (15:30 +0000)]
Bring r252305 back with a test fix.

We now create the .eh_frame section early, just like every other special

This means that the special flags are visible in code that explicitly
asks for ".eh_frame".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252313 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Simplify the creation of .eh_frame/.debug_frame sections."
Rafael Espindola [Fri, 6 Nov 2015 14:51:09 +0000 (14:51 +0000)]
Revert "Simplify the creation of .eh_frame/.debug_frame sections."

This reverts commit r252305.

Investigating a test failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252306 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSimplify the creation of .eh_frame/.debug_frame sections.
Rafael Espindola [Fri, 6 Nov 2015 14:47:44 +0000 (14:47 +0000)]
Simplify the creation of .eh_frame/.debug_frame sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252305 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agogit clang-format and fix variable names. NFC.
Rafael Espindola [Fri, 6 Nov 2015 14:12:17 +0000 (14:12 +0000)]
git clang-format and fix variable names. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252304 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse SHT_X86_64_UNWIND on every OS.
Rafael Espindola [Fri, 6 Nov 2015 13:35:35 +0000 (13:35 +0000)]
Use SHT_X86_64_UNWIND on every OS.

That is the ABI required type. Linkers still check the section name, so
everything should still work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252300 91177308-0d34-0410-b5e6-96231b3b80d8