9 years agoAdd some SpecialCaseList unit tests.
Peter Collingbourne [Tue, 9 Jul 2013 22:03:12 +0000 (22:03 +0000)]
Add some SpecialCaseList unit tests.

Differential Revision: http://llvm-reviews.chandlerc.com/D1091

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

9 years agoIntroduce a SpecialCaseList ctor which takes a MemoryBuffer to make
Peter Collingbourne [Tue, 9 Jul 2013 22:03:09 +0000 (22:03 +0000)]
Introduce a SpecialCaseList ctor which takes a MemoryBuffer to make
it more unit testable, and fix memory leak in the other ctor.

Differential Revision: http://llvm-reviews.chandlerc.com/D1090

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

9 years agoRename BlackList class to SpecialCaseList and move it to Transforms/Utils.
Peter Collingbourne [Tue, 9 Jul 2013 22:02:49 +0000 (22:02 +0000)]
Rename BlackList class to SpecialCaseList and move it to Transforms/Utils.

Differential Revision: http://llvm-reviews.chandlerc.com/D1089

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

9 years agoInstSimplify: X >> X -> 0
David Majnemer [Tue, 9 Jul 2013 22:01:22 +0000 (22:01 +0000)]
InstSimplify: X >> X -> 0

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

9 years agomove test into the appropriate subdir.
Adrian Prantl [Tue, 9 Jul 2013 21:44:11 +0000 (21:44 +0000)]
move test into the appropriate subdir.

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

9 years agoTypo.
Adrian Prantl [Tue, 9 Jul 2013 21:44:06 +0000 (21:44 +0000)]

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

9 years agoFix PR16571, which is a bug in the code that checks that all of the types in the...
Nadav Rotem [Tue, 9 Jul 2013 21:38:08 +0000 (21:38 +0000)]
Fix PR16571, which is a bug in the code that checks that all of the types in the bundle are uniform.

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

9 years agoReapply an improved version of r180816/180817.
Adrian Prantl [Tue, 9 Jul 2013 20:28:37 +0000 (20:28 +0000)]
Reapply an improved version of r180816/180817.

Change the informal convention of DBG_VALUE machine instructions so that
we can express a register-indirect address with an offset of 0.
The old convention was that a DBG_VALUE is a register-indirect value if
the offset (operand 1) is nonzero. The new convention is that a DBG_VALUE
is register-indirect if the first operand is a register and the second
operand is an immediate. For plain register values the combination reg,
reg is used. MachineInstrBuilder::BuildMI knows how to build the new


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

9 years agoFixed up the comments in FastISel.h so that they conform to the LLVM style guide.
Michael Gottesman [Tue, 9 Jul 2013 20:08:46 +0000 (20:08 +0000)]
Fixed up the comments in FastISel.h so that they conform to the LLVM style guide.

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

9 years agoAdded "mode: c++" to FastISel.h header.
Michael Gottesman [Tue, 9 Jul 2013 20:00:25 +0000 (20:00 +0000)]
Added "mode: c++" to FastISel.h header.

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

9 years agoAppease buildbots after r185956: just set -mcpu explicitly, as it should have been...
Stephen Lin [Tue, 9 Jul 2013 19:27:10 +0000 (19:27 +0000)]
Appease buildbots after r185956: just set -mcpu explicitly, as it should have been from the beginning.

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

9 years agoAppease Atom buildbot after r185956 (explicitly turn on AVX)
Stephen Lin [Tue, 9 Jul 2013 18:55:52 +0000 (18:55 +0000)]
Appease Atom buildbot after r185956 (explicitly turn on AVX)

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

9 years agoWidenVecRes_BUILD_VECTOR must use the first operand's type
Hal Finkel [Tue, 9 Jul 2013 18:55:10 +0000 (18:55 +0000)]
WidenVecRes_BUILD_VECTOR must use the first operand's type

Because integer BUILD_VECTOR operands may have a larger type than the result's
vector element type, and all operands must have the same type, when widening a
BUILD_VECTOR node by adding UNDEFs, we cannot use the vector element type, but
rather must use the type of the existing operands.

Another bug found by llvm-stress.

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

9 years ago[PowerPC] Better fix for PR16556.
Bill Schmidt [Tue, 9 Jul 2013 18:50:20 +0000 (18:50 +0000)]
[PowerPC] Better fix for PR16556.

A more complete example of the bug in PR16556 was recently provided,
showing that the previous fix was not sufficient.  The previous fix is
reverted herein.

The real problem is that ReplaceNodeResults() uses LowerFP_TO_INT as
custom lowering for FP_TO_SINT during type legalization, without
checking whether the input type is handled by that routine.
LowerFP_TO_INT requires the input to be f32 or f64, so we fail when
the input is ppcf128.

I'm leaving the test case from the initial fix (r185821) in place, and
adding the new test as another crash-only check.

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

9 years agoAttempt to appease buildbot after r185956 by explicitly turning setting -fma,-fma4...
Stephen Lin [Tue, 9 Jul 2013 18:41:43 +0000 (18:41 +0000)]
Attempt to appease buildbot after r185956 by explicitly turning setting -fma,-fma4 attrs (I'm assuming they're set because the bot is running on machine that has one or the other.)

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

9 years agoAArch64/PowerPC/SystemZ/X86: This patch fixes the interface, usage, and all
Stephen Lin [Tue, 9 Jul 2013 18:16:56 +0000 (18:16 +0000)]
AArch64/PowerPC/SystemZ/X86: This patch fixes the interface, usage, and all
in-tree implementations of TargetLoweringBase::isFMAFasterThanMulAndAdd in
order to resolve the following issues with fmuladd (i.e. optional FMA)

1. On X86(-64) targets, ISD::FMA nodes are formed when lowering fmuladd
intrinsics even if the subtarget does not support FMA instructions, leading
to laughably bad code generation in some situations.

2. On AArch64 targets, ISD::FMA nodes are formed for operations on fp128,
resulting in a call to a software fp128 FMA implementation.

3. On PowerPC targets, FMAs are not generated from fmuladd intrinsics on types
like v2f32, v8f32, v4f64, etc., even though they promote, split, scalarize,
etc. to types that support hardware FMAs.

The function has also been slightly renamed for consistency and to force a
merge/build conflict for any out-of-tree target implementing it. To resolve,
see comments and fixed in-tree examples.

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

9 years agoDon't crash in SE dealing with ashr x, -1
Hal Finkel [Tue, 9 Jul 2013 18:16:16 +0000 (18:16 +0000)]
Don't crash in SE dealing with ashr x, -1

ScalarEvolution::getSignedRange uses ComputeNumSignBits from ValueTracking on
ashr instructions. ComputeNumSignBits can return zero, but this case was not
handled correctly by the code in getSignedRange which was calling:
  APInt::getSignedMinValue(BitWidth).ashr(NS - 1)
with NS = 0, resulting in an assertion failure in APInt::ashr.

Now, we just return the conservative result (as with NS == 1).

Another bug found by llvm-stress.

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

9 years agoValueTracking: Fix bugs in isKnownToBeAPowerOfTwo
David Majnemer [Tue, 9 Jul 2013 18:11:10 +0000 (18:11 +0000)]
ValueTracking: Fix bugs in isKnownToBeAPowerOfTwo

(add nsw x, (and x, y)) isn't a power of two if x is zero, it's zero
(add nsw x, (xor x, y)) isn't a power of two if y has bits set that aren't set in x

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

9 years agoSet the default insert point to the first instruction, and not to end()
Nadav Rotem [Tue, 9 Jul 2013 17:55:36 +0000 (17:55 +0000)]
Set the default insert point to the first instruction, and not to end()

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

9 years agoIRBuilder: add an assertion that checks if we try to get a debug loc from ->end();
Nadav Rotem [Tue, 9 Jul 2013 17:54:22 +0000 (17:54 +0000)]
IRBuilder: add an assertion that checks if we try to get a debug loc from ->end();

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

9 years agoDAGCombine tryFoldToZero cannot create illegal types after type legalization
Hal Finkel [Tue, 9 Jul 2013 17:02:45 +0000 (17:02 +0000)]
DAGCombine tryFoldToZero cannot create illegal types after type legalization

When folding sub x, x (and other similar constructs), where x is a vector, the
result is a vector of zeros. After type legalization, make sure that the input
zero elements have a legal type. This type may be larger than the result's
vector element type.

This was another bug found by llvm-stress.

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

9 years ago[PowerPC] Revert r185476 and fix up TLS variant kinds
Ulrich Weigand [Tue, 9 Jul 2013 16:41:09 +0000 (16:41 +0000)]
[PowerPC] Revert r185476 and fix up TLS variant kinds

In the commit message to r185476 I wrote:

>The PowerPC-specific modifiers VK_PPC_TLSGD and VK_PPC_TLSLD
>correspond exactly to the generic modifiers VK_TLSGD and VK_TLSLD.
>This causes some confusion with the asm parser, since VK_PPC_TLSGD
>is output as @tlsgd, which is then read back in as VK_TLSGD.
>To avoid this confusion, this patch removes the PowerPC-specific
>modifiers and uses the generic modifiers throughout.  (The only
>drawback is that the generic modifiers are printed in upper case
>while the usual convention on PowerPC is to use lower-case modifiers.
>But this is just a cosmetic issue.)

This was unfortunately incorrect, there is is fact another,
serious drawback to using the default VK_TLSLD/VK_TLSGD
variant kinds: using these causes ELFObjectWriter::RelocNeedsGOT
to return true, which in turn causes the ELFObjectWriter to emit
an undefined reference to _GLOBAL_OFFSET_TABLE_.

This is a problem on powerpc64, because it uses the TOC instead
of the GOT, and the linker does not provide _GLOBAL_OFFSET_TABLE_,
so the symbol remains undefined.  This means shared libraries
using TLS built with the integrated assembler are currently

While the whole RelocNeedsGOT / _GLOBAL_OFFSET_TABLE_ situation
probably ought to be properly fixed at some point, for now I'm
simply reverting the r185476 commit.  Now this in turn exposes
the breakage of handling @tlsgd/@tlsld in the asm parser that
this check-in was originally intended to fix.

To avoid this regression, I'm also adding a different fix for
this problem: while common code now parses @tlsgd as VK_TLSGD,
a special hack in the asm parser translates this code to the
platform-specific VK_PPC_TLSGD that the back-end now expects.
While this is not really pretty, it's self-contained and
shouldn't hurt anything else for now.  One the underlying
problem is fixed, this hack can be reverted again.

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

9 years agoR600: Do not predicated basic block with multiple alu clause
Vincent Lejeune [Tue, 9 Jul 2013 15:03:33 +0000 (15:03 +0000)]
R600: Do not predicated basic block with multiple alu clause

Test is not included as it is several 1000 lines long.
To test this functionnality, a test case must generate at least 2 ALU clauses,
where an ALU clause is ~110 instructions long.

NOTE: This is a candidate for the stable branch.

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

9 years agoR600: Fix a rare bug where swizzle optimization returns wrong values
Vincent Lejeune [Tue, 9 Jul 2013 15:03:25 +0000 (15:03 +0000)]
R600: Fix a rare bug where swizzle optimization returns wrong values

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

9 years agoR600: Fix wrong export reswizzling
Vincent Lejeune [Tue, 9 Jul 2013 15:03:19 +0000 (15:03 +0000)]
R600: Fix wrong export reswizzling

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

9 years agoR600: Use DAG lowering pass to handle fcos/fsin
Vincent Lejeune [Tue, 9 Jul 2013 15:03:11 +0000 (15:03 +0000)]
R600: Use DAG lowering pass to handle fcos/fsin

NOTE: This is a candidate for the stable branch.

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

9 years agoR600: Print Export Swizzle
Vincent Lejeune [Tue, 9 Jul 2013 15:03:03 +0000 (15:03 +0000)]
R600: Print Export Swizzle

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

9 years agoAdd missing getters. They will be used in llvm-ar.
Rafael Espindola [Tue, 9 Jul 2013 12:49:24 +0000 (12:49 +0000)]
Add missing getters. They will be used in llvm-ar.

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

9 years agoArchive members cannot be larger than 4GB. Return a uint32_t.
Rafael Espindola [Tue, 9 Jul 2013 12:45:11 +0000 (12:45 +0000)]
Archive members cannot be larger than 4GB. Return a uint32_t.

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

9 years agoWe never compare iterators from two archives. Assert that.
Rafael Espindola [Tue, 9 Jul 2013 12:30:10 +0000 (12:30 +0000)]
We never compare iterators from two archives. Assert that.

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

9 years agoAdd getHeader helper and move ToHeader to the cpp file.
Rafael Espindola [Tue, 9 Jul 2013 12:22:05 +0000 (12:22 +0000)]
Add getHeader helper and move ToHeader to the cpp file.

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

9 years agoAdd MC assembly/disassembly support for VRINT{A, N, P, M} to V8FP.
Joey Gouly [Tue, 9 Jul 2013 11:26:18 +0000 (11:26 +0000)]
Add MC assembly/disassembly support for VRINT{A, N, P, M} to V8FP.

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

9 years agoAdd MC assembly/disassembly support for VRINT{Z, X, R} to V8FP.
Joey Gouly [Tue, 9 Jul 2013 11:03:21 +0000 (11:03 +0000)]
Add MC assembly/disassembly support for VRINT{Z, X, R} to V8FP.

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

9 years agoDocument LLVM_USE_SANITIZER CMake option
Alexey Samsonov [Tue, 9 Jul 2013 10:56:13 +0000 (10:56 +0000)]
Document LLVM_USE_SANITIZER CMake option

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

9 years ago[PowerPC] Support ".machine any"
Ulrich Weigand [Tue, 9 Jul 2013 10:00:34 +0000 (10:00 +0000)]
[PowerPC] Support ".machine any"

The PowerPC assembler is supposed to provide a directive .machine
that allows switching the supported CPU instruction set on the fly.
Since we do not yet check CPU feature sets at all and always accept
any available instruction, this is not really useful at this point.

However, it makes sense to accept (and ignore) ".machine any" to
avoid spuriously rejecting existing assembler files that use this.

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

9 years agoRevert r185872 - "Stop emitting weak symbols into the "coal" sections"
Alexander Potapenko [Tue, 9 Jul 2013 10:00:16 +0000 (10:00 +0000)]
Revert r185872 - "Stop emitting weak symbols into the "coal" sections"

This patch broke `make check-asan` on Mac, causing ld warnings like the following one:

ld: warning: direct access in __GLOBAL__I_a to global weak symbol
___asan_mapping_scale means the weak symbol cannot be overridden at
runtime. This was likely caused by different translation units being
compiled with different visibility settings.

The resulting test binaries crashed with incorrect ASan warnings.

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

9 years agoAdd MC assembly/disassembly support for VCVT{A, N, P, M} to V8FP.
Joey Gouly [Tue, 9 Jul 2013 09:59:04 +0000 (09:59 +0000)]
Add MC assembly/disassembly support for VCVT{A, N, P, M} to V8FP.

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

9 years ago[SystemZ] Use MVC for simple load/store pairs
Richard Sandiford [Tue, 9 Jul 2013 09:46:39 +0000 (09:46 +0000)]
[SystemZ] Use MVC for simple load/store pairs

Look for patterns of the form (store (load ...), ...) in which the two
locations are known not to partially overlap.  (Identical locations are OK.)
These sequences are better implemented by MVC unless either the load or
the store could use RELATIVE LONG instructions.

The testcase showed that we weren't using LHRL and LGHRL for extload16,
only sextloadi16.  The patch fixes that too.

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

9 years ago[SystemZ] Use "STC;MVC" for memset
Richard Sandiford [Tue, 9 Jul 2013 09:32:42 +0000 (09:32 +0000)]
[SystemZ] Use "STC;MVC" for memset

Use "STC;MVC" for memsets that are too big for two STCs or MV...Is yet
small enough for a single MVC.  As with memcpy, I'm leaving longer cases
till later.

The number of tests might seem excessive, but f33 & f34 from memset-04.ll
failed the first cut because I'd not added the "?:" on the calculation
of Size1.

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

9 years agoInstCombine: Fix typo in comment for visitICmpInstWithInstAndIntCst
David Majnemer [Tue, 9 Jul 2013 09:24:35 +0000 (09:24 +0000)]
InstCombine: Fix typo in comment for visitICmpInstWithInstAndIntCst

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

9 years agoInstCombine: variations on 0xffffffff - x >= 4
David Majnemer [Tue, 9 Jul 2013 09:20:58 +0000 (09:20 +0000)]
InstCombine: variations on 0xffffffff - x >= 4

The following transforms are valid if -C is a power of 2:
(icmp ugt (xor X, C), ~C) -> (icmp ult X, C)
(icmp ult (xor X, C), -C) -> (icmp uge X, C)

These are nice, they get rid of the xor.

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

9 years agoInstCombine: X & -C != -C -> X <= u ~C
David Majnemer [Tue, 9 Jul 2013 08:09:32 +0000 (08:09 +0000)]
InstCombine: X & -C != -C -> X <= u ~C

Tests were added in r185910 somehow.

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

9 years ago[PowerPC] Support .llong and fix .word
Ulrich Weigand [Tue, 9 Jul 2013 07:59:25 +0000 (07:59 +0000)]
[PowerPC] Support .llong and fix .word

This adds support for the .llong PowerPC-specifc assembler directive.
In doing so, I notices that .word is currently incorrect: it is
supposed to define a 2-byte data element, not a 4-byte one.

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

9 years agoCommit r185909 was a misapplied patch, fix it
David Majnemer [Tue, 9 Jul 2013 07:58:32 +0000 (07:58 +0000)]
Commit r185909 was a misapplied patch, fix it

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

9 years agoInstCombine: add more transforms
David Majnemer [Tue, 9 Jul 2013 07:50:59 +0000 (07:50 +0000)]
InstCombine: add more transforms

C1-X <u C2 -> (X|(C2-1)) == C1
C1-X >u C2 -> (X|C2) == C1
X-C1 <u C2 -> (X & -C2) == C1
X-C1 >u C2 -> (X & ~C2) == C1

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

9 years agoPPC: Allocate RS spill slot for unaligned i64 load/store
Hal Finkel [Tue, 9 Jul 2013 06:34:51 +0000 (06:34 +0000)]
PPC: Allocate RS spill slot for unaligned i64 load/store

This fixes another bug found by llvm-stress!

If we happen to be doing an i64 load or store into a stack slot that has less
than a 4-byte alignment, then the frame-index elimination may need to use an
indexed load or store instruction (because the offset may not be a multiple of
4, a requirement of the STD/LD instructions). The extra register needed to hold
the offset comes from the register scavenger, and it is possible that the
scavenger will need to use an emergency spill slot. As a result, we need to
make sure that a spill slot is allocated when doing an i64 load/store into a
less-than-4-byte-aligned stack slot.

Because test cases for things like this tend to be fairly fragile, I've
concatenated a few small bugpoint-reduced test cases together to form the
regression test.

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

9 years agoCompute the size of an archive member in the constructor.
Rafael Espindola [Tue, 9 Jul 2013 05:26:25 +0000 (05:26 +0000)]
Compute the size of an archive member in the constructor.

It is always computed the same way (by parsing the header). Doing it in the
constructor simplifies the callers a bit.

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

9 years agoRemove declare but not implemented methods.
Rafael Espindola [Tue, 9 Jul 2013 05:09:08 +0000 (05:09 +0000)]
Remove declare but not implemented methods.

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

9 years agoMove some code out of line. No functionality change.
Rafael Espindola [Tue, 9 Jul 2013 03:39:35 +0000 (03:39 +0000)]
Move some code out of line. No functionality change.

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

9 years agoX86: Add comment.
Jim Grosbach [Tue, 9 Jul 2013 02:07:28 +0000 (02:07 +0000)]
X86: Add comment.

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

9 years agoX86 fast-isel: Avoid explicit AH subreg reference for [SU]Rem.
Jim Grosbach [Tue, 9 Jul 2013 02:07:25 +0000 (02:07 +0000)]
X86 fast-isel: Avoid explicit AH subreg reference for [SU]Rem.

Explicit references to %AH for an i8 remainder instruction can lead to
references to %AH in a REX prefixed instruction, which causes things to
blow up. Do the same thing in FastISel as we do for DAG isel and instead
shift %AX right by 8 bits and then extract the 8-bit subreg from that


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

9 years agoMake BinaryRef output correctly in case of empty data.
Sean Silva [Tue, 9 Jul 2013 00:54:46 +0000 (00:54 +0000)]
Make BinaryRef output correctly in case of empty data.

Previously, it would simply output nothing, but it should output an
empty string `""`.

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

9 years agoStyle fixes: remove unnecessary braces for one-statement if blocks, no else after...
Stephen Lin [Tue, 9 Jul 2013 00:44:49 +0000 (00:44 +0000)]
Style fixes: remove unnecessary braces for one-statement if blocks, no else after return, etc. No funcionality change.

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

9 years agoRevert "DebugInfo: remove unused helper function getDICompositeType."
Eric Christopher [Tue, 9 Jul 2013 00:16:56 +0000 (00:16 +0000)]
Revert "DebugInfo: remove unused helper function getDICompositeType."

This reverts commit r185876 as the functions appear to still be used
by dragonegg.

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

9 years agoFix comment
Eli Bendersky [Mon, 8 Jul 2013 23:57:07 +0000 (23:57 +0000)]
Fix comment

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

9 years agoThis patch changes the saved IRBuilder insert point from BasicBlock::iterator to...
Nadav Rotem [Mon, 8 Jul 2013 23:31:13 +0000 (23:31 +0000)]
This patch changes the saved IRBuilder insert point from BasicBlock::iterator to AssertingVH.

Commit 185883 fixes a bug in the IRBuilder that should fix the ASan bot. AssertingVH can help in exposing some RAUW problems.

Thanks Ben and Alexey!

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

9 years ago[objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed...
Michael Gottesman [Mon, 8 Jul 2013 23:30:23 +0000 (23:30 +0000)]
[objc-arc] Fix assertion in EraseInstruction so that noop on null calls when passed null do not trigger the assert.

The specific case of interest is when objc_retainBlock is passed null.

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

9 years agoFix a bug in IRBuilder::ClearInsertionPoint. The IR Builder needs to reset both the...
Nadav Rotem [Mon, 8 Jul 2013 23:27:43 +0000 (23:27 +0000)]
Fix a bug in IRBuilder::ClearInsertionPoint. The IR Builder needs to reset both the BB and the insert point inside the BB.

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

9 years agoDon't run internalize if we're outputing bit-code and not an object file.
Bill Wendling [Mon, 8 Jul 2013 23:23:03 +0000 (23:23 +0000)]
Don't run internalize if we're outputing bit-code and not an object file.

The problem with running internalize before we're ready to output an object file
is that it may change a 'weak' symbol into an internal one, but that symbol
could be needed by an external object file --- e.g. with arclite.


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

9 years agoDebugInfo: remove unused helper function getDICompositeType.
Manman Ren [Mon, 8 Jul 2013 21:55:46 +0000 (21:55 +0000)]
DebugInfo: remove unused helper function getDICompositeType.

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

9 years agoCEHCK->CHECK typo fix.
Eric Christopher [Mon, 8 Jul 2013 21:47:33 +0000 (21:47 +0000)]
CEHCK->CHECK typo fix.

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

9 years agoFix up whitespace.
Eric Christopher [Mon, 8 Jul 2013 21:47:31 +0000 (21:47 +0000)]
Fix up whitespace.

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

9 years agoStop emitting weak symbols into the "coal" sections.
Bill Wendling [Mon, 8 Jul 2013 21:34:52 +0000 (21:34 +0000)]
Stop emitting weak symbols into the "coal" sections.

The Mach-O linker has been able to support the weak-def bit on any symbol for
quite a while now. The compiler however continued to place these symbols into a
"coal" section, which required the linker to map them back to the base section

Replace the sections like this:

  __TEXT/__textcoal_nt   instead use  __TEXT/__text
  __TEXT/__const_coal    instead use  __TEXT/__const
  __DATA/__datacoal_nt   instead use  __DATA/__data


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

9 years agoNo ',' between programs.
Eric Christopher [Mon, 8 Jul 2013 21:18:54 +0000 (21:18 +0000)]
No ',' between programs.

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

9 years agoUpdate comment to avoid mentioning DbgValues which is an instance
Eric Christopher [Mon, 8 Jul 2013 21:16:18 +0000 (21:16 +0000)]
Update comment to avoid mentioning DbgValues which is an instance
variable later in the class.

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

9 years agoRevert r185852.
Manman Ren [Mon, 8 Jul 2013 20:27:34 +0000 (20:27 +0000)]
Revert r185852.

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

9 years agoFind xdot or xdot.py.
Matt Arsenault [Mon, 8 Jul 2013 20:24:54 +0000 (20:24 +0000)]
Find xdot or xdot.py.

Ubuntu installs this as xdot, so finding xdot.py would fail.

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

9 years agoAllow llvm_find_program to find alternate names
Matt Arsenault [Mon, 8 Jul 2013 20:24:49 +0000 (20:24 +0000)]
Allow llvm_find_program to find alternate names

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

9 years ago[PowerPC] Always use "assembler dialect" 1
Ulrich Weigand [Mon, 8 Jul 2013 20:20:51 +0000 (20:20 +0000)]
[PowerPC] Always use "assembler dialect" 1

A setting in MCAsmInfo defines the "assembler dialect" to use.  This is used
by common code to choose between alternatives in a multi-alternative GNU
inline asm statement like the following:

  __asm__ ("{sfe|subfe} %0,%1,%2" : "=r" (out) : "r" (in1), "r" (in2));

The meaning of these dialects is platform specific, and GCC defines those
for PowerPC to use dialect 0 for old-style (POWER) mnemonics and 1 for
new-style (PowerPC) mnemonics, like in the example above.

To be compatible with inline asm used with GCC, LLVM ought to do the same.
Specifically, this means we should always use assembler dialect 1 since
old-style mnemonics really aren't supported on any current platform.

However, the current LLVM back-end uses:
  AssemblerDialect = 1;           // New-Style mnemonics.
in PPCMCAsmInfoDarwin, and
  AssemblerDialect = 0;           // Old-Style mnemonics.
in PPCLinuxMCAsmInfo.

The Linux setting really isn't correct, we should be using new-style
mnemonics everywhere.  This is changed by this commit.

Unfortunately, the setting of this variable is overloaded in the back-end
to decide whether or not we are on a Darwin target.  This is done in
PPCInstPrinter (the "SyntaxVariant" is initialized from the MCAsmInfo
AssemblerDialect setting), and also in PPCMCExpr.  Setting AssemblerDialect
to 1 for both Darwin and Linux no longer allows us to make this distinction.

Instead, this patch uses the MCSubtargetInfo passed to createPPCMCInstPrinter
to distinguish Darwin targets, and ignores the SyntaxVariant parameter.
As to PPCMCExpr, this patch adds an explicit isDarwin argument that needs
to be passed in by the caller when creating a target MCExpr.  (To do so
this patch implicitly also reverts commit 184441.)

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

9 years agoPPC: Mark vector CC action for SETO and SETONE as Expand
Hal Finkel [Mon, 8 Jul 2013 20:00:03 +0000 (20:00 +0000)]
PPC: Mark vector CC action for SETO and SETONE as Expand

Another bug found by llvm-stress! This fixes hitting
  llvm_unreachable("Invalid integer vector compare condition");
at the end of getVCmpInst in PPCISelDAGToDAG.

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

9 years agoIR headers moved to llvm/IR some aeons ago, update documentation.
Benjamin Kramer [Mon, 8 Jul 2013 19:59:35 +0000 (19:59 +0000)]
IR headers moved to llvm/IR some aeons ago, update documentation.

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

9 years agoAdd a comment to this change, requested by Eric Christopher.
Joey Gouly [Mon, 8 Jul 2013 19:52:51 +0000 (19:52 +0000)]
Add a comment to this change, requested by Eric Christopher.

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

9 years agoStringRef: add DenseMapInfo for StringRef.
Manman Ren [Mon, 8 Jul 2013 19:17:48 +0000 (19:17 +0000)]
StringRef: add DenseMapInfo for StringRef.

Remove the implementation in include/llvm/Support/YAMLTraits.h.
Added a DenseMap type DITypeHashMap in DebugInfo.h:
  DenseMap<std::pair<StringRef, unsigned>, MDNode*>

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

9 years ago[ADT/NullablePtr] Allow implicit conversion of NullablePtr<OtherT> -> NullablePtr...
Argyrios Kyrtzidis [Mon, 8 Jul 2013 19:12:01 +0000 (19:12 +0000)]
[ADT/NullablePtr] Allow implicit conversion of NullablePtr<OtherT> -> NullablePtr<T> if OtherT is derived from T.

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

9 years agoReland "Use Clang's __has_* macros in Compiler.h ..." with fixes
Reid Kleckner [Mon, 8 Jul 2013 19:06:25 +0000 (19:06 +0000)]
Reland "Use Clang's __has_* macros in Compiler.h ..." with fixes

This reverts r185841 and relands r185831 without using

Clang prior to r161767 (between 3.1 and 3.2) does not accept
__has_attribute(const) due to rdar://10253857.  __const and __const__
are both keyword aliases of const, so they don't work either.

I was able to repro the buildbot failure using clang 3.1 and this patch
fixes it.  Various important versions of XCode use clang 2.9-ish, so
this workaround is necessary.

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

9 years agoUpdate docs to say that a FunctionPass should not inspect other functions than the...
Stephen Lin [Mon, 8 Jul 2013 18:34:39 +0000 (18:34 +0000)]
Update docs to say that a FunctionPass should not inspect other functions than the one being processed.
Please let me know if you disagree with this assessment (no one has yet, after asking on llvm-commits and LLVMDev) and I will revert.

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

9 years agoDebug Info: clean up usage of Verify.
Manman Ren [Mon, 8 Jul 2013 18:33:29 +0000 (18:33 +0000)]
Debug Info: clean up usage of Verify.

No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.

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

9 years agoARM: Improve codegen for generic vselect.
Jim Grosbach [Mon, 8 Jul 2013 18:18:52 +0000 (18:18 +0000)]
ARM: Improve codegen for generic vselect.

Fall back to by-element insert rather than building it up on the stack.


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

9 years agoDebugInfo: Correct comment & re-format a nearby loop
David Blaikie [Mon, 8 Jul 2013 17:51:28 +0000 (17:51 +0000)]
DebugInfo: Correct comment & re-format a nearby loop

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

9 years ago Fix a SCEV update problem.
Shuxin Yang [Mon, 8 Jul 2013 17:33:13 +0000 (17:33 +0000)]
 Fix a SCEV update problem.

 The symptom is seg-fault, and the root cause is that a SCEV contains a SCEVUnknown
which has null-pointer to a llvm::Value.

 This is how the problem take place:
  1). In the pristine input IR, there are two relevant instrutions Op1 and Op2,
     Op1's corresponding SCEV (denoted as SCEV(op1)) is a SCEVUnknown, and
     SCEV(Op2) contains SCEV(Op1).  None of these instructions are dead.

     Op1 : V1 = ...
     Op2 : V2 = ... // directly or indirectly (data-flow) depends on Op1

  2) Optimizer (LSR in my case) generates an instruction holding the equivalent
     value of Op1, making Op1 dead.
     Op1': V1' = ...
     Op1: V1 = ... ; now dead)
     Op2 : V2 = ... //Now deps on Op1', but the SCEV(Op2) still contains SCEV(Op1)

  3) Op1 is deleted, and call-back function is called to reset
     SCEV(Op1) to indicate it is invalid. However, SCEV(Op2) is not
     invalidated as well.

  4) Following pass get the cached, invalid SCEV(Op2), and try to manipulate it,
     and cause segfault.

 The fix:
 It seems there is no clean yet inexpensive fix. I write to dev-list
soliciting good solution, unforunately no ack. So, I decide to fix this
problem in a brute-force way:

  When ScalarEvolution::getSCEV is called, check if the cached SCEV
contains a invalid SCEVUnknow, if yes, remove the cached SCEV, and
re-evaluate the SCEV from scratch.

  I compile buch of big *.c and *.cpp, fortunately, I don't see any increase
in compile time.

 The reduced test-case has 2357 lines of code+other-stuff, too big to commit.


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

9 years agoDebugInfo: Simplify Address Pool index handling.
David Blaikie [Mon, 8 Jul 2013 17:33:10 +0000 (17:33 +0000)]
DebugInfo: Simplify Address Pool index handling.

Since the pool indexes are necessarily sequential and contiguous, just
insert things in the right place rather than having to sort the sequence
after the fact.

No functionality change.

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

9 years agoRevert: "Use Clang's __has_* macros in Compiler.h to test for features"
Quentin Colombet [Mon, 8 Jul 2013 17:32:13 +0000 (17:32 +0000)]
Revert: "Use Clang's __has_* macros in Compiler.h to test for features"

This reverts r185831 and 185833.

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

9 years agoPPC: Mark vector FREM as Expand by default
Hal Finkel [Mon, 8 Jul 2013 17:30:25 +0000 (17:30 +0000)]
PPC: Mark vector FREM as Expand by default

Another bug found by llvm-stress! This fixes crashing with:
  LLVM ERROR: Cannot select: v4f32 = frem ...

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

9 years agoclang-format this enum.
Rafael Espindola [Mon, 8 Jul 2013 16:55:56 +0000 (16:55 +0000)]
clang-format this enum.

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

9 years agoWe now always create files with the correct permissions. Simplify the interface.
Rafael Espindola [Mon, 8 Jul 2013 16:42:01 +0000 (16:42 +0000)]
We now always create files with the correct permissions. Simplify the interface.

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

9 years agoAttempt to fix Compiler.h for some self-hosting bots
Reid Kleckner [Mon, 8 Jul 2013 16:36:29 +0000 (16:36 +0000)]
Attempt to fix Compiler.h for some self-hosting bots

I tested r185831 by self-hosting clang with a recent clang, and got no
warnings.  I haven't been able to reproduce the problem locally.

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

9 years agoCreate files with the correct permission instead of changing it afterwards.
Rafael Espindola [Mon, 8 Jul 2013 16:16:51 +0000 (16:16 +0000)]
Create files with the correct permission instead of changing it afterwards.

No intended functionality change.

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

9 years agoUse Clang's __has_* macros in Compiler.h to test for features
Reid Kleckner [Mon, 8 Jul 2013 15:31:29 +0000 (15:31 +0000)]
Use Clang's __has_* macros in Compiler.h to test for features

When targetting Windows, clang does not define __GNUC__, and as a result
we don't use our attributes with it.  This leads to warnings about
unused functions that are already annotated with LLVM_ATTRIBUTE_UNUSED.
Rather than testing for __clang__, we can use its __has_attribute and
__has_builtin macros directlty.

While I'm here, conditionally define and use __GNUC_PREREQ for gcc
version checks.  Spelling the check out with three comparisons is
verbose and error prone.

Reviewers: aaron.ballman

Differential Revision: http://llvm-reviews.chandlerc.com/D1080

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

9 years agoCreate files with the correct permission instead of changing it afterwards.
Rafael Espindola [Mon, 8 Jul 2013 15:22:09 +0000 (15:22 +0000)]
Create files with the correct permission instead of changing it afterwards.

Not intended functionality change.

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

9 years ago[PowerPC] Support time base instructions
Ulrich Weigand [Mon, 8 Jul 2013 15:20:38 +0000 (15:20 +0000)]
[PowerPC] Support time base instructions

This adds support for the old-style time base instructions;
while new programs are supposed to use mfspr, the mftb instructions
are still supported and in use by existing assembler files.

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

9 years ago[PowerPC] Support basic compare mnemonics
Ulrich Weigand [Mon, 8 Jul 2013 14:49:37 +0000 (14:49 +0000)]
[PowerPC] Support basic compare mnemonics

This adds support for the basic mnemoics (with the L operand) for the
fixed-point compare instructions.  These are defined as aliases for the
already existing CMPW/CMPD patterns, depending on the value of L.

This requires use of InstAlias patterns with immediate literal operands.
To make this work, we need two further changes:

 - define a RegisterPrefix, because otherwise literals 0 and 1 would
   be parsed as literal register names

 - provide a PPCAsmParser::validateTargetOperandClass routine to
   recognize immediate literals (like ARM does)

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

9 years agoFixes problem when calling llvm-ar from an unmodifiable directory.
Manuel Klimek [Mon, 8 Jul 2013 14:44:57 +0000 (14:44 +0000)]
Fixes problem when calling llvm-ar from an unmodifiable directory.

This fixes a regression introduced by r185726: the new call to get
a unique file does not prepend the system temporary directory, so
we need to anchor on the file that the temporary file gets moved
to to ensure we're on the same file system.

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

9 years agoImprove the comment from r185794 (re: PromoteIntRes_BUILD_VECTOR)
Hal Finkel [Mon, 8 Jul 2013 14:40:04 +0000 (14:40 +0000)]
Improve the comment from r185794 (re: PromoteIntRes_BUILD_VECTOR)

In response to Duncan's review, I believe that the original comment was not as
clear as it could be. Hopefully, this is better.

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

9 years ago[PowerPC] Fix PR16556 (handle undef ppcf128 in LowerFP_TO_INT).
Bill Schmidt [Mon, 8 Jul 2013 14:22:45 +0000 (14:22 +0000)]
[PowerPC] Fix PR16556 (handle undef ppcf128 in LowerFP_TO_INT).

PPCTargetLowering::LowerFP_TO_INT() expects its source operand to be
either an f32 or f64, but this is not checked.  A long double
(ppcf128) operand will normally be custom-lowered to a conversion to
f64 in this context.  However, this isn't the case for an UNDEF node.

This patch recognizes a ppcf128 as a legal source operand for
FP_TO_INT only if it's an undef, in which case it creates an undef of
the target type.

At some point we might want to do a wholesale custom lowering of
ISD::UNDEF when the type is ppcf128, but it's not really clear that's
a great idea, and probably more work than it's worth for a situation
that only arises in the case of a programming error.  At this point I
think simple is best.

The test case comes from PR16556, and is a crash-test only.

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

9 years agoConvert an OCaml binding grep test to FileCheck
Reid Kleckner [Mon, 8 Jul 2013 14:14:22 +0000 (14:14 +0000)]
Convert an OCaml binding grep test to FileCheck

I shaved this yak because I mistakenly thought that this was one of the
last grep tests.  Turns out my search was skipping .ll files, for which
there are ~1200 more tests using grep.

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

9 years agoInstCombine: Fold X-C1 <u 2 -> (X & -2) == C1
David Majnemer [Mon, 8 Jul 2013 11:53:08 +0000 (11:53 +0000)]
InstCombine: Fold X-C1 <u 2 -> (X & -2) == C1

Back in r179493 we determined that two transforms collided with each
other.  The fix back then was to reorder the transforms so that the
preferred transform would give it a try and then we would try the
secondary transform.  However, it was noted that the best approach would
canonicalize one transform into the other, removing the collision and
allowing us to optimize IR given to us in that form.

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

9 years agoReuse %rax after calling __chkstk on win64
Nico Rieck [Mon, 8 Jul 2013 11:20:11 +0000 (11:20 +0000)]
Reuse %rax after calling __chkstk on win64

Reapply this as I reverted the wrong commit.

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

9 years agoRevert "Proper va_arg/va_copy lowering on win64"
Nico Rieck [Mon, 8 Jul 2013 11:19:44 +0000 (11:19 +0000)]
Revert "Proper va_arg/va_copy lowering on win64"

This reverts commit 2b52880592a525cfe04d8f9008a35da8c2ea94c3.

Needs review.

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

9 years ago[SystemZ] Remove unwanted part from last commit
Richard Sandiford [Mon, 8 Jul 2013 09:55:36 +0000 (09:55 +0000)]
[SystemZ] Remove unwanted part from last commit

I was originally going to use MVC for memmove too, but that's less of
a clear win.  Remove some accidental left-overs in the previous commit.

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

9 years ago[SystemZ] Use MVC for memcpy
Richard Sandiford [Mon, 8 Jul 2013 09:35:23 +0000 (09:35 +0000)]
[SystemZ] Use MVC for memcpy

Use MVC for memcpy in cases where a single MVC is enough.  Using MVC is
a win for longer copies too, but I'll leave that for later.

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