oota-llvm.git
9 years ago[mips] Fix two patterns that select i32's (for MIPS32r6) / i64's (for MIPS64r6)
Sasa Stankovic [Tue, 22 Jul 2014 13:36:02 +0000 (13:36 +0000)]
[mips] Fix two patterns that select i32's (for MIPS32r6) / i64's (for MIPS64r6)
from setne comparison with an i32.

The patterns that are fixed:
  * (select (i32 (setne i32, immZExt16)), i32, i32) (for MIPS32r6)
  * (select (i32 (setne i32, immZExt16)), i64, i64) (for MIPS64r6)

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

9 years agoAVX-512: Fixed intrinsic of VSQRTPS/PD instructions.
Elena Demikhovsky [Tue, 22 Jul 2014 11:07:31 +0000 (11:07 +0000)]
AVX-512: Fixed intrinsic of VSQRTPS/PD instructions.
I set number and types of parameters according to GCC intrinsics.

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

9 years agofixed typo in comment
Sanjay Patel [Tue, 22 Jul 2014 04:57:06 +0000 (04:57 +0000)]
fixed typo in comment

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

9 years ago[SDAG] Refactor the code for inserting a newly allocated SDNode into the
Chandler Carruth [Tue, 22 Jul 2014 04:07:55 +0000 (04:07 +0000)]
[SDAG] Refactor the code for inserting a newly allocated SDNode into the
DAG into a helper function.

This adds a trip through the (very minimal) verification logic in
a bunch of places that were missing it, but shouldn't have any other
impact outside of refactoring. I'm hoping to use this to do more clever
things when DAG nodes are inserted into the graph.

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

9 years ago[SDAG] Remove a giant pile of asserts that may have helped track down
Chandler Carruth [Tue, 22 Jul 2014 04:03:22 +0000 (04:03 +0000)]
[SDAG] Remove a giant pile of asserts that may have helped track down
a bug in 2010 when they were added but are adding no value today.

In fact, they are utter lies. NodeAllocator is used to allocate almost
all of these node types. I don't know what we were trying to assert
here, and the docs don't give any answer. Until we once again stumble
upon a bug needing help, let's clear the path for improvements.

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

9 years agoAdd openmp to the list of tagged things.
Bill Wendling [Tue, 22 Jul 2014 03:17:30 +0000 (03:17 +0000)]
Add openmp to the list of tagged things.

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

9 years agoRevert of r213521. This change introduced a non-hermetic test (depending on a
Richard Smith [Tue, 22 Jul 2014 02:32:12 +0000 (02:32 +0000)]
Revert of r213521. This change introduced a non-hermetic test (depending on a
file not in the test/ area). Backing out now so that this test isn't part of
the 3.5 branch.

Original commit message: "TableGen: Allow AddedComplexity values to be negative
[...]"

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

9 years agoRename metadata llvm.loop.vectorize.unroll to llvm.loop.vectorize.interleave.
Mark Heffernan [Mon, 21 Jul 2014 23:11:03 +0000 (23:11 +0000)]
Rename metadata llvm.loop.vectorize.unroll to llvm.loop.vectorize.interleave.

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

9 years agoAdd some tests for NVPTX lowering of cmpxchg
Eli Bendersky [Mon, 21 Jul 2014 22:54:44 +0000 (22:54 +0000)]
Add some tests for NVPTX lowering of cmpxchg

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

9 years agoMatch semantics of PointerMayBeCapturedBefore to its name by default
Hal Finkel [Mon, 21 Jul 2014 21:30:22 +0000 (21:30 +0000)]
Match semantics of PointerMayBeCapturedBefore to its name by default

As it turns out, the capture tracker named CaptureBefore used by AA, and now
available via the PointerMayBeCapturedBefore function, would have been
more-aptly named CapturedBeforeOrAt, because it considers captures at the
instruction provided. This is not always what one wants, and it is difficult to
get the strictly-before behavior given only the current interface. This adds an
additional parameter which controls whether or not you want to include
captures at the provided instruction. The default is not to include the
instruction provided, so that 'Before' matches its name.

No functionality change intended.

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

9 years agoRevert "Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for...
David Blaikie [Mon, 21 Jul 2014 20:45:59 +0000 (20:45 +0000)]
Revert "Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information."

This reverts commit r212649 while I investigate/reduce/etc PR20367.

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

9 years agotest-release.sh: Add support for dot releases
Tom Stellard [Mon, 21 Jul 2014 20:20:08 +0000 (20:20 +0000)]
test-release.sh: Add support for dot releases

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

9 years agoR600: silence GCC warning
Saleem Abdulrasool [Mon, 21 Jul 2014 17:52:00 +0000 (17:52 +0000)]
R600: silence GCC warning

GCC believes it may be possible to not return a value from the switch:
  lib/Target/R600/SIRegisterInfo.cpp:187:1: warning: control reaches end of non-void function [-Wreturn-type]

Add an unreachable label to indicate that this is not possible and still permit
switch coverage checking.

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

9 years agoR600/SI: Refactor VOP3 instruction definitions
Tom Stellard [Mon, 21 Jul 2014 17:44:29 +0000 (17:44 +0000)]
R600/SI: Refactor VOP3 instruction definitions

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

9 years agoR600/SI: Separate encoding and operand definitions into their own classes
Tom Stellard [Mon, 21 Jul 2014 17:44:28 +0000 (17:44 +0000)]
R600/SI: Separate encoding and operand definitions into their own classes

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

9 years agoReplace the result usages while legalizing cmpxchg.
Logan Chien [Mon, 21 Jul 2014 17:33:44 +0000 (17:33 +0000)]
Replace the result usages while legalizing cmpxchg.

We should update the usages to all of the results;
otherwise, we might get assertion failure or SEGV during
the type legalization of ATOMIC_CMP_SWAP_WITH_SUCCESS
with two or more illegal types.

For example, in the following sequence, both i8 and i1
might be illegal in some target, e.g. armv5, mipsel, mips64el,

    %0 = cmpxchg i8* %ptr, i8 %desire, i8 %new monotonic monotonic
    %1 = extractvalue { i8, i1 } %0, 1

Since both i8 and i1 should be legalized, the corresponding
ATOMIC_CMP_SWAP_WITH_SUCCESS dag will be checked/replaced/updated
twice.

If we don't update the usage to *ALL* of the results in the
first round, the DAG for extractvalue might be processed earlier.
The GetPromotedInteger() will result in assertion failure,
because its operand (i.e. the success bit of cmpxchg) is not
promoted beforehand.

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

9 years agoR600/SI: Initailize encoding fields of unused VOP3 modifiers to 0
Tom Stellard [Mon, 21 Jul 2014 17:12:40 +0000 (17:12 +0000)]
R600/SI: Initailize encoding fields of unused VOP3 modifiers to 0

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

9 years agoR600/SI: Initialize unused VOP3 sources to 0 instead of SIOperand.ZERO
Tom Stellard [Mon, 21 Jul 2014 17:12:37 +0000 (17:12 +0000)]
R600/SI: Initialize unused VOP3 sources to 0 instead of SIOperand.ZERO

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

9 years agoRevert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator...
Duncan P. N. Exon Smith [Mon, 21 Jul 2014 17:06:51 +0000 (17:06 +0000)]
Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges."

This reverts commit r213474 (and r213475), which causes a miscompile on
a stage2 LTO build.  I'll reply on the list in a moment.

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

9 years agoR600/SI: Add instruction shrinking pass
Tom Stellard [Mon, 21 Jul 2014 16:55:33 +0000 (16:55 +0000)]
R600/SI: Add instruction shrinking pass

This pass converts 64-bit instructions to 32-bit when possible.

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

9 years agoFix Sphinx warnings.
Dan Liew [Mon, 21 Jul 2014 16:39:00 +0000 (16:39 +0000)]
Fix Sphinx warnings.

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

9 years agoR600/SI: VOPC instructions explicitly define VCC
Tom Stellard [Mon, 21 Jul 2014 16:27:24 +0000 (16:27 +0000)]
R600/SI: VOPC instructions explicitly define VCC

Therefore we don't need to add it to the implict defs list.

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

9 years agoCorrect the ownership passing semantics of object::createBinary and make them explici...
David Blaikie [Mon, 21 Jul 2014 16:26:24 +0000 (16:26 +0000)]
Correct the ownership passing semantics of object::createBinary and make them explicit in the type system.

createBinary documented that it destroyed the parameter in error cases,
though by observation it does not. By passing the unique_ptr by value
rather than lvalue reference, callers are now explicit about passing
ownership and the function implements the documented contract. Remove
the explicit documentation, since now the behavior cannot be anything
other than what was documented, so it's redundant.

Also drops a unique_ptr::release in llvm-nm that was always run on a
null unique_ptr anyway.

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

9 years agoRemove unnecessary use of unique_ptr::release() used to construct another unique_ptr.
David Blaikie [Mon, 21 Jul 2014 16:23:21 +0000 (16:23 +0000)]
Remove unnecessary use of unique_ptr::release() used to construct another unique_ptr.

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

9 years agoRemove unused variable.
David Blaikie [Mon, 21 Jul 2014 16:13:24 +0000 (16:13 +0000)]
Remove unused variable.

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

9 years agoR600/SI: Clean up some of the unused REGISTER_{LOAD,STORE} code
Tom Stellard [Mon, 21 Jul 2014 15:45:06 +0000 (15:45 +0000)]
R600/SI: Clean up some of the unused REGISTER_{LOAD,STORE} code

There are a few more cleanups to do, but I ran into some problems
with ext loads and trunc stores, when I tried to change some of the
vector loads and stores from custom to legal, so I wasn't able to
get rid of everything.

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

9 years agoR600/SI: Use scratch memory for large private arrays
Tom Stellard [Mon, 21 Jul 2014 15:45:01 +0000 (15:45 +0000)]
R600/SI: Use scratch memory for large private arrays

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

9 years agoR600/SI: Specify wavefront size for SI and CI
Tom Stellard [Mon, 21 Jul 2014 15:44:58 +0000 (15:44 +0000)]
R600/SI: Specify wavefront size for SI and CI

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

9 years agoR600/SI: Remove vaddr operand from BUFFER_LOAD_*_OFFSET instructions
Tom Stellard [Mon, 21 Jul 2014 15:44:55 +0000 (15:44 +0000)]
R600/SI: Remove vaddr operand from BUFFER_LOAD_*_OFFSET instructions

This operand is never used.

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

9 years ago[mips] Do not emit '.module fp=...' unless we really need to.
Daniel Sanders [Mon, 21 Jul 2014 15:25:24 +0000 (15:25 +0000)]
[mips] Do not emit '.module fp=...' unless we really need to.

We now emit this value when we need to contradict the default value. This
restores support for binutils 2.24.

When a suitable binutils has been released we can resume unconditionally
emitting .module directives. This is preferable to omitting the .module
directives since the .module directives protect against, for example,
accidentally assembling FP32 code with -mfp64 and producing an unusuable object.

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

9 years ago[SKX] Enabling SKX target and AVX512BW, AVX512DQ, AVX512VL features.
Robert Khasanov [Mon, 21 Jul 2014 14:54:21 +0000 (14:54 +0000)]
[SKX] Enabling SKX target and AVX512BW, AVX512DQ, AVX512VL features.

Enabling HasAVX512{DQ,BW,VL} predicates.
Adding VK2, VK4, VK32, VK64 masked register classes.
Adding new types (v64i8, v32i16) to VR512.
Extending calling conventions for new types (v64i8, v32i16)

Patch by Zinovy Nis <zinovy.y.nis@intel.com>
Reviewed by Elena Demikhovsky <elena.demikhovsky@intel.com>

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

9 years agodocs: Update relaease documents to include the patch number in the RELEASE tags
Tom Stellard [Mon, 21 Jul 2014 14:28:31 +0000 (14:28 +0000)]
docs: Update relaease documents to include the patch number in the RELEASE tags

This will make it easier to update the release scripts to support
bug-fix releases.

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

9 years agoExport LLVM_ENABLE_ASSERTIONS in LLVMConfig.cmake so clients know
Dan Liew [Mon, 21 Jul 2014 14:17:15 +0000 (14:17 +0000)]
Export LLVM_ENABLE_ASSERTIONS in LLVMConfig.cmake so clients know
if the version of LLVM they are trying to use was built with or
without assertions.

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

9 years agoR600/SI: Store constant initializer data in constant memory
Tom Stellard [Mon, 21 Jul 2014 14:01:14 +0000 (14:01 +0000)]
R600/SI: Store constant initializer data in constant memory

This implements a solution for constant initializers suggested
by Vadim Girlin, where we store the data after the shader code
and then use the S_GETPC instruction to compute its address.

This saves use the trouble of creating a new buffer for constant data
and then having to pass the pointer to the kernel via user SGPRs or the
input buffer.

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

9 years agoR600/SI: Add isCFDepth0 Predicate to SALU addc pattern
Tom Stellard [Mon, 21 Jul 2014 14:01:12 +0000 (14:01 +0000)]
R600/SI: Add isCFDepth0 Predicate to SALU addc pattern

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

9 years agoR600/SI: Use VALU for i1 XOR
Tom Stellard [Mon, 21 Jul 2014 14:01:10 +0000 (14:01 +0000)]
R600/SI: Use VALU for i1 XOR

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

9 years agoR600/SI: Use a custom encoding method for simm16 in SOPP branch instructions
Tom Stellard [Mon, 21 Jul 2014 14:01:08 +0000 (14:01 +0000)]
R600/SI: Use a custom encoding method for simm16 in SOPP branch instructions

This allows us to explicitly define the type of fixup that is needed,
so we can distinguish this from future fixup types.

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

9 years agoR600/SI: Rename SOPP operands to match the encoding fields
Tom Stellard [Mon, 21 Jul 2014 14:01:05 +0000 (14:01 +0000)]
R600/SI: Rename SOPP operands to match the encoding fields

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

9 years ago[mips] Add MipsOptionRecord abstraction and use it to implement .reginfo/.MIPS.options
Daniel Sanders [Mon, 21 Jul 2014 13:30:55 +0000 (13:30 +0000)]
[mips] Add MipsOptionRecord abstraction and use it to implement .reginfo/.MIPS.options

This abstraction allows us to support the various records that can be placed in
the .MIPS.options section in the future. We currently use it to record register
usage information (the ODK_REGINFO record in our ELF64 spec).

Each .MIPS.options record should subclass MipsOptionRecord and provide an
implementation of EmitMipsOptionRecord.

Patch by Matheus Almeida and Toma Tabacu

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

9 years agoTableGen: Allow AddedComplexity values to be negative
Tom Stellard [Mon, 21 Jul 2014 13:28:54 +0000 (13:28 +0000)]
TableGen: Allow AddedComplexity values to be negative

This is useful for cases when stand-alone patterns are preferred to the
patterns included in the instruction definitions.  Instead of requiring
that stand-alone patterns set a larger AddedComplexity value, which
can be confusing to new developers, the allows us to reduce the
complexity of the included patterns to achieve the same result.

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

9 years agoMove the CapturesBefore tracker from AA into CaptureTracking
Hal Finkel [Mon, 21 Jul 2014 13:15:48 +0000 (13:15 +0000)]
Move the CapturesBefore tracker from AA into CaptureTracking

There were two generally-useful CaptureTracker classes defined in LLVM: the
simple tracker defined in CaptureTracking (and made available via the
PointerMayBeCaptured utility function), and the CapturesBefore tracker
available only inside of AA. This change moves the CapturesBefore tracker into
CaptureTracking, generalizes it slightly (by adding a ReturnCaptures
parameter), and makes it generally available via a PointerMayBeCapturedBefore
utility function.

This logic will be needed, for example, to perform noalias function parameter
attribute inference.

No functionality change intended.

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

9 years agoThis declaration has no definition, which is causing MSVC to emit several "no suitabl...
Aaron Ballman [Mon, 21 Jul 2014 13:08:08 +0000 (13:08 +0000)]
This declaration has no definition, which is causing MSVC to emit several "no suitable definition provided for explicit template instantiation request" C4661 warnings.

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

9 years agoFixing an MSVC conversion warning about implicitly converting the shift results to...
Aaron Ballman [Mon, 21 Jul 2014 12:31:43 +0000 (12:31 +0000)]
Fixing an MSVC conversion warning about implicitly converting the shift results to 64-bits. No functional change intended.

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

9 years agoMove isIdentifiedFunctionLocal from BasicAA to AA
Hal Finkel [Mon, 21 Jul 2014 12:27:23 +0000 (12:27 +0000)]
Move isIdentifiedFunctionLocal from BasicAA to AA

The ability to identify function locals will exist outside of BasicAA (for
example, logic for inferring noalias function arguments will need this), so
make this concept generally accessible without code duplication.

No functionality change.

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

9 years ago[mips] Try to fix the test/ExecutionEngine tests on a MIPS host.
Daniel Sanders [Mon, 21 Jul 2014 12:25:34 +0000 (12:25 +0000)]
[mips] Try to fix the test/ExecutionEngine tests on a MIPS host.

Fix a dangerous default case that caused MipsCodeEmitter to discard pseudo
instructions it didn't recognize. It will now call llvm_unreachable() for
unrecognized pseudo's and explicitly handles PseudoReturn, PseudoReturn64,
PseudoIndirectBranch, PseudoIndirectBranch64, CFI_INSTRUCTION, IMPLICIT_DEF,
and KILL.

There may be other pseudos that need handling but this was enough for the
ExecutionEngine tests to pass on my test system.

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

9 years ago[mips] Do not emit '.module [no]oddspreg' unless we really need to.
Daniel Sanders [Mon, 21 Jul 2014 10:45:47 +0000 (10:45 +0000)]
[mips] Do not emit '.module [no]oddspreg' unless we really need to.

We now emit this directive when we need to contradict the default value (e.g.
-mno-odd-spreg is given) or an option changed the default value (e.g. -mfpxx
is given).

This restores support for the currently available head of binutils. However,
at this point binutils 2.24 is still not sufficient since it does not support
'.module fp=...'.

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

9 years agoFileCheck-ize a test.
Chandler Carruth [Mon, 21 Jul 2014 09:23:21 +0000 (09:23 +0000)]
FileCheck-ize a test.

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

9 years agoCodeGen: emit IR-level f16 conversion intrinsics as fptrunc/fpext
Tim Northover [Mon, 21 Jul 2014 09:13:56 +0000 (09:13 +0000)]
CodeGen: emit IR-level f16 conversion intrinsics as fptrunc/fpext

This makes the first stage DAG for @llvm.convert.to.fp16 an fptrunc,
and correspondingly @llvm.convert.from.fp16 an fpext. The legalisation
path is now uniform, regardless of the input IR:

  fptrunc -> FP_TO_FP16 (if f16 illegal) -> libcall
  fpext -> FP16_TO_FP (if f16 illegal) -> libcall

Each target should be able to select the version that best matches its
operations and not be required to duplicate patterns for both fptrunc
and FP_TO_FP16 (for example).

As a result we can remove some redundant AArch64 patterns.

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

9 years ago[SDAG,cleanup] Switch the DAG combiner over to use the spelling
Chandler Carruth [Mon, 21 Jul 2014 08:56:44 +0000 (08:56 +0000)]
[SDAG,cleanup] Switch the DAG combiner over to use the spelling
'Worklist' consistently rather than a deeply confusing mixture of
'WorkList' and 'Worklist'.

Notably, the very 'WorkList' of the DAG combiner was exposed to target
specific DAG combines under an interface 'AddToWorklist' which was
implemented by in turn calling 'AddToWorkList' in the combiner. This has
sent me circling with the wrong case in grep one too many times.

I chose to normalize on 'Worklist' because that one won the grep-vote
for llvm/lib/... by a hundered hits or so, and it is used in places
relatively "canonical" such as InstCombine's Worklist. Let's all jsut
pick this casing, whether "correct", "good", or "bad" and be
consistent...

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

9 years ago[SDAG] Rather than using a narrow test against the one dummy node on the
Chandler Carruth [Mon, 21 Jul 2014 08:32:31 +0000 (08:32 +0000)]
[SDAG] Rather than using a narrow test against the one dummy node on the
stack, filter all handle nodes from the DAG combiner worklist.

This will also handle cases where other handle nodes might be
(erroneously) added to the worklist and then cause bugs and explosions
when deleted. For example, when running the legalizer within the DAG
combiner, there are times when other handle nodes are used and can end
up here.

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

9 years ago[DAGCombiner] Improve the shuffle-vector folding logic.
Andrea Di Biagio [Mon, 21 Jul 2014 07:30:54 +0000 (07:30 +0000)]
[DAGCombiner] Improve the shuffle-vector folding logic.

Canonicalize shuffles according to rules:
 *  shuffle(A, shuffle(A, B)) -> shuffle(shuffle(A,B), A)
 *  shuffle(B, shuffle(A, B)) -> shuffle(shuffle(A,B), B)
 *  shuffle(B, shuffle(A, Undef)) -> shuffle(shuffle(A, Undef), B)

This patch helps identifying more shuffle pairs that could be combined reusing
the already existing rules in the DAGCombiner.

Added new test 'combine-vec-shuffle-5.ll' to verify that the canonicalized
shuffles are now folded into a single shuffle node by the DAGCombiner.
Added more test cases to 'combine-vec-shuffle-4.ll'.

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

9 years ago[DAG] Refactor some logic. No functional change.
Andrea Di Biagio [Mon, 21 Jul 2014 07:28:51 +0000 (07:28 +0000)]
[DAG] Refactor some logic. No functional change.

This patch removes function 'CommuteVectorShuffle' from X86ISelLowering.cpp
and moves its logic into SelectionDAG.cpp as method 'getCommutedVectorShuffles'.
This refactoring is in preperation of an upcoming change to the DAGCombiner.

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

9 years agoFix for regression: [Bug 20369] wrong code at -O3 on x86_64-linux-gnu in 64-bit mode
Gerolf Hoflehner [Mon, 21 Jul 2014 03:02:46 +0000 (03:02 +0000)]
Fix for regression: [Bug 20369] wrong code at -O3 on x86_64-linux-gnu in 64-bit mode

Prevents hoisting of loads above stores and sinking of stores below loads
in MergedLoadStoreMotion.cpp (rdar://15991737)

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

9 years ago[PowerPC] ELFv2 aggregate passing support
Ulrich Weigand [Mon, 21 Jul 2014 00:13:26 +0000 (00:13 +0000)]
[PowerPC] ELFv2 aggregate passing support

This patch adds infrastructure support for passing array types
directly.  These can be used by the front-end to pass aggregate
types (coerced to an appropriate array type).  The details of the
array type being used inform the back-end about ABI-relevant
properties.  Specifically, the array element type encodes:
- whether the parameter should be passed in FPRs, VRs, or just
  GPRs/stack slots  (for float / vector / integer element types,
  respectively)
- what the alignment requirements of the parameter are when passed in
  GPRs/stack slots  (8 for float / 16 for vector / the element type
  size for integer element types) -- this corresponds to the
  "byval align" field

Using the infrastructure provided by this patch, a companion patch
to clang will enable two features:
- In the ELFv2 ABI, pass (and return) "homogeneous" floating-point
  or vector aggregates in FPRs and VRs (this is similar to the ARM
  homogeneous aggregate ABI)
- As an optimization for both ELFv1 and ELFv2 ABIs, pass aggregates
  that fit fully in registers without using the "byval" mechanism

The patch uses the functionArgumentNeedsConsecutiveRegisters callback
to encode that special treatment is required for all directly-passed
array types.  The isInConsecutiveRegs / isInConsecutiveRegsLast bits set
as a results are then used to implement the required size and alignment
rules in CalculateStackSlotSize / CalculateStackSlotAlignment etc.

As a related change, the ABI routines have to be modified to support
passing floating-point types in GPRs.  This is necessary because with
homogeneous aggregates of 4-byte float type we can now run out of FPRs
*before* we run out of the 64-byte argument save area that is shadowed
by GPRs.  Any extra floating-point arguments that no longer fit in FPRs
must now be passed in GPRs until we run out of those too.

Note that there was already code to pass floating-point arguments in
GPRs used with vararg parameters, which was done by writing the argument
out to the argument save area first and then reloading into GPRs.  The
patch re-implements this, however, in favor of code packing float arguments
directly via extension/truncation, BITCAST, and BUILD_PAIR operations.

This is required to support the ELFv2 ABI, since we cannot unconditionally
write to the argument save area (which the caller might not have allocated).
The change does, however, affect ELFv1 varags routines too; but even here
the overall effect should be advantageous: Instead of loading the argument
into the FPR, then storing the argument to the stack slot, and finally
reloading the argument from the stack slot into a GPR, the new code now
just loads the argument into the FPR, and subsequently loads the argument
into the GPR (via BITCAST).  That BITCAST might imply a save/reload from
a stack temporary (in which case we're no worse than before); but it
might be implemented more efficiently in some cases.

The final part of the patch enables up to 8 FPRs and VRs for argument
return in PPCCallingConv.td; this is required to support returning
ELFv2 homogeneous aggregates.  (Note that this doesn't affect other ABIs
since LLVM wil only look for which register to use if the parameter is
marked as "direct" return anyway.)

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] ELFv2 explicit CFI for CR fields
Ulrich Weigand [Mon, 21 Jul 2014 00:03:18 +0000 (00:03 +0000)]
[PowerPC] ELFv2 explicit CFI for CR fields

This is a minor improvement in the ELFv2 ABI.   In ELFv1, DWARF CFI
would represent a saved CR word (holding CR fields CR2, CR3, and CR4)
using just a single CFI record refering to CR2.   In ELFv2 instead,
each of the CR fields is represented by its own CFI record.  The
advantage is that the compiler can now chose to save just a single
(or two) CR fields instead of all of them, if those are the only ones
that actually need saving.  That can lead to more efficient code using
mf(o)crf instead of the (slow) mfcr instruction.

Note that this patch does not (yet) implement this more efficient
code generation, but it does implement the part that is required to
be ABI compliant: creating multiple CFI records if multiple CR fields
are saved.

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] ELFv2 dynamic loader support
Ulrich Weigand [Sun, 20 Jul 2014 23:53:14 +0000 (23:53 +0000)]
[PowerPC] ELFv2 dynamic loader support

This patch enables the new ELFv2 ABI in the runtime dynamic loader.
The loader has to implement the following features:
- In the ELFv2 ABI, do not look up a function descriptor in .opd, but
  instead use the local entry point when resolving a direct call.
- Update the TOC restore code to use the new TOC slot linkage area
  offset.
- Create PLT stubs appropriate for the ELFv2 ABI.

Note that this patch also adds common-code changes. These are necessary
because the loader must check the newly added ELF flags: the e_flags
header bits encoding the ABI version, and the st_other symbol table
entry bits encoding the local entry point offset.  There is currently
no way to access these, so I've added ObjectFile::getPlatformFlags and
SymbolRef::getOther accessors.

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] ELFv2 stack space reduction
Ulrich Weigand [Sun, 20 Jul 2014 23:43:15 +0000 (23:43 +0000)]
[PowerPC] ELFv2 stack space reduction

The ELFv2 ABI reduces the amount of stack required to implement an
ABI-compliant function call in two ways:
* the "linkage area" is reduced from 48 bytes to 32 bytes by
  eliminating two unused doublewords
* the 64-byte "parameter save area" is now optional and need not be
  present in certain cases (it remains mandatory in functions with
  variable arguments, and functions that have any parameter that is
  passed on the stack)

The following patch implements this required changes:
- reducing the linkage area, and associated relocation of the TOC save
  slot, in getLinkageSize / getTOCSaveOffset (this requires updating all
  callers of these routines to pass in the isELFv2ABI flag).
- (partially) handling the case where the parameter save are is optional

This latter part requires some extra explanation:  Currently, we still
always allocate the parameter save area when *calling* a function.
That is certainly always compliant with the ABI, but may cause code to
allocate stack unnecessarily.  This can be addressed by a follow-on
optimization patch.

On the *callee* side, in LowerFormalArguments, we *must* track
correctly whether the ABI guarantees that the caller has allocated
the parameter save area for our use, and the patch does so. However,
there is one complication: the code that handles incoming "byval"
arguments will currently *always* write to the parameter save area,
because it has to force incoming register arguments to the stack since
it must return an *address* to implement the byval semantics.

To fix this, the patch changes the LowerFormalArguments code to write
arguments to a freshly allocated stack slot on the function's own stack
frame instead of the argument save area in those cases where that area
is not present.

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] ELFv2 function call changes
Ulrich Weigand [Sun, 20 Jul 2014 23:31:44 +0000 (23:31 +0000)]
[PowerPC] ELFv2 function call changes

This patch builds upon the two preceding MC changes to implement the
basic ELFv2 function call convention.  In the ELFv1 ABI, a "function
descriptor" was associated with every function, pointing to both the
entry address and the related TOC base (and a static chain pointer
for nested functions).  Function pointers would actually refer to that
descriptor, and the indirect call sequence needed to load up both entry
address and TOC base.

In the ELFv2 ABI, there are no more function descriptors, and function
pointers simply refer to the (global) entry point of the function code.
Indirect function calls simply branch to that address, after loading it
up into r12 (as required by the ABI rules for a global entry point).
Direct function calls continue to just do a "bl" to the target symbol;
this will be resolved by the linker to the local entry point of the
target function if it is local, and to a PLT stub if it is global.
That PLT stub would then load the (global) entry point address of the
final target into r12 and branch to it.  Note that when performing a
local function call, r2 must be set up to point to the current TOC
base: if the target ends up local, the ABI requires that its local
entry point is called with r2 set up; if the target ends up global,
the PLT stub requires that r2 is set up.

This patch implements all LLVM changes to implement that scheme:
- No longer create a function descriptor when emitting a function
  definition (in EmitFunctionEntryLabel)
- Emit two entry points *if* the function needs the TOC base (r2)
  anywhere (this is done EmitFunctionBodyStart; note that this cannot
  be done in EmitFunctionBodyStart because the global entry point
  prologue code must be *part* of the function as covered by debug info).
- In order to make use tracking of r2 (as needed above) work correctly,
  mark direct function calls as implicitly using r2.
- Implement the ELFv2 indirect function call sequence (no function
  descriptors; load target address into r12).
- When creating an ELFv2 object file, emit the .abiversion 2 directive
  to tell the linker to create the appropriate version of PLT stubs.

Reviewed by Hal Finkel.

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

9 years ago[LoopVectorize] Remove an unused private AA pointer
Hal Finkel [Sun, 20 Jul 2014 23:28:25 +0000 (23:28 +0000)]
[LoopVectorize] Remove an unused private AA pointer

Thanks to the lld-x86_64-darwin13 builder for catching this first.

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

9 years ago[MC] Pass MCSymbolData to needsRelocateWithSymbol
Ulrich Weigand [Sun, 20 Jul 2014 23:15:06 +0000 (23:15 +0000)]
[MC] Pass MCSymbolData to needsRelocateWithSymbol

As discussed in a previous checking to support the .localentry
directive on PowerPC, we need to inspect the actual target symbol
in needsRelocateWithSymbol to make the appropriate decision based
on that symbol's st_other bits.

Currently, needsRelocateWithSymbol does not get the target symbol.
However, it is directly available to its sole caller.  This patch
therefore simply extends the needsRelocateWithSymbol by a new
parameter "const MCSymbolData &SD", passes in the target symbol,
and updates all derived implementations.

In particular, in the PowerPC implementation, this patch removes
the FIXME added by the previous checkin.

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

9 years ago[LoopVectorize] Use AA to partition potential dependency checks
Hal Finkel [Sun, 20 Jul 2014 23:07:52 +0000 (23:07 +0000)]
[LoopVectorize] Use AA to partition potential dependency checks

Prior to this change, the loop vectorizer did not make use of the alias
analysis infrastructure. Instead, it performed memory dependence analysis using
ScalarEvolution-based linear dependence checks within equivalence classes
derived from the results of ValueTracking's GetUnderlyingObjects.

Unfortunately, this meant that:
  1. The loop vectorizer had logic that essentially duplicated that in BasicAA
     for aliasing based on identified objects.
  2. The loop vectorizer could not partition the space of dependency checks
     based on information only easily available from within AA (TBAA metadata is
     currently the prime example).

This means, for example, regardless of whether -fno-strict-aliasing was
provided, the vectorizer would only vectorize this loop with a runtime
memory-overlap check:

void foo(int *a, float *b) {
  for (int i = 0; i < 1600; ++i)
    a[i] = b[i];
}

This is suboptimal because the TBAA metadata already provides the information
necessary to show that this check unnecessary. Of course, the vectorizer has a
limit on the number of such checks it will insert, so in practice, ignoring
TBAA means not vectorizing more-complicated loops that we should.

This change causes the vectorizer to use an AliasSetTracker to keep track of
the pointers in the loop. The resulting alias sets are then used to partition
the space of dependency checks, and potential runtime checks; this results in
more-efficient vectorizations.

When pointer locations are added to the AliasSetTracker, two things are done:
  1. The location size is set to UnknownSize (otherwise you'd not catch
     inter-iteration dependencies)
  2. For instructions in blocks that would need to be predicated, TBAA is
     removed (because the metadata might have a control dependency on the condition
     being speculated).

For non-predicated blocks, you can leave the TBAA metadata. This is safe
because you can't have an iteration dependency on the TBAA metadata (if you
did, and you unrolled sufficiently, you'd end up with the same pointer value
used by two accesses that TBAA says should not alias, and that would yield
undefined behavior).

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

9 years ago[PowerPC] ELFv2 MC support for .localentry directive
Ulrich Weigand [Sun, 20 Jul 2014 23:06:03 +0000 (23:06 +0000)]
[PowerPC] ELFv2 MC support for .localentry directive

A second binutils feature needed to support ELFv2 is the .localentry
directive.  In the ELFv2 ABI, functions may have two entry points:
one for calling the routine locally via "bl", and one for calling the
function via function pointer (either at the source level, or implicitly
via a PLT stub for global calls).  The two entry points share a single
ELF symbol, where the ELF symbol address identifies the global entry
point address, while the local entry point is found by adding a delta
offset to the symbol address.  That offset is encoded into three
platform-specific bits of the ELF symbol st_other field.

The .localentry directive instructs the assembler to set those fields
to encode a particular offset.  This is typically used by a function
prologue sequence like this:

func:
        addis r2, r12, (.TOC.-func)@ha
        addi r2, r2, (.TOC.-func)@l
        .localentry func, .-func

Note that according to the ABI, when calling the global entry point,
r12 must be set to point the global entry point address itself; while
when calling the local entry point, r2 must be set to point to the TOC
base.  The two instructions between the global and local entry point in
the above example translate the first requirement into the second.

This patch implements support in the PowerPC MC streamers to emit the
.localentry directive (both into assembler and ELF object output), as
well as support in the assembler parser to parse that directive.

In addition, there is another change required in MC fixup/relocation
handling to properly deal with relocations targeting function symbols
with two entry points: When the target function is known local, the MC
layer would immediately handle the fixup by inserting the target
address -- this is wrong, since the call may need to go to the local
entry point instead.  The GNU assembler handles this case by *not*
directly resolving fixups targeting functions with two entry points,
but always emits the relocation and relies on the linker to handle
this case correctly.  This patch changes LLVM MC to do the same (this
is done via the processFixupValue routine).

Similarly, there are cases where the assembler would normally emit a
relocation, but "simplify" it to a relocation targeting a *section*
instead of the actual symbol.  For the same reason as above, this
may be wrong when the target symbol has two entry points.  The GNU
assembler again handles this case by not performing this simplification
in that case, but leaving the relocation targeting the full symbol,
which is then resolved by the linker.  This patch changes LLVM MC
to do the same (via the needsRelocateWithSymbol routine).
NOTE: The method used in this patch is overly pessimistic, since the
needsRelocateWithSymbol routine currently does not have access to the
actual target symbol, and thus must always assume that it might have
two entry points.  This will be improved upon by a follow-on patch
that modifies common code to pass the target symbol when calling
needsRelocateWithSymbol.

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] ELFv2 MC support for .abiversion directive
Ulrich Weigand [Sun, 20 Jul 2014 22:56:57 +0000 (22:56 +0000)]
[PowerPC] ELFv2 MC support for .abiversion directive

ELFv2 binaries are marked by a bit in the ELF header e_flags field.
A new assembler directive .abiversion can be used to set that flag.
This patch implements support in the PowerPC MC streamers to emit the
.abiversion directive (both into assembler and ELF binary output),
as well as support in the assembler parser to parse the .abiversion
directive.

Reviewed by Hal Finkel.

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

9 years ago[PowerPC] Refactor byval handling in LowerFormalArguments_64SVR4
Ulrich Weigand [Sun, 20 Jul 2014 22:36:52 +0000 (22:36 +0000)]
[PowerPC] Refactor byval handling in LowerFormalArguments_64SVR4

When handling an incoming byval argument, we need to possibly write
incoming registers to the stack in order to create an on-stack image
of the parameter, so we can return its address to common code.

This currently uses CreateFixedObject to access the parts of the
parameter save area where the argument is (or needs to be) stored.
However, sometimes we need to access multiple parts of that area,
e.g. to write multiple registers.  The code currently uses a new
CreateFixedObject call for each of these accesses, resulting in
a patchwork of overlapping (fixed) stack objects.

This doesn't really matter in the case of fixed objects, since
any access to those turns into a fixed stackpointer + offset
address anyway.  However, with the upcoming ELFv2 patches, we
may actually need to place an incoming argument into our *own*
stack frame instead of the caller's.  This means we need to use
CreateStackObject instead, and we cannot have multiple overlapping
instances of those.

To make the rest of the argument handling code work equally in
both situations, this patch refactors it to always use just a
single call to CreateFixedObject, and access parts of that object
as required using address arithmetic.  This way, we can in a future
patch substitute CreateStackObject without further changes.

No change to generated code intended.

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

9 years ago[PowerPC] Fix FrameIndex handling in SelectAddressRegImm
Ulrich Weigand [Sun, 20 Jul 2014 22:26:40 +0000 (22:26 +0000)]
[PowerPC] Fix FrameIndex handling in SelectAddressRegImm

The PPCTargetLowering::SelectAddressRegImm routine needs to handle
FrameIndex nodes in a special manner, by tranlating them into a
TargetFrameIndex node.  This was done in most cases, but seems to
have been neglected in one path: when the input tree has an OR of
the FrameIndex with an immediate.  This can happen if the FrameIndex
can be proven to be sufficiently aligned that an OR of that immediate
is equivalent to an ADD.

The missing handling of FrameIndex in that case caused the SelectionDAG
instruction selection to miss opportunities to merge the OR back into
the FrameIndex node, leading to superfluous addi/ori instructions in
the final assembler output.

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

9 years agoNamespace cleanup (no functional change)
Artyom Skrobov [Sun, 20 Jul 2014 12:08:28 +0000 (12:08 +0000)]
Namespace cleanup (no functional change)

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

9 years agoSIISelLowering.cpp: Define _USE_MATH_DEFINES to let M_PI provided on MS <cmath>.
NAKAMURA Takumi [Sun, 20 Jul 2014 11:15:07 +0000 (11:15 +0000)]
SIISelLowering.cpp: Define _USE_MATH_DEFINES to let M_PI provided on MS <cmath>.

FIXME: Would it be better to move it into configure?

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

9 years agoMachineRegionInfo.cpp: Another fix on MachineRegionInfo::MachineRegionInfo::recalcula...
NAKAMURA Takumi [Sun, 20 Jul 2014 11:14:55 +0000 (11:14 +0000)]
MachineRegionInfo.cpp: Another fix on MachineRegionInfo::MachineRegionInfo::recalculate() to appease msc17.

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

9 years agoRemove braces around single-statement block and rangify outer loop.
Manuel Jacob [Sun, 20 Jul 2014 09:20:47 +0000 (09:20 +0000)]
Remove braces around single-statement block and rangify outer loop.

This is a follow-up to r213474.

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

9 years ago[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.
Manuel Jacob [Sun, 20 Jul 2014 09:10:11 +0000 (09:10 +0000)]
[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.

Summary: This patch introduces two new iterator ranges and updates existing code to use it.  No functional change intended.

Test Plan: All tests (make check-all) still pass.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

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

9 years agoR600: Add missing test for concat_vectors
Matt Arsenault [Sun, 20 Jul 2014 07:13:17 +0000 (07:13 +0000)]
R600: Add missing test for concat_vectors

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

9 years agoR600: Remove unused function
Matt Arsenault [Sun, 20 Jul 2014 06:31:06 +0000 (06:31 +0000)]
R600: Remove unused function

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

9 years agoR600/SI: Remove dead code and add missing tests.
Matt Arsenault [Sun, 20 Jul 2014 06:11:02 +0000 (06:11 +0000)]
R600/SI: Remove dead code and add missing tests.

This probably was killed by some generic DAGCombiner
improvements in checking the TargetBooleanContents instead
of just 1.

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

9 years agoFix msc17 build. RegionInfo::RegionInfo::recalculate() doesn't make sense.
NAKAMURA Takumi [Sun, 20 Jul 2014 03:57:51 +0000 (03:57 +0000)]
Fix msc17 build. RegionInfo::RegionInfo::recalculate() doesn't make sense.

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

9 years agoFix -Asserts build introduced since r213456.
NAKAMURA Takumi [Sun, 20 Jul 2014 00:00:42 +0000 (00:00 +0000)]
Fix -Asserts build introduced since r213456.

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

9 years agoSure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather...
David Blaikie [Sat, 19 Jul 2014 21:19:45 +0000 (21:19 +0000)]
Sure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather than lvalue reference.

Also removes an unnecessary '.release()' that should've been a std::move
anyway. (I'm on a hunt for '.release()' calls)

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

9 years agoMC: permit emitting a symbol value as section relative
Saleem Abdulrasool [Sat, 19 Jul 2014 21:01:58 +0000 (21:01 +0000)]
MC: permit emitting a symbol value as section relative

This adds an optional parameter to the EmitSymbolValue method in MCStreamer to
permit emitting a symbol value as a section relative value.  This is to cover
the use in MCDwarf which should not really know about how to emit a section
relative value for a given target.

This addresses post-review comments from Eric Christopher in SVN r213275.

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

9 years agoRevert accidentally committed r213459
Matt Arsenault [Sat, 19 Jul 2014 19:17:33 +0000 (19:17 +0000)]
Revert accidentally committed r213459

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

9 years agoFix build with GCC.
Matt Arsenault [Sat, 19 Jul 2014 19:16:36 +0000 (19:16 +0000)]
Fix build with GCC.

Seems like a bug in either GCC or clang, but I'm
not sure which is right.

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

9 years agoXXX - Increase unroll threshold
Matt Arsenault [Sat, 19 Jul 2014 19:16:34 +0000 (19:16 +0000)]
XXX - Increase unroll threshold

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

9 years agoR600/SI: implement range reduction for sin/cos
Matt Arsenault [Sat, 19 Jul 2014 18:44:39 +0000 (18:44 +0000)]
R600/SI: implement range reduction for sin/cos

These instructions can only take a limited input range, and return
the constant value 1 out of range. We should do range reduction to
be able to process arbitrary values. Use a FRACT instruction after
normalization to achieve this. Also add a test for constant folding
with the lowered code with unsafe-fp-math enabled.

v2: use DAG lowering instead of intrinsic, adapt test
v3: calculate constant, fold pattern into instruction definition
v4: misc style fixes, add sin-fold testcase, cosmetics

Patch by Grigori Goronzy

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

9 years agoTemplatify RegionInfo so it works on MachineBasicBlocks
Matt Arsenault [Sat, 19 Jul 2014 18:29:29 +0000 (18:29 +0000)]
Templatify RegionInfo so it works on MachineBasicBlocks

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

9 years agoR600: Implement a few simple TTI queries.
Matt Arsenault [Sat, 19 Jul 2014 18:15:16 +0000 (18:15 +0000)]
R600: Implement a few simple TTI queries.

I'm not sure if these have any effect right now.

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

9 years ago[LoopVectorize] Use CreateAligned(Load|Store)
Hal Finkel [Sat, 19 Jul 2014 13:39:45 +0000 (13:39 +0000)]
[LoopVectorize] Use CreateAligned(Load|Store)

IRBuilder has CreateAligned(Load|Store) functions; use them and we don't need
to make a second call to setAlignment.

No functionality change intended.

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

9 years ago[LoopVectorize] Propagate known metadata to vectorized instructions
Hal Finkel [Sat, 19 Jul 2014 13:33:16 +0000 (13:33 +0000)]
[LoopVectorize] Propagate known metadata to vectorized instructions

There are some kinds of metadata that are safe to propagate from the scalar
instructions to the vector instructions (fpmath and tbaa currently).

Regarding TBAA, one might worry about propagating it on if-converted loads and
stores, because the metadata might have had a control dependency on the
condition, and thus actually aliased with some other non-speculated memory
access when the condition was false. However, this would be caught by the
runtime overlap checks.

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

9 years ago[x86] Fix wrong shuffle mask in test 'combine-vec-shuffle-3.ll'. No functional change.
Andrea Di Biagio [Sat, 19 Jul 2014 07:52:58 +0000 (07:52 +0000)]
[x86] Fix wrong shuffle mask in test 'combine-vec-shuffle-3.ll'. No functional change.

Function @test3c should check that the DAGCombiner is able to fold a pair of
shuffles into a new shuffle with a permute mask of <6,7,2,3>. However, one of
the shuffles in @test3c had a wrong permute mask; this prevented the DAGCombiner
from folding the shuffles into the expected result.
Now that the shuffle mask is fixed, the backend correctly folds the two shuffles
in function @test3c into a single movhlps instruction.

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

9 years agoHandle AddrSpaceCast in stripAndAccumulateInBoundsConstantOffsets
Hal Finkel [Sat, 19 Jul 2014 03:32:02 +0000 (03:32 +0000)]
Handle AddrSpaceCast in stripAndAccumulateInBoundsConstantOffsets

All of the other similar functions in that part of the file look through
addrspacecast in addition to bitcast, and I see no reason why
stripAndAccumulateInBoundsConstantOffsets shouldn't do so also.

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

9 years agoMergedLoadStoreMotion.cpp: Fix msc17 build. Member initializer is unavailable.
NAKAMURA Takumi [Sat, 19 Jul 2014 03:29:25 +0000 (03:29 +0000)]
MergedLoadStoreMotion.cpp: Fix msc17 build. Member initializer is unavailable.

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

9 years agoMake Value::isDereferenceablePointer handle offsets to pointer types with dereference...
Hal Finkel [Sat, 19 Jul 2014 03:25:16 +0000 (03:25 +0000)]
Make Value::isDereferenceablePointer handle offsets to pointer types with dereferenceable attributes

When we have a parameter (or call site return) with a dereferenceable
attribute, it can specify the size of an array pointed to by that parameter. If
we have a value for which we can accumulate a constant offset to such a
parameter, then we can use that offset in a direct comparison with the size
specified by the dereferenceable attribute.

This enables us to handle cases like this:

  int foo(int a[static 3]) {
    return a[2]; /* this is always dereferenceable */
  }

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

9 years agoARM: correct WoA __builtin_alloca handling on O0
Saleem Abdulrasool [Sat, 19 Jul 2014 01:29:51 +0000 (01:29 +0000)]
ARM: correct WoA __builtin_alloca handling on O0

When performing a dynamic stack adjustment without optimisations, we would mark
SP as def and R4 as kill.  This occurred as part of the expansion of a
WIN__CHKSTK SDNode which indicated the proper handling of SP and R4.  The result
would be that we would double define SP as part of an operation, which is
obviously incorrect.

Furthermore, the VTList for the chain had an incorrect parameter type of i32
instead of Other.

Correct these to permit proper lowering of __builtin_alloca at -O0.

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

9 years agoRemove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
David Blaikie [Sat, 19 Jul 2014 01:05:11 +0000 (01:05 +0000)]
Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"

It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

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

9 years ago[MCJIT] Add a 'decodeAddend' method to RuntimeDyldMachO and teach
Lang Hames [Sat, 19 Jul 2014 00:19:17 +0000 (00:19 +0000)]
[MCJIT] Add a 'decodeAddend' method to RuntimeDyldMachO and teach
getBasicRelocationEntry to use this rather than 'memcpy' to get the
relocation addend. Targets with non-trivial addend encodings (E.g. AArch64) can
override decodeAddend to handle immediates with interesting encodings.

No functional change.

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

9 years agoRevert "Reapply "DebugInfo: Ensure that all debug location scope chains from instruct...
Eric Christopher [Fri, 18 Jul 2014 23:57:20 +0000 (23:57 +0000)]
Revert "Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.""""

After a successful build it seems to have come back on a later build.

This reverts commit r213391.

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

9 years agoFundamentally change the MipsSubtarget replacement machinery:
Eric Christopher [Fri, 18 Jul 2014 23:41:32 +0000 (23:41 +0000)]
Fundamentally change the MipsSubtarget replacement machinery:

a) Move the replacement level decision to the target machine.
b) Create additional subtargets at the TargetMachine level to
   cache and make replacement easy.
c) Make the mips16 features obvious.
d) Remove the override logic as it no longer does anything.
e) Have MipsModuleDAGToDAGISel take only the target machine.
f) Have the constant islands pass grab the current subtarget
   from the MachineFunction (via the TargetMachine) instead
   of caching it.
g) Unconditionally initialize TLOF.
h) Remove the old complicated subtarget based resetting and
   replace it with simple conditionals.

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

9 years agoFrameLowering depends only upon the Subtarget, so only take a subtarget
Eric Christopher [Fri, 18 Jul 2014 23:33:47 +0000 (23:33 +0000)]
FrameLowering depends only upon the Subtarget, so only take a subtarget
during initialization.

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

9 years ago[PowerPC] 32-bit ELF PIC support
Hal Finkel [Fri, 18 Jul 2014 23:29:49 +0000 (23:29 +0000)]
[PowerPC] 32-bit ELF PIC support

This adds initial support for PPC32 ELF PIC (Position Independent Code; the
-fPIC variety), thus rectifying a long-standing deficiency in the PowerPC
backend.

Patch by Justin Hibbits!

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

9 years agoIn preparation for replacing the whole subtarget on the target machine,
Eric Christopher [Fri, 18 Jul 2014 23:25:04 +0000 (23:25 +0000)]
In preparation for replacing the whole subtarget on the target machine,
have target lowering take the subtarget explicitly.

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

9 years agoMake InstrInfo depend only upon the Subtarget getting passed in
Eric Christopher [Fri, 18 Jul 2014 23:25:00 +0000 (23:25 +0000)]
Make InstrInfo depend only upon the Subtarget getting passed in
rather than the TargetMachine.

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

9 years agoThe subtarget in MipsTargetLowering isn't going to change and
Eric Christopher [Fri, 18 Jul 2014 22:55:25 +0000 (22:55 +0000)]
The subtarget in MipsTargetLowering isn't going to change and
so doesn't need to be a pointer, but a reference.

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

9 years agoAvoid caching the relocation model on the subtarget, this is for
Eric Christopher [Fri, 18 Jul 2014 22:34:20 +0000 (22:34 +0000)]
Avoid caching the relocation model on the subtarget, this is for
two reasons:

a) we're already caching the target machine which contains it,
b) which relocation model you get is dependent upon whether or
not you ask before MCCodeGenInfo is constructed on the target
machine, so avoid any latent issues there.

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