oota-llvm.git
11 years agoFix setjmp on models with non-Small code model nor non-Static relocation model
Michael Liao [Wed, 17 Oct 2012 02:22:27 +0000 (02:22 +0000)]
Fix setjmp on models with non-Small code model nor non-Static relocation model

- MBB address is only valid as an immediate value in Small & Static
  code/relocation models. On other models, LEA is needed to load IP address of
  the restore MBB.
- A minor fix of MBB in MC lowering is added as well to enable target
  relocation flag being propagated into MC.

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

11 years agoUse a SparseSet instead of a BitVector for UsedInInstr in RAFast.
Jakob Stoklund Olesen [Wed, 17 Oct 2012 01:37:59 +0000 (01:37 +0000)]
Use a SparseSet instead of a BitVector for UsedInInstr in RAFast.

This is just as fast, and it makes it possible to avoid leaking the
UsedPhysRegs BitVector implementation through
MachineRegisterInfo::addPhysRegsUsed().

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

11 years agoUse a typedef to reduce some typing and reformat code accordingly.
Eric Christopher [Tue, 16 Oct 2012 23:46:25 +0000 (23:46 +0000)]
Use a typedef to reduce some typing and reformat code accordingly.

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

11 years agoVariable name cleanup.
Eric Christopher [Tue, 16 Oct 2012 23:46:23 +0000 (23:46 +0000)]
Variable name cleanup.

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

11 years agoFormatting and 80-col.
Eric Christopher [Tue, 16 Oct 2012 23:46:21 +0000 (23:46 +0000)]
Formatting and 80-col.

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

11 years agoSpacing.
Eric Christopher [Tue, 16 Oct 2012 23:46:19 +0000 (23:46 +0000)]
Spacing.

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

11 years agoAvoid rematerializing a redef immediately after the old def.
Jakob Stoklund Olesen [Tue, 16 Oct 2012 22:51:58 +0000 (22:51 +0000)]
Avoid rematerializing a redef immediately after the old def.

PR14098 contains an example where we would rematerialize a MOV8ri
immediately after the original instruction:

  %vreg7:sub_8bit<def> = MOV8ri 9; GR32_ABCD:%vreg7
  %vreg22:sub_8bit<def> = MOV8ri 9; GR32_ABCD:%vreg7

Besides being pointless, it is also wrong since the original instruction
only redefines part of the register, and the value read by the new
instruction is wrong.

The problem was the LiveRangeEdit::allUsesAvailableAt() didn't
special-case OrigIdx == UseIdx and found the wrong SSA value.

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

11 years agoRevert r166046 "Switch back to the old coalescer for now to fix the 32 bit bit"
Jakob Stoklund Olesen [Tue, 16 Oct 2012 22:51:55 +0000 (22:51 +0000)]
Revert r166046 "Switch back to the old coalescer for now to fix the 32 bit bit"

A fix for PR14098, including the test case is in the next commit.

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

11 years ago[InstCombine] Teach InstCombine how to handle an obfuscated splat.
Michael Gottesman [Tue, 16 Oct 2012 21:29:38 +0000 (21:29 +0000)]
[InstCombine] Teach InstCombine how to handle an obfuscated splat.

An obfuscated splat is where the frontend poorly generates code for a splat
using several different shuffles to create the splat, i.e.,

  %A = load <4 x float>* %in_ptr, align 16
  %B = shufflevector <4 x float> %A, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 undef, i32 undef>
  %C = shufflevector <4 x float> %B, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 4, i32 undef>
  %D = shufflevector <4 x float> %C, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 2, i32 4>

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

11 years ago[ms-inline asm] Add the helper function, isParseringInlineAsm(). To be used in a...
Chad Rosier [Tue, 16 Oct 2012 20:16:20 +0000 (20:16 +0000)]
[ms-inline asm] Add the helper function, isParseringInlineAsm(). To be used in a future commit.

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

11 years agoSimplify code. No functionality change.
Jakub Staszak [Tue, 16 Oct 2012 19:52:32 +0000 (19:52 +0000)]
Simplify code. No functionality change.

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

11 years agoCheck .rela instead of ELF64 for the compensation vaue resetting
Michael Liao [Tue, 16 Oct 2012 19:49:51 +0000 (19:49 +0000)]
Check .rela instead of ELF64 for the compensation vaue resetting

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

11 years ago80-col fixup.
Jakub Staszak [Tue, 16 Oct 2012 19:39:40 +0000 (19:39 +0000)]
80-col fixup.

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

11 years agoTeach DAG combine to fold (trunc (fptoXi x)) to (fptoXi x)
Michael Liao [Tue, 16 Oct 2012 19:38:35 +0000 (19:38 +0000)]
Teach DAG combine to fold (trunc (fptoXi x)) to (fptoXi x)

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

11 years agoSwitch back to the old coalescer for now to fix the 32 bit bit
Rafael Espindola [Tue, 16 Oct 2012 19:34:06 +0000 (19:34 +0000)]
Switch back to the old coalescer for now to fix the 32 bit bit
llvm+clang+compiler-rt bootstrap.

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

11 years agoSimplify potentially quadratic behavior while erasing elements from std::vector.
Jakub Staszak [Tue, 16 Oct 2012 19:32:31 +0000 (19:32 +0000)]
Simplify potentially quadratic behavior while erasing elements from std::vector.

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

11 years agoAnd now we can call the other 'get' method from this one and not duplicate the code.
Bill Wendling [Tue, 16 Oct 2012 18:20:09 +0000 (18:20 +0000)]
And now we can call the other 'get' method from this one and not duplicate the code.

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

11 years agoSupport v8f32 to v8i8/vi816 conversion through custom lowering
Michael Liao [Tue, 16 Oct 2012 18:14:11 +0000 (18:14 +0000)]
Support v8f32 to v8i8/vi816 conversion through custom lowering

- Add custom FP_TO_SINT on v8i16 (and v8i8 which is legalized as v8i16 due to
  vector element-wise widening) to reduce DAG combiner and its overhead added
  in X86 backend.

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

11 years agoUse the appropriate Attributes::get method to create an Attributes object.
Bill Wendling [Tue, 16 Oct 2012 18:06:06 +0000 (18:06 +0000)]
Use the appropriate Attributes::get method to create an Attributes object.

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

11 years agoSpeculative fix the mask constants to be of type uintptr_t. I don't know of any...
Owen Anderson [Tue, 16 Oct 2012 17:10:33 +0000 (17:10 +0000)]
Speculative fix the mask constants to be of type uintptr_t.  I don't know of any case where the old form was incorrect, but I'm more confident that such cases don't exist in this version.

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

11 years agoFix function parameter spelling in comments. Caught by -Wdocumentation.
Dmitri Gribenko [Tue, 16 Oct 2012 15:37:50 +0000 (15:37 +0000)]
Fix function parameter spelling in comments.  Caught by -Wdocumentation.

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

11 years agoThis patch addresses PR13949.
Bill Schmidt [Tue, 16 Oct 2012 13:30:53 +0000 (13:30 +0000)]
This patch addresses PR13949.

For the PowerPC 64-bit ELF Linux ABI, aggregates of size less than 8
bytes are to be passed in the low-order bits ("right-adjusted") of the
doubleword register or memory slot assigned to them.  A previous patch
addressed this for aggregates passed in registers.  However, small
aggregates passed in the overflow portion of the parameter save area are
still being passed left-adjusted.

The fix is made in PPCTargetLowering::LowerCall_Darwin_Or_64SVR4 on the
caller side, and in PPCTargetLowering::LowerFormalArguments_64SVR4 on
the callee side.  The main fix on the callee side simply extends
existing logic for 1- and 2-byte objects to 1- through 7-byte objects,
and correcting a constant left over from 32-bit code.  There is also a
fix to a bogus calculation of the offset to the following argument in
the parameter save area.

On the caller side, again a constant left over from 32-bit code is
fixed.  Additionally, some code for 1, 2, and 4-byte objects is
duplicated to handle the 3, 5, 6, and 7-byte objects for SVR4 only.  The
LowerCall_Darwin_Or_64SVR4 logic is getting fairly convoluted trying to
handle both ABIs, and I propose to separate this into two functions in a
future patch, at which time the duplication can be removed.

The patch adds a new test (structsinmem.ll) to demonstrate correct
passing of structures of all seven sizes.  Eight dummy parameters are
used to force these structures to be in the overflow portion of the
parameter save area.

As a side effect, this corrects the case when aggregates passed in
registers are saved into the first eight doublewords of the parameter
save area:  Previously they were stored left-justified, and now are
properly stored right-justified.  This requires changing the expected
output of existing test case structsinregs.ll.

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

11 years agoIssue:
Stepan Dyatkovskiy [Tue, 16 Oct 2012 07:16:47 +0000 (07:16 +0000)]
Issue:
Stack is formed improperly for long structures passed as byval arguments for
EABI mode.

If we took AAPCS reference, we can found the next statements:

A: "If the argument requires double-word alignment (8-byte), the NCRN (Next
Core Register Number) is rounded up to the next even register number." (5.5
Parameter Passing, Stage C, C.3).

B: "The alignment of an aggregate shall be the alignment of its most-aligned
component." (4.3 Composite Types, 4.3.1 Aggregates).

So if we have structure with doubles (9 double fields) and 3 Core unused
registers (r1, r2, r3): caller should use r2 and r3 registers only.
Currently r1,r2,r3 set is used, but it is invalid.

Callee VA routine should also use r2 and r3 regs only. All is ok here. This
behaviour is guessed by rounding up SP address with ADD+BFC operations.

Fix:
Main fix is in ARMTargetLowering::HandleByVal. If we detected AAPCS mode and
8 byte alignment, we waste odd registers then.

P.S.:
I also improved LDRB_POST_IMM regression test. Since ldrb instruction will
not generated by current regression test after this patch.

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

11 years agoReapply r165661, Patch by Shuxin Yang <shuxin.llvm@gmail.com>.
NAKAMURA Takumi [Tue, 16 Oct 2012 06:28:34 +0000 (06:28 +0000)]
Reapply r165661, Patch by Shuxin Yang <shuxin.llvm@gmail.com>.

Original message:

The attached is the fix to radar://11663049. The optimization can be outlined by following rules:

   (select (x != c), e, c) -> select (x != c), e, x),
   (select (x == c), c, e) -> select (x == c), x, e)
where the <c> is an integer constant.

 The reason for this change is that : on x86, conditional-move-from-constant needs two instructions;
however, conditional-move-from-register need only one instruction.

  While the LowerSELECT() sounds to be the most convenient place for this optimization, it turns out to be a bad place. The reason is that by replacing the constant <c> with a symbolic value, it obscure some instruction-combining opportunities which would otherwise be very easy to spot. For that reason, I have to postpone the change to last instruction-combining phase.

  The change passes the test of "make check-all -C <build-root/test" and "make -C project/test-suite/SingleSource".

Original message since r165661:

My previous change has a bug: I negated the condition code of a CMOV, and go ahead creating a new CMOV using the *ORIGINAL* condition code.

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

11 years agoCleanup whitespace.
Bill Wendling [Tue, 16 Oct 2012 06:10:45 +0000 (06:10 +0000)]
Cleanup whitespace.

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

11 years agoFix a bug in the set(I,E)/reset(I,E) methods that I recently added. The boundary...
Owen Anderson [Tue, 16 Oct 2012 06:04:27 +0000 (06:04 +0000)]
Fix a bug in the set(I,E)/reset(I,E) methods that I recently added.  The boundary condition for checking if I and E were in the same word were incorrect, and, beyond that, the mask computation was not using a wide enough constant.

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

11 years agoMove X86MCInstLower class definition into implementation file. It's not needed outside.
Craig Topper [Tue, 16 Oct 2012 06:01:50 +0000 (06:01 +0000)]
Move X86MCInstLower class definition into implementation file. It's not needed outside.

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

11 years agoCleanup whitespace.
Bill Wendling [Tue, 16 Oct 2012 06:01:44 +0000 (06:01 +0000)]
Cleanup whitespace.

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

11 years agoHave AttributesImpl defriend the Attributes class.
Bill Wendling [Tue, 16 Oct 2012 05:57:28 +0000 (05:57 +0000)]
Have AttributesImpl defriend the Attributes class.

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

11 years agoHave AttrBuilder defriend the Attributes class.
Bill Wendling [Tue, 16 Oct 2012 05:55:09 +0000 (05:55 +0000)]
Have AttrBuilder defriend the Attributes class.

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

11 years agoUse the Attributes::get method which takes an AttrVal value directly to simplify...
Bill Wendling [Tue, 16 Oct 2012 05:23:31 +0000 (05:23 +0000)]
Use the Attributes::get method which takes an AttrVal value directly to simplify the code a bit. No functionality change.

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

11 years agoPut simple c'tors inline.
Bill Wendling [Tue, 16 Oct 2012 05:22:28 +0000 (05:22 +0000)]
Put simple c'tors inline.

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

11 years agoPass in the context to the Attributes::get method.
Bill Wendling [Tue, 16 Oct 2012 05:20:51 +0000 (05:20 +0000)]
Pass in the context to the Attributes::get method.

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

11 years agoFix filename in file header.
Craig Topper [Tue, 16 Oct 2012 02:21:30 +0000 (02:21 +0000)]
Fix filename in file header.

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

11 years agoFix the cpu name and add -verify-machineinstrs.
Rafael Espindola [Tue, 16 Oct 2012 01:13:06 +0000 (01:13 +0000)]
Fix the cpu name and add -verify-machineinstrs.

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

11 years agomisched: Added handleMove support for updating all kill flags, not just for allocatab...
Andrew Trick [Tue, 16 Oct 2012 00:22:51 +0000 (00:22 +0000)]
misched: Added handleMove support for updating all kill flags, not just for allocatable regs.

This is a medium term workaround until we have a more robust solution
in the form of a register liveness utility for postRA passes.

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

11 years agoRemove unused BitVectors from getAllocatableSet().
Jakob Stoklund Olesen [Tue, 16 Oct 2012 00:05:06 +0000 (00:05 +0000)]
Remove unused BitVectors from getAllocatableSet().

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

11 years agoLTO also needs to initialize the TargetTransform infrastructure.
Nadav Rotem [Mon, 15 Oct 2012 22:50:02 +0000 (22:50 +0000)]
LTO also needs to initialize the TargetTransform infrastructure.

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

11 years agoRemove RegisterClassInfo::isReserved() and isAllocatable().
Jakob Stoklund Olesen [Mon, 15 Oct 2012 22:41:03 +0000 (22:41 +0000)]
Remove RegisterClassInfo::isReserved() and isAllocatable().

Clients can use the equivalent functions in MRI.

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

11 years agoAdd __builtin_setjmp/_longjmp supprt in X86 backend
Michael Liao [Mon, 15 Oct 2012 22:39:43 +0000 (22:39 +0000)]
Add __builtin_setjmp/_longjmp supprt in X86 backend

- Besides used in SjLj exception handling, __builtin_setjmp/__longjmp is also
  used as a light-weight replacement of setjmp/longjmp which are used to
  implementation continuation, user-level threading, and etc. The support added
  in this patch ONLY addresses this usage and is NOT intended to support SjLj
  exception handling as zero-cost DWARF exception handling is used by default
  in X86.

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

11 years agoRemove LIS::isAllocatable() and isReserved() helpers.
Jakob Stoklund Olesen [Mon, 15 Oct 2012 22:14:34 +0000 (22:14 +0000)]
Remove LIS::isAllocatable() and isReserved() helpers.

All callers can simply use the corresponding MRI functions.

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

11 years agoAdd range-based set()/reset() to BitVector. These allow fast setting/resetting of...
Owen Anderson [Mon, 15 Oct 2012 22:05:27 +0000 (22:05 +0000)]
Add range-based set()/reset() to BitVector.  These allow fast setting/resetting of ranges of bits, particularly useful when dealing with very large BitVector's.

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

11 years agoSwitch most getReservedRegs() clients to the MRI equivalent.
Jakob Stoklund Olesen [Mon, 15 Oct 2012 21:57:41 +0000 (21:57 +0000)]
Switch most getReservedRegs() clients to the MRI equivalent.

Using the cached bit vector in MRI avoids comstantly allocating and
recomputing the reserved register bit vector.

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

11 years agoFreeze the reserved registers as soon as isel is complete.
Jakob Stoklund Olesen [Mon, 15 Oct 2012 21:33:06 +0000 (21:33 +0000)]
Freeze the reserved registers as soon as isel is complete.

Also provide an MRI::getReservedRegs() function to access the frozen
register set, and isReserved() and isAllocatable() methods to test
individual registers.

The various implementations of TRI::getReservedRegs() are quite
complicated, and many passes need to look at the reserved register set.
This patch makes it possible for these passes to use the cached copy in
MRI, avoiding a lot of malloc traffic and repeated calculations.

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

11 years agoARM: v1i64 and v2i64 VBSL intrinsic support.
Jim Grosbach [Mon, 15 Oct 2012 21:23:40 +0000 (21:23 +0000)]
ARM: v1i64 and v2i64 VBSL intrinsic support.

rdar://12502028

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

11 years agoAdd dependency on llvm-bcanalyzer from tests to the CMake build.
David Blaikie [Mon, 15 Oct 2012 21:11:46 +0000 (21:11 +0000)]
Add dependency on llvm-bcanalyzer from tests to the CMake build.

This fixes a CMake build break introduced by r165739.

Thanks Jan Voung for the quick suggestion/fix.

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

11 years agoMove the Attributes::Builder outside of the Attributes class and into its own class...
Bill Wendling [Mon, 15 Oct 2012 20:35:56 +0000 (20:35 +0000)]
Move the Attributes::Builder outside of the Attributes class and into its own class named AttrBuilder. No functionality change.

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

11 years agoCheck output of the misched unit tests
Andrew Trick [Mon, 15 Oct 2012 20:33:14 +0000 (20:33 +0000)]
Check output of the misched unit tests

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

11 years agoAdd comments.
Bill Wendling [Mon, 15 Oct 2012 19:58:25 +0000 (19:58 +0000)]
Add comments.

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

11 years agoAdd a cpu to try to fix the atom builder.
Rafael Espindola [Mon, 15 Oct 2012 19:25:43 +0000 (19:25 +0000)]
Add a cpu to try to fix the atom builder.

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

11 years ago[ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instru...
Chad Rosier [Mon, 15 Oct 2012 19:08:18 +0000 (19:08 +0000)]
[ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instruction.

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

11 years agoAdd testcase for pr14088.
Rafael Espindola [Mon, 15 Oct 2012 19:00:10 +0000 (19:00 +0000)]
Add testcase for pr14088.

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

11 years agomisched tests: add a triple to speculatively fix windows builders.
Andrew Trick [Mon, 15 Oct 2012 18:21:08 +0000 (18:21 +0000)]
misched tests: add a triple to speculatively fix windows builders.

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

11 years agoMake sure we iterate over newly created instructions. Fixes pr13625. Testcase to
Rafael Espindola [Mon, 15 Oct 2012 18:21:07 +0000 (18:21 +0000)]
Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to
follow in one sec.

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

11 years agomisched: ILP scheduler for experimental heuristics.
Andrew Trick [Mon, 15 Oct 2012 18:02:27 +0000 (18:02 +0000)]
misched: ILP scheduler for experimental heuristics.

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

11 years ago[ms-inline asm] Update the end loc for ParseIntelMemOperand.
Chad Rosier [Mon, 15 Oct 2012 17:26:38 +0000 (17:26 +0000)]
[ms-inline asm] Update the end loc for ParseIntelMemOperand.

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

11 years ago[ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style
Chad Rosier [Mon, 15 Oct 2012 17:19:13 +0000 (17:19 +0000)]
[ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style
inline assembly.  For the time being, these will be called directly by clang.
However, in the near future I expect these to be sunk back into the MC layer
and more basic APIs (e.g., getClobbers(), getConstraints(), etc.) will be called
by clang.

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

11 years ago[ms-inline asm] Use incoming argument rather than hard coding to false.
Chad Rosier [Mon, 15 Oct 2012 16:50:34 +0000 (16:50 +0000)]
[ms-inline asm] Use incoming argument rather than hard coding to false.

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

11 years agoFix a typo in bitcode docs, from 165814.
Jan Wen Voung [Mon, 15 Oct 2012 16:47:58 +0000 (16:47 +0000)]
Fix a typo in bitcode docs, from 165814.

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

11 years agoResubmit the changes to llvm core to update the functions to support different pointe...
Micah Villmow [Mon, 15 Oct 2012 16:24:29 +0000 (16:24 +0000)]
Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis.

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

11 years agoPowerPC: add EmitTCEntry class for TOC creation
Adhemerval Zanella [Mon, 15 Oct 2012 15:43:14 +0000 (15:43 +0000)]
PowerPC: add EmitTCEntry class for TOC creation

This patch replaces the EmitRawText by a EmitTCEntry class (specialized for
each Streamer) in PowerPC64 TOC entry creation.

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

11 years ago[asan] fix a test
Kostya Serebryany [Mon, 15 Oct 2012 14:30:30 +0000 (14:30 +0000)]
[asan] fix a test

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

11 years ago[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. This will...
Kostya Serebryany [Mon, 15 Oct 2012 14:20:06 +0000 (14:20 +0000)]
[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. This will simplify chaining other FunctionPasses with asan. Also some minor cleanup

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

11 years agoUpdate the memcpy rewriting to fully support widened int rewriting. This
Chandler Carruth [Mon, 15 Oct 2012 10:24:43 +0000 (10:24 +0000)]
Update the memcpy rewriting to fully support widened int rewriting. This
includes extracting ints for copying elsewhere and inserting ints when
copying into the alloca. This should fix the CanSROA assertion coming
out of Clang's regression test suite.

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

11 years agoFollow-up fix to r165928: handle memset rewriting for widened integers,
Chandler Carruth [Mon, 15 Oct 2012 10:24:40 +0000 (10:24 +0000)]
Follow-up fix to r165928: handle memset rewriting for widened integers,
and generally clean up the memset handling. It had rotted a bit as the
other rewriting logic got polished more.

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

11 years agoFixed PR13938: the ARM backend was crashing because it couldn't select a VDUPLANE...
Silviu Baranga [Mon, 15 Oct 2012 09:41:32 +0000 (09:41 +0000)]
Fixed PR13938: the ARM backend was crashing because it couldn't select a VDUPLANE node with the vector input size different from the output size. This was bacause the BUILD_VECTOR lowering code didn't check that the size of the input vector was correct for using VDUPLANE.

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

11 years agoFirst major step toward addressing PR14059. This teaches SROA to handle
Chandler Carruth [Mon, 15 Oct 2012 08:40:30 +0000 (08:40 +0000)]
First major step toward addressing PR14059. This teaches SROA to handle
cases where we have partial integer loads and stores to an otherwise
promotable alloca to widen[1] those loads and stores to cover the entire
alloca and bitcast them into the appropriate type such that promotion
can proceed.

These partial loads and stores stem from an annoying confluence of ARM's
calling convention and ABI lowering and the FCA pre-splitting which
takes place in SROA. Clang lowers a { double, double } in-register
function argument as a [4 x i32] function argument to ensure it is
placed into integer 32-bit registers (a really unnerving implicit
contract between Clang and the ARM backend I would add). This results in
a FCA load of [4 x i32]* from the { double, double } alloca, and SROA
decomposes this into a sequence of i32 loads and stores. Inlining
proceeds, code gets folded, but at the end of the day, we still have i32
stores to the low and high halves of a double alloca. Widening these to
be i64 operations, and bitcasting them to double prior to loading or
storing allows promotion to proceed for these allocas.

I looked quite a bit changing the IR which Clang produces for this case
to be more friendly, but small changes seem unlikely to help. I think
the best representation we could use currently would be to pass 4 i32
arguments thereby avoiding any FCAs, but that would still require this
fix. It seems like it might eventually be nice to somehow encode the ABI
register selection choices outside of the parameter type system so that
the parameter can be a { double, double }, but the CC register
annotations indicate that this should be passed via 4 integer registers.

This patch does not address the second problem in PR14059, which is the
reverse: when a struct alloca is loaded as a *larger* single integer.

This patch also does not address some of the code quality issues with
the FCA-splitting. Those don't actually impede any optimizations really,
but they're on my list to clean up.

[1]: Pedantic footnote: for those concerned about memory model issues
here, this is safe. For the alloca to be promotable, it cannot escape or
have any use of its address that could allow these loads or stores to be
racing. Thus, widening is always safe.

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

11 years agoHoist the canConvertValue predicate and the convertValue transform out
Chandler Carruth [Mon, 15 Oct 2012 08:40:22 +0000 (08:40 +0000)]
Hoist the canConvertValue predicate and the convertValue transform out
into static helper functions. They're really quite generic and are going
to be needed elsewhere shortly.

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

11 years agoAdd an enum for the return and function indexes into the AttrListPtr object. This...
Bill Wendling [Mon, 15 Oct 2012 07:29:08 +0000 (07:29 +0000)]
Add an enum for the return and function indexes into the AttrListPtr object. This gets rid of some magic numbers.

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

11 years agoUse a ::get method to create the attribute from Attributes::AttrVals instead of a...
Bill Wendling [Mon, 15 Oct 2012 06:53:28 +0000 (06:53 +0000)]
Use a ::get method to create the attribute from Attributes::AttrVals instead of a constructor.

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

11 years agoSupply a default 'operator=' method.
Bill Wendling [Mon, 15 Oct 2012 06:34:18 +0000 (06:34 +0000)]
Supply a default 'operator=' method.

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

11 years agoMove the AttributesImpl header file into the VMCore directory so that it can be opaque.
Bill Wendling [Mon, 15 Oct 2012 05:40:12 +0000 (05:40 +0000)]
Move the AttributesImpl header file into the VMCore directory so that it can be opaque.

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

11 years agoAttributes Rewrite
Bill Wendling [Mon, 15 Oct 2012 04:46:55 +0000 (04:46 +0000)]
Attributes Rewrite

Convert the internal representation of the Attributes class into a pointer to an
opaque object that's uniqued by and stored in the LLVMContext object. The
Attributes class then becomes a thin wrapper around this opaque
object. Eventually, the internal representation will be expanded to include
attributes that represent code generation options, etc.

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

11 years agoinstcombine: Migrate strcmp and strncmp optimizations
Meador Inge [Mon, 15 Oct 2012 03:47:37 +0000 (03:47 +0000)]
instcombine: Migrate strcmp and strncmp optimizations

This patch migrates the strcmp and strncmp optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

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

11 years agoUpdate CMake build.
Benjamin Kramer [Sun, 14 Oct 2012 16:06:09 +0000 (16:06 +0000)]
Update CMake build.

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

11 years agoFix a typo that made ImmutableMap::getMaxElement() useless.
Benjamin Kramer [Sun, 14 Oct 2012 15:56:39 +0000 (15:56 +0000)]
Fix a typo that made ImmutableMap::getMaxElement() useless.

Add a basic unit test for ImmutableMap. Found by inspection.

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

11 years agoSimplify code. No functionality change.
Benjamin Kramer [Sun, 14 Oct 2012 11:15:42 +0000 (11:15 +0000)]
Simplify code. No functionality change.

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

11 years agoUnquadratize SetVector removal loops in DSE.
Benjamin Kramer [Sun, 14 Oct 2012 10:21:31 +0000 (10:21 +0000)]
Unquadratize SetVector removal loops in DSE.

Erasing from the beginning or middle of the vector is expensive, remove_if can
do it in linear time even though it's a bit ugly without lambdas.

No functionality change.

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

11 years agoRemove dead methods.
Bill Wendling [Sun, 14 Oct 2012 09:21:44 +0000 (09:21 +0000)]
Remove dead methods.

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

11 years agoRemove operator cast method in favor of querying with the correct method.
Bill Wendling [Sun, 14 Oct 2012 08:54:26 +0000 (08:54 +0000)]
Remove operator cast method in favor of querying with the correct method.

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

11 years agoFix use after free when deleting attributes in a chained folding set.
Benjamin Kramer [Sun, 14 Oct 2012 08:48:40 +0000 (08:48 +0000)]
Fix use after free when deleting attributes in a chained folding set.

Can't follow the intrusive linked list when the element is gone.

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

11 years agoDon't use the new syntax just yet.
Bill Wendling [Sun, 14 Oct 2012 08:25:35 +0000 (08:25 +0000)]
Don't use the new syntax just yet.

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

11 years agoRemove the bitwise AND operators from the Attributes class. Replace it with the equiv...
Bill Wendling [Sun, 14 Oct 2012 07:52:48 +0000 (07:52 +0000)]
Remove the bitwise AND operators from the Attributes class. Replace it with the equivalent from the builder class.

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

11 years agoRemove the bitwise assignment OR operator from the Attributes class. Replace it with...
Bill Wendling [Sun, 14 Oct 2012 07:35:59 +0000 (07:35 +0000)]
Remove the bitwise assignment OR operator from the Attributes class. Replace it with the equivalent from the builder class.

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

11 years agoRemove the bitwise OR operator from the Attributes class. Replace it with the equival...
Bill Wendling [Sun, 14 Oct 2012 07:17:34 +0000 (07:17 +0000)]
Remove the bitwise OR operator from the Attributes class. Replace it with the equivalent from the builder class.

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

11 years agoRemove the bitwise XOR operator from the Attributes class. Replace it with the equiva...
Bill Wendling [Sun, 14 Oct 2012 06:56:13 +0000 (06:56 +0000)]
Remove the bitwise XOR operator from the Attributes class. Replace it with the equivalent from the builder class.

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

11 years agoRemove the bitwise NOT operator from the Attributes class. Replace it with the equiva...
Bill Wendling [Sun, 14 Oct 2012 06:39:53 +0000 (06:39 +0000)]
Remove the bitwise NOT operator from the Attributes class. Replace it with the equivalent from the builder class.

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

11 years agoDecode the LLVM attributes from bitcode using the attributes builder.
Bill Wendling [Sun, 14 Oct 2012 04:10:01 +0000 (04:10 +0000)]
Decode the LLVM attributes from bitcode using the attributes builder.

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

11 years agoUse builder to create alignment attributes. Remove dead function.
Bill Wendling [Sun, 14 Oct 2012 03:58:29 +0000 (03:58 +0000)]
Use builder to create alignment attributes. Remove dead function.

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

11 years agoRemove dead method.
Bill Wendling [Sun, 14 Oct 2012 03:28:43 +0000 (03:28 +0000)]
Remove dead method.

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

11 years agoDon't pass in an Attributes object to something that expects an integral value.
Bill Wendling [Sun, 14 Oct 2012 03:27:15 +0000 (03:27 +0000)]
Don't pass in an Attributes object to something that expects an integral value.

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

11 years agoRemove unused private field.
Benjamin Kramer [Sat, 13 Oct 2012 18:03:34 +0000 (18:03 +0000)]
Remove unused private field.

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

11 years agoX86: Depending on the local semantics of .align this test can also emit a nopl instea...
Benjamin Kramer [Sat, 13 Oct 2012 17:38:00 +0000 (17:38 +0000)]
X86: Depending on the local semantics of .align this test can also emit a nopl instead of nopw.

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

11 years agoDocumentation: Lexicon.rst: add "BB Vectorization" and "TBAA".
Dmitri Gribenko [Sat, 13 Oct 2012 17:34:49 +0000 (17:34 +0000)]
Documentation: Lexicon.rst: add "BB Vectorization" and "TBAA".

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

11 years agoX86: Disable long nops for all cpus prior to pentiumpro/i686.
Benjamin Kramer [Sat, 13 Oct 2012 17:28:35 +0000 (17:28 +0000)]
X86: Disable long nops for all cpus prior to pentiumpro/i686.

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

11 years agoDrop <def,dead> flags when merging into an unused lane.
Jakob Stoklund Olesen [Sat, 13 Oct 2012 17:26:47 +0000 (17:26 +0000)]
Drop <def,dead> flags when merging into an unused lane.

The new coalescer can merge a dead def into an unused lane of an
otherwise live vector register.

Clear the <dead> flag when that happens since the flag refers to the
full virtual register which is still live after the partial dead def.

This fixes PR14079.

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

11 years agoinstcombine: Migrate strchr and strrchr optimizations
Meador Inge [Sat, 13 Oct 2012 16:45:37 +0000 (16:45 +0000)]
instcombine: Migrate strchr and strrchr optimizations

This patch migrates the strchr and strrchr optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

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

11 years agoinstcombine: Migrate strcat and strncat optimizations
Meador Inge [Sat, 13 Oct 2012 16:45:32 +0000 (16:45 +0000)]
instcombine: Migrate strcat and strncat optimizations

This patch migrates the strcat and strncat optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

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

11 years agoImplement new LibCallSimplifier class
Meador Inge [Sat, 13 Oct 2012 16:45:24 +0000 (16:45 +0000)]
Implement new LibCallSimplifier class

This patch implements the new LibCallSimplifier class as outlined in [1].
In addition to providing the new base library simplification infrastructure,
all the fortified library call simplifications were moved over to the new
infrastructure.  The rest of the library simplification optimizations will
be moved over with follow up patches.

NOTE: The original fortified library call simplifier located in the
SimplifyFortifiedLibCalls class was not removed because it is still
used by CodeGenPrepare.  This class will eventually go away too.

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052283.html

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

11 years agoAllow for loops in LiveIntervals::pruneValue().
Jakob Stoklund Olesen [Sat, 13 Oct 2012 16:15:31 +0000 (16:15 +0000)]
Allow for loops in LiveIntervals::pruneValue().

It is possible that the live range of the value being pruned loops back
into the kill MBB where the search started. When that happens, make sure
that the beginning of KillMBB is also pruned.

Instead of starting a DFS at KillMBB and skipping the root of the
search, start a DFS at each KillMBB successor, and allow the search to
loop back to KillMBB.

This fixes PR14078.

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