oota-llvm.git
12 years agoX86: optimization for max-like struct
Manman Ren [Tue, 1 May 2012 17:16:15 +0000 (17:16 +0000)]
X86: optimization for max-like struct

This patch will optimize the following cases on X86
(a > b) ? (a-b) : 0
(a >= b) ? (a-b) : 0
(b < a) ? (a-b) : 0
(b <= a) ? (a-b) : 0

FROM
movl    %edi, %ecx
subl    %esi, %ecx
cmpl    %edi, %esi
movl    $0, %eax
cmovll  %ecx, %eax
TO
xorl    %eax, %eax
subl    %esi, %edi
cmovll  %eax, %edi
movl    %edi, %eax

rdar: 10734411

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

12 years agoX86: Use StackRegister instead of FrameRegister in getFrameIndexReference (to generat...
Alexey Samsonov [Tue, 1 May 2012 15:16:06 +0000 (15:16 +0000)]
X86: Use StackRegister instead of FrameRegister in getFrameIndexReference (to generate debug info for local variables) if stack needs realignment

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

12 years agoMove MipsDisassembler classes into an anonymous namespace.
Benjamin Kramer [Tue, 1 May 2012 14:34:24 +0000 (14:34 +0000)]
Move MipsDisassembler classes into an anonymous namespace.

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

12 years agoRegression test for PR2960.
Jay Foad [Tue, 1 May 2012 11:11:34 +0000 (11:11 +0000)]
Regression test for PR2960.

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

12 years agoValue-initialize global to avoid global construction.
Benjamin Kramer [Tue, 1 May 2012 10:48:02 +0000 (10:48 +0000)]
Value-initialize global to avoid global construction.

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

12 years agoRuntimeDyld cleanup:
Eli Bendersky [Tue, 1 May 2012 10:41:12 +0000 (10:41 +0000)]
RuntimeDyld cleanup:

- Improved parameter names for clarity
- Added comments
- emitCommonSymbols should return void because its return value is not being
  used anywhere
- Attempt to reduce the usage of the RelocationValueRef type. Restricts it
  for a single goal and may serve as a step for eventual removal.

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

12 years agoYAMLParser: get rid of global ctors & dtors.
Benjamin Kramer [Tue, 1 May 2012 10:19:59 +0000 (10:19 +0000)]
YAMLParser: get rid of global ctors & dtors.

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

12 years agoChange the PassManager from a reference to a pointer.
Bill Wendling [Tue, 1 May 2012 08:27:43 +0000 (08:27 +0000)]
Change the PassManager from a reference to a pointer.

The TargetPassManager's default constructor wants to initialize the PassManager
to 'null'. But it's illegal to bind a null reference to a null l-value. Make the
ivar a pointer instead.
PR12468

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

12 years agoAllow BMI, AES, F16C, POPCNT, FMA3, and CLMUL to be detected on AMD processors.
Craig Topper [Tue, 1 May 2012 07:10:32 +0000 (07:10 +0000)]
Allow BMI, AES, F16C, POPCNT, FMA3, and CLMUL to be detected on AMD processors.

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

12 years agoRuntimeDyld code cleanup:
Eli Bendersky [Tue, 1 May 2012 06:58:59 +0000 (06:58 +0000)]
RuntimeDyld code cleanup:

- There's no point having a different type for the local and global symbol
  tables.
- Renamed SymbolTable to GlobalSymbolTable to clarify the intention
- Improved const correctness where relevant

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

12 years agoMake XOP and FMA4 require SSE4A to match GCC behavior. Use this to simplify Bulldozer...
Craig Topper [Tue, 1 May 2012 06:54:48 +0000 (06:54 +0000)]
Make XOP and FMA4 require SSE4A to match GCC behavior. Use this to simplify Bulldozer feature list.

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

12 years agoAttempt to handle MRMInitReg in emitVEXOpcodePrefix. Hopefully fixes PR12711.
Craig Topper [Tue, 1 May 2012 06:34:01 +0000 (06:34 +0000)]
Attempt to handle MRMInitReg in emitVEXOpcodePrefix. Hopefully fixes PR12711.

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

12 years agoRemoved examples of stack frame inspection which no longer work for old JIT.
Eli Bendersky [Tue, 1 May 2012 06:15:40 +0000 (06:15 +0000)]
Removed examples of stack frame inspection which no longer work for old JIT.
Added an example of MCJIT-based debugging.

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

12 years agoMake XOP imply AVX as its needed to legalize the registers types.
Craig Topper [Tue, 1 May 2012 05:41:41 +0000 (05:41 +0000)]
Make XOP imply AVX as its needed to legalize the registers types.

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

12 years agoRemove HasSSE2 from AES and CLMUL predicates. It's now implied by the HasAES and...
Craig Topper [Tue, 1 May 2012 05:35:02 +0000 (05:35 +0000)]
Remove HasSSE2 from AES and CLMUL predicates. It's now implied by the HasAES and HasCLMUL predicates.

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

12 years agoMake CLMUL and AES imply SSE2 since its needed to legalize the type.
Craig Topper [Tue, 1 May 2012 05:28:32 +0000 (05:28 +0000)]
Make CLMUL and AES imply SSE2 since its needed to legalize the type.

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

12 years agoEnable AVX and FMA4 for AMD Bulldozer processors.
Craig Topper [Tue, 1 May 2012 05:18:13 +0000 (05:18 +0000)]
Enable AVX and FMA4 for AMD Bulldozer processors.

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

12 years agoAn instruction in a loop is not guaranteed to be executed just because the loop
Nick Lewycky [Tue, 1 May 2012 04:03:01 +0000 (04:03 +0000)]
An instruction in a loop is not guaranteed to be executed just because the loop
has no exit blocks. Fixes PR12706!

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

12 years agoAdd support for llvm.arm.neon.vmull* intrinsics to InstCombine. Fixes
Lang Hames [Tue, 1 May 2012 00:20:38 +0000 (00:20 +0000)]
Add support for llvm.arm.neon.vmull* intrinsics to InstCombine. Fixes
<rdar://problem/11291436>.

This is a second attempt at a fix for this, the first was r155468. Thanks
to Chandler, Bob and others for the feedback that helped me improve this.

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

12 years agoAdd some constantness. No functionality change.
Jakub Staszak [Mon, 30 Apr 2012 23:41:30 +0000 (23:41 +0000)]
Add some constantness. No functionality change.

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

12 years agoX86: optimization for -(x != 0)
Manman Ren [Mon, 30 Apr 2012 22:51:25 +0000 (22:51 +0000)]
X86: optimization for -(x != 0)

This patch will optimize -(x != 0) on X86
FROM
cmpl $0x01,%edi
sbbl %eax,%eax
notl %eax
TO
negl %edi
sbbl %eax %eax

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

12 years agoARM: Diagnostics for out of range fixups.
Jim Grosbach [Mon, 30 Apr 2012 22:30:43 +0000 (22:30 +0000)]
ARM: Diagnostics for out of range fixups.

Replace some assert() calls w/ actual diagnostics. In a perfect world,
there'd be range checks on these values long before things ever reached
this code. For now, though, issuing a better-late-than-never diagnostic
is still a big improvement over assert().

rdar://11347287

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

12 years agoFix address calculation error from r155744.
Jakob Stoklund Olesen [Mon, 30 Apr 2012 20:19:00 +0000 (20:19 +0000)]
Fix address calculation error from r155744.

This was exposed by SingleSource/UnitTests/Vector/constpool.c.

The computed size of a basic block isn't always a multiple of its known
alignment, and that can introduce extra alignment padding after the
block.

<rdar://problem/11347135>

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

12 years agofix typo
Sebastian Pop [Mon, 30 Apr 2012 20:06:58 +0000 (20:06 +0000)]
fix typo

Thanks to "Gabor Greif" <ggreif@gmail.com> for reporting this problem.

The configure flag should be --with-default-sysroot as documented, and
not --with-sysroot.  The reason we don't want to define --with-sysroot
is that GCC has a configure flag by that name and it has a different
semantics.

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

12 years agotest/CodeGen/X86/select.ll: remove spaces
Manman Ren [Mon, 30 Apr 2012 18:54:27 +0000 (18:54 +0000)]
test/CodeGen/X86/select.ll: remove spaces

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

12 years agoTidy up. No functional change intended.
Chad Rosier [Mon, 30 Apr 2012 17:47:15 +0000 (17:47 +0000)]
Tidy up.  No functional change intended.

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

12 years agoFix fastcc structure return with fast-isel on x86-32
Derek Schuff [Mon, 30 Apr 2012 16:57:15 +0000 (16:57 +0000)]
Fix fastcc structure return with fast-isel on x86-32

On x86-32, structure return via sret lets the callee pop the hidden
pointer argument off the stack, which the caller then re-pushes.
However if the calling convention is fastcc, then a register is used
instead, and the caller should not adjust the stack. This is
implemented with a check of IsTailCallConvention
X86TargetLowering::LowerCall but is now checked properly in
X86FastISel::DoSelectCall.

(this time, actually commit what was reviewed!)

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

12 years agoDon't introduce illegal types when creating vmull operations. <rdar://11324364>
Bob Wilson [Mon, 30 Apr 2012 16:53:34 +0000 (16:53 +0000)]
Don't introduce illegal types when creating vmull operations. <rdar://11324364>

ARM BUILD_VECTORs created after type legalization cannot use i8 or i16
operands, since those types are not legal.  Instead use i32 operands, which
will be implicitly truncated by the BUILD_VECTOR to match the element type.

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

12 years agoIt doesn't make sense to move symbol relocations to section relocations when
Eli Bendersky [Mon, 30 Apr 2012 12:15:58 +0000 (12:15 +0000)]
It doesn't make sense to move symbol relocations to section relocations when
relocations are resolved.  It's much more reasonable to do this decision when
relocations are just being added - we have all the information at that point.

Also a bit of renaming and extra comments to clarify extensions.

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

12 years agoJust mark the sign bit as known zero, rather than any other irrelevant bits
Duncan Sands [Mon, 30 Apr 2012 11:56:58 +0000 (11:56 +0000)]
Just mark the sign bit as known zero, rather than any other irrelevant bits
known zero in the LHS.  Fixes PR12541.

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

12 years agoSecond attempt at PR12573:
Bill Wendling [Mon, 30 Apr 2012 10:44:54 +0000 (10:44 +0000)]
Second attempt at PR12573:

Allow the "SplitCriticalEdge" function to split the edge to a landing pad. If
the pass is *sure* that it thinks it knows what it's doing, then it may go ahead
and specify that the landing pad can have its critical edge split. The loop
unswitch pass is one of these passes. It will split the critical edges of all
edges coming from a loop to a landing pad not within the loop. Doing so will
retain important loop analysis information, such as loop simplify.

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

12 years agoUse an ArrayRef instead of explicit vector type.
Bill Wendling [Mon, 30 Apr 2012 10:25:51 +0000 (10:25 +0000)]
Use an ArrayRef instead of explicit vector type.

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

12 years agoCode cleanup in RuntimeDyld:
Eli Bendersky [Mon, 30 Apr 2012 10:06:27 +0000 (10:06 +0000)]
Code cleanup in RuntimeDyld:

- Add comments
- Change field names to be more reasonable
- Fix indentation and naming to conform to coding conventions
- Remove unnecessary includes / replace them by forward declatations

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

12 years agoRemove hack from r154987. The problem persists even with it, so it's not even a good...
Bill Wendling [Mon, 30 Apr 2012 09:23:48 +0000 (09:23 +0000)]
Remove hack from r154987. The problem persists even with it, so it's not even a good hack.

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

12 years agoNo need to normalize index before calling Extract128BitVector
Craig Topper [Mon, 30 Apr 2012 05:17:10 +0000 (05:17 +0000)]
No need to normalize index before calling Extract128BitVector

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

12 years agoCopied all the VEX prefix encoding code from X86MCCodeEmitter to the x86 JIT emitter...
Pete Cooper [Mon, 30 Apr 2012 03:56:44 +0000 (03:56 +0000)]
Copied all the VEX prefix encoding code from X86MCCodeEmitter to the x86 JIT emitter.  Needs some major refactoring as these two code emitters are almost identical

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

12 years agoMake sure HoistInsertPosition finds a position that is dominated by all
Rafael Espindola [Mon, 30 Apr 2012 03:53:06 +0000 (03:53 +0000)]
Make sure HoistInsertPosition finds a position that is dominated by all
inputs.

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

12 years agoRemove unneeded casts. No functionality change.
Jakub Staszak [Sun, 29 Apr 2012 20:52:53 +0000 (20:52 +0000)]
Remove unneeded casts. No functionality change.

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

12 years agoRemove superfluous 'inline'
Craig Topper [Sun, 29 Apr 2012 20:27:47 +0000 (20:27 +0000)]
Remove superfluous 'inline'

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

12 years agoSimplify code a bit. No functional change intended.
Craig Topper [Sun, 29 Apr 2012 20:22:05 +0000 (20:22 +0000)]
Simplify code a bit. No functional change intended.

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

12 years agoUpdate the documentation of CellSPU, in case it gets removed in 3.1.
Kalle Raiskila [Sun, 29 Apr 2012 20:00:55 +0000 (20:00 +0000)]
Update the documentation of CellSPU, in case it gets removed in 3.1.

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

12 years agoRegisterPressure: ArrayRefize some functions for better readability. No functionality...
Benjamin Kramer [Sun, 29 Apr 2012 18:52:56 +0000 (18:52 +0000)]
RegisterPressure: ArrayRefize some functions for better readability. No functionality change.

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

12 years agoFix some formatting, grammar and style issues and add a couple of missing comments.
Eli Bendersky [Sun, 29 Apr 2012 12:40:47 +0000 (12:40 +0000)]
Fix some formatting, grammar and style issues and add a couple of missing comments.

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

12 years agoRemove redundant line (the memory manager is set above to the same object
Eli Bendersky [Sun, 29 Apr 2012 11:14:59 +0000 (11:14 +0000)]
Remove redundant line (the memory manager is set above to the same object
if !ForceInterpreteri). It has no effect (apart from a memory leak...)

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

12 years agoSmallVector: Don't rely on having an assignment operator around in push_back for...
Benjamin Kramer [Sun, 29 Apr 2012 10:53:29 +0000 (10:53 +0000)]
SmallVector: Don't rely on having an assignment operator around in push_back for POD-like types.

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

12 years agoFix comments from copy-paste to a more relevant meaning
Eli Bendersky [Sun, 29 Apr 2012 10:26:26 +0000 (10:26 +0000)]
Fix comments from copy-paste to a more relevant meaning

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

12 years agoAdd constants for first and last integer vector types to be consistent with floating...
Craig Topper [Sun, 29 Apr 2012 07:25:46 +0000 (07:25 +0000)]
Add constants for first and last integer vector types to be consistent with floating point.

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

12 years agoRemove tab characters
Craig Topper [Sun, 29 Apr 2012 07:07:36 +0000 (07:07 +0000)]
Remove tab characters

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

12 years agoMark the default cases of MVT::getVectorElementType and MVT:getVectorNumElements...
Craig Topper [Sun, 29 Apr 2012 07:06:58 +0000 (07:06 +0000)]
Mark the default cases of MVT::getVectorElementType and MVT:getVectorNumElements as unreachable to reduce code size.

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

12 years agoDon't update spill weights when joining intervals.
Jakob Stoklund Olesen [Sat, 28 Apr 2012 19:19:11 +0000 (19:19 +0000)]
Don't update spill weights when joining intervals.

We don't compute spill weights until after coalescing anyway.

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

12 years agoSpring cleaning - Delete dead code.
Jakob Stoklund Olesen [Sat, 28 Apr 2012 19:19:07 +0000 (19:19 +0000)]
Spring cleaning - Delete dead code.

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

12 years agoIf the __is_trivially_copyable type trait is available use it as the baseline for...
Benjamin Kramer [Sat, 28 Apr 2012 16:22:31 +0000 (16:22 +0000)]
If the __is_trivially_copyable type trait is available use it as the baseline for isPodLike.

This way we can enable the POD-like class optimization for a lot more classes,
saving ~120k of code in clang/i386/Release+Asserts when selfhosting.

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

12 years agoUse the most basic superclass of SmallVector in ArrayRef.
Benjamin Kramer [Sat, 28 Apr 2012 16:22:26 +0000 (16:22 +0000)]
Use the most basic superclass of SmallVector in ArrayRef.

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

12 years agoFix a problem with blocks that need to be split twice.
Jakob Stoklund Olesen [Sat, 28 Apr 2012 06:21:38 +0000 (06:21 +0000)]
Fix a problem with blocks that need to be split twice.

The code could search past the end of the basic block when there was
already a constant pool entry after the block.

Test case with giant basic block in SingleSource/UnitTests/Vector/constpool.c

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

12 years agoReapply 155668: Fix the SD scheduler to avoid gluing the same node twice.
Andrew Trick [Sat, 28 Apr 2012 01:03:23 +0000 (01:03 +0000)]
Reapply 155668: Fix the SD scheduler to avoid gluing the same node twice.

This time, also fix the caller of AddGlue to properly handle
incomplete chains. AddGlue had failure modes, but shamefully hid them
from its caller. It's luck ran out.

Fixes rdar://11314175: BuildSchedUnits assert.

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

12 years agoARM: Thumb add(sp plus register) asm constraints.
Jim Grosbach [Fri, 27 Apr 2012 23:51:36 +0000 (23:51 +0000)]
ARM: Thumb add(sp plus register) asm constraints.

Make sure when parsing the Thumb1 sp+register ADD instruction that
the source and destination operands match. In thumb2, just use the
wide encoding if they don't. In Thumb1, issue a diagnostic.

rdar://11219154

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

12 years agoARM: Tweak tADDrSP definition for consistent operand order.
Jim Grosbach [Fri, 27 Apr 2012 23:51:33 +0000 (23:51 +0000)]
ARM: Tweak tADDrSP definition for consistent operand order.

Make the operand order of the instruction match that of the asm syntax.

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

12 years agoRevert r155745
Derek Schuff [Fri, 27 Apr 2012 23:37:41 +0000 (23:37 +0000)]
Revert r155745

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

12 years agoFix fastcc structure return with fast-isel on x86-32
Derek Schuff [Fri, 27 Apr 2012 23:27:17 +0000 (23:27 +0000)]
Fix fastcc structure return with fast-isel on x86-32

On x86-32, structure return via sret lets the callee pop the hidden
pointer argument off the stack, which the caller then re-pushes.
However if the calling convention is fastcc, then a register is used
instead, and the caller should not adjust the stack. This is
implemented with a check of IsTailCallConvention
X86TargetLowering::LowerCall but is now checked properly in
X86FastISel::DoSelectCall.

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

12 years agoTrack worst case alignment padding more accurately.
Jakob Stoklund Olesen [Fri, 27 Apr 2012 22:58:38 +0000 (22:58 +0000)]
Track worst case alignment padding more accurately.

Previously, ARMConstantIslandPass would conservatively compute the
address of an aligned basic block as:

  RoundUpToAlignment(Offset + UnknownPadding)

This worked fine for the layout algorithm itself, but it could fool the
verify() function because it accounts for alignment padding twice: Once
when adding the worst case UnknownPadding, and again by rounding up the
fictional block offset. This meant that when optimizeThumb2Instructions
would shrink an instruction, the conservative distance estimate could
grow. That shouldn't be possible since the woorst case alignment padding
wss already included.

This patch drops the use of RoundUpToAlignment, and depends only on
worst case padding to compute conservative block offsets. This has the
weird effect that the computed offset for an aligned block may not be
aligned.

The important difference is that shrinking an instruction can never
cause the estimated distance between two instructions to grow. The
estimated distance is always larger than the real distance that only the
assembler knows.

<rdar://problem/11339352>

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

12 years agoTemporarily revert r155668: Fix the SD scheduler to avoid gluing.
Andrew Trick [Fri, 27 Apr 2012 22:55:59 +0000 (22:55 +0000)]
Temporarily revert r155668: Fix the SD scheduler to avoid gluing.

This definitely caused regression with ARM -mno-thumb.

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

12 years agoUse 'unsigned' instead of 'int' in several places when retrieving number of vector...
Craig Topper [Fri, 27 Apr 2012 22:54:43 +0000 (22:54 +0000)]
Use 'unsigned' instead of 'int' in several places when retrieving number of vector elements.

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

12 years agoAdd x86-specific DAG combine to simplify:
Chad Rosier [Fri, 27 Apr 2012 22:33:25 +0000 (22:33 +0000)]
Add x86-specific DAG combine to simplify:

 x == -y --> x+y == 0
 x != -y --> x+y != 0

On x86, the generated code goes from
   negl    %esi
   cmpl    %esi, %edi
   je    .LBB0_2
to
   addl    %esi, %edi
   je    .L4

This case is correctly handled for ARM with "cmn".

Patch by Manman Ren.
rdar://11245199
PR12545

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

12 years ago[Support/YAMLParser] Fix ASan found bugs.
Michael J. Spencer [Fri, 27 Apr 2012 21:12:20 +0000 (21:12 +0000)]
[Support/YAMLParser] Fix ASan found bugs.

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

12 years agoTidy up spacing.
Craig Topper [Fri, 27 Apr 2012 21:05:09 +0000 (21:05 +0000)]
Tidy up spacing.

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

12 years agoMake test less fragile.
Evan Cheng [Fri, 27 Apr 2012 20:48:18 +0000 (20:48 +0000)]
Make test less fragile.

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

12 years agoDon't vectorize target-specific types (ppc_fp128, x86_fp80, etc.).
Hal Finkel [Fri, 27 Apr 2012 19:34:00 +0000 (19:34 +0000)]
Don't vectorize target-specific types (ppc_fp128, x86_fp80, etc.).

Target specific types should not be vectorized. As a practical matter,
these types are already register matched (at least in the x86 case),
and codegen does not always work correctly (at least in the ppc case,
and this is not worth fixing because ppc_fp128 is currently broken and
will probably go away soon).

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

12 years agoChange recurse depth limit to uint32 to fix warning.
David Blaikie [Fri, 27 Apr 2012 19:30:32 +0000 (19:30 +0000)]
Change recurse depth limit to uint32 to fix warning.

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

12 years agoSwitch to c-style comments in a C file.
David Blaikie [Fri, 27 Apr 2012 19:30:29 +0000 (19:30 +0000)]
Switch to c-style comments in a C file.

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

12 years agoMiscellaneous accumulated cleanups.
Dan Gohman [Fri, 27 Apr 2012 18:56:31 +0000 (18:56 +0000)]
Miscellaneous accumulated cleanups.

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

12 years agoFix the order of the operands in the llvm.fma intrinsic patterns for ARM,
Lang Hames [Fri, 27 Apr 2012 18:51:24 +0000 (18:51 +0000)]
Fix the order of the operands in the llvm.fma intrinsic patterns for ARM,
<rdar://problem/11325085>.

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

12 years agoAdd an early bailout to IsValueFullyAvailableInBlock from deeply nested blocks.
Mon P Wang [Fri, 27 Apr 2012 18:09:28 +0000 (18:09 +0000)]
Add an early bailout to IsValueFullyAvailableInBlock from deeply nested blocks.
The limit is set to an arbitrary 1000 recursion depth to avoid stack overflow
issues. <rdar://problem/11286839>.

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

12 years agoReapply r155682, making constant folding more consistent, with a fix to work
Dan Gohman [Fri, 27 Apr 2012 17:50:22 +0000 (17:50 +0000)]
Reapply r155682, making constant folding more consistent, with a fix to work
properly with how the code handles all-undef PHI nodes.

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

12 years agoFix ARM assembly parsing for upper case condition codes on IT instructions.
Richard Barton [Fri, 27 Apr 2012 17:34:01 +0000 (17:34 +0000)]
Fix ARM assembly parsing for upper case condition codes on IT instructions.

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

12 years agoRemove a docs reference to the CBackend.
Jim Grosbach [Fri, 27 Apr 2012 16:29:22 +0000 (16:29 +0000)]
Remove a docs reference to the CBackend.

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

12 years agoMissed some register numbers.
Benjamin Kramer [Fri, 27 Apr 2012 12:21:46 +0000 (12:21 +0000)]
Missed some register numbers.

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

12 years agoUpdate edis test for r155704.
Benjamin Kramer [Fri, 27 Apr 2012 12:14:03 +0000 (12:14 +0000)]
Update edis test for r155704.

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

12 years agoX86: Don't emit conditional floating point moves on when targeting pre-pentiumpro...
Benjamin Kramer [Fri, 27 Apr 2012 12:07:43 +0000 (12:07 +0000)]
X86: Don't emit conditional floating point moves on when targeting pre-pentiumpro architectures.

* Model FPSW (the FPU status word) as a register.
* Add ISel patterns for the FUCOM*, FNSTSW and SAHF instructions.
* During Legalize/Lowering, build a node sequence to transfer the comparison
result from FPSW into EFLAGS. If you're wondering about the right-shift: That's
an implicit sub-register extraction (%ax -> %ah) which is handled later on by
the instruction selector.

Fixes PR6679. Patch by Christoph Erhardt!

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

12 years agoUpdate config.sub in the sample project.
Evgeniy Stepanov [Fri, 27 Apr 2012 10:27:32 +0000 (10:27 +0000)]
Update config.sub in the sample project.

This change replaces projects/sample/autoconf/config.sub with a copy of
autoconf/config.sub.

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

12 years ago[asan] small optimization: do not emit "x+0" instructions
Kostya Serebryany [Fri, 27 Apr 2012 10:04:53 +0000 (10:04 +0000)]
[asan] small optimization: do not emit "x+0" instructions

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

12 years agoRefactor IT handling not to store the bottom bit of the condition code in the mask...
Richard Barton [Fri, 27 Apr 2012 08:42:59 +0000 (08:42 +0000)]
Refactor IT handling not to store the bottom bit of the condition code in the mask operand in the MCInst.

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

12 years agoRevert r155682, "Use ConstantExpr::getExtractElement when constant-folding vectors"
NAKAMURA Takumi [Fri, 27 Apr 2012 07:59:20 +0000 (07:59 +0000)]
Revert r155682, "Use ConstantExpr::getExtractElement when constant-folding vectors"

It broke stage2 build. stage1/clang sometimes crashed.

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

12 years ago[tsan] Atomic support for ThreadSanitizer, patch by Dmitry Vyukov
Kostya Serebryany [Fri, 27 Apr 2012 07:31:53 +0000 (07:31 +0000)]
[tsan] Atomic support for ThreadSanitizer, patch by  Dmitry Vyukov

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

12 years agoAdd mcpu to tests to prevent them from using AVX instructions on Sandy Bridge after...
Craig Topper [Fri, 27 Apr 2012 07:11:58 +0000 (07:11 +0000)]
Add mcpu to tests to prevent them from using AVX instructions on Sandy Bridge after r155618.

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

12 years agoImplement a bastardized ABI.
Evan Cheng [Fri, 27 Apr 2012 02:11:10 +0000 (02:11 +0000)]
Implement a bastardized ABI.

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

12 years ago- thumbv6 shouldn't imply +thumb2. Cortex-M0 doesn't suppport 32-bit Thumb2
Evan Cheng [Fri, 27 Apr 2012 01:27:19 +0000 (01:27 +0000)]
- thumbv6 shouldn't imply +thumb2. Cortex-M0 doesn't suppport 32-bit Thumb2
  instructions.
- However, it does support dmb, dsb, isb, mrs, and msr.
rdar://11331541

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

12 years agoUse ConstantExpr::getExtractElement when constant-folding vectors
Dan Gohman [Fri, 27 Apr 2012 00:54:36 +0000 (00:54 +0000)]
Use ConstantExpr::getExtractElement when constant-folding vectors
instead of getAggregateElement. This has the advantage of being
more consistent and allowing higher-level constant folding to
procede even if an inner extract element cannot be folded.

Make ConstantFoldInstruction call ConstantFoldConstantExpression
on the instruction's operands, making it more consistent with
ConstantFoldConstantExpression itself. This makes sure that
ConstantExprs get TargetData-aware folding before being handed
off as operands for further folding.

This causes more expressions to be folded, but due to a known
shortcoming in constant folding, this currently has the side effect
of stripping a few more nuw and inbounds flags in the non-targetdata
side of constant-fold-gep.ll. This is mostly harmless.

This fixes rdar://11324230.

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

12 years agoBreak up getProfitableChainIncrement().
Jakob Stoklund Olesen [Thu, 26 Apr 2012 23:33:11 +0000 (23:33 +0000)]
Break up getProfitableChainIncrement().

The required checks are moved to ChainInstruction() itself and the
policy decisions are moved to IVChain::isProfitableInc().

Also cache the ExprBase in IVChain to avoid frequent recomputations.

No functional change intended.

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

12 years agoTurn IVChain into a struct.
Jakob Stoklund Olesen [Thu, 26 Apr 2012 23:33:09 +0000 (23:33 +0000)]
Turn IVChain into a struct.

No functional change intended.

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

12 years agoAdd instcombine patterns for the following transformations:
Chad Rosier [Thu, 26 Apr 2012 23:29:14 +0000 (23:29 +0000)]
Add instcombine patterns for the following transformations:

 (x & y) | (x ^ y) -> x | y
 (x & y) + (x ^ y) -> x | y

Patch by Manman Ren.
rdar://10770603

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

12 years agoDumpSegment64Command() wasn't returning correct result. Caught by static analyzer...
Evan Cheng [Thu, 26 Apr 2012 22:07:28 +0000 (22:07 +0000)]
DumpSegment64Command() wasn't returning correct result. Caught by static analyzer. rdar://11329354

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

12 years agoFix the SD scheduler to avoid gluing the same node twice.
Andrew Trick [Thu, 26 Apr 2012 21:48:25 +0000 (21:48 +0000)]
Fix the SD scheduler to avoid gluing the same node twice.

DAGCombine strangeness may result in multiple loads from the same
offset. They both may try to glue themselves to another load. We could
insist that the redundant loads glue themselves to each other, but the
beter fix is to bail out from bad gluing at the time we detect it.

Fixes rdar://11314175: BuildSchedUnits assert.

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

12 years agoDefensively guard against calling malloc() with a size of zero.
Ted Kremenek [Thu, 26 Apr 2012 20:54:27 +0000 (20:54 +0000)]
Defensively guard against calling malloc() with a size of zero.

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

12 years agoARM: Thumb ldr(literal) base address alignment is 32-bits.
Jim Grosbach [Thu, 26 Apr 2012 20:48:12 +0000 (20:48 +0000)]
ARM: Thumb ldr(literal) base address alignment is 32-bits.

The base address for the PC-relative load is Align(PC,4), so it's the
address of the word containing the 16-bit instruction, not the address
of the instruction itself. Ugh.

rdar://11314619

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

12 years agoAdd note about returns_twice magic removal from LLVM itself.
Joerg Sonnenberger [Thu, 26 Apr 2012 20:10:07 +0000 (20:10 +0000)]
Add note about returns_twice magic removal from LLVM itself.

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

12 years agoTrivial change to set UseLeaForSP flag in addition to toggling
Preston Gurd [Thu, 26 Apr 2012 19:52:27 +0000 (19:52 +0000)]
Trivial change to set UseLeaForSP flag in addition to toggling
the FeatureLeaForSP feature bit when llvm auto detects Intel Atom.

Patch by Andy Zhang

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

12 years ago[CMake] Restructure how Clang, Polly and other external projects get included.
Michael J. Spencer [Thu, 26 Apr 2012 19:43:35 +0000 (19:43 +0000)]
[CMake] Restructure how Clang, Polly and other external projects get included.

While making lld build under the tools directory I decided to refactor how this
works.

There is now a macro, add_llvm_external_project, which takes the name of the
expected subdirectory. This sets up two CMake options.

 * LLVM_EXTERNAL_${NAME}_SOURCE_DIR
     This is the path to the source. It defaults to
     ${CMAKE_CURRENT_SOURCE_DIR}/${name}.
 * LLVM_EXTERNAL_${NAME}_BUILD
     Enable and disable building the tool as part of LLVM.

I chose LLVM_EXTERNAL_${NAME} as a prefix so they all show up together in the
GUI.

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

12 years ago[Support/YAML] Properly fix unitialized variable warning by inserting a
Michael J. Spencer [Thu, 26 Apr 2012 19:27:11 +0000 (19:27 +0000)]
[Support/YAML] Properly fix unitialized variable warning by inserting a
'REPLACEMENT CHARACTER' (U+FFFD) when getAsInteger fails.

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

12 years agoFixed SmallMap test. The order of items is undefined in DenseMap. So being checking...
Stepan Dyatkovskiy [Thu, 26 Apr 2012 18:45:24 +0000 (18:45 +0000)]
Fixed SmallMap test. The order of items is undefined in DenseMap. So being checking the increment for big mode, we can only check that all items are in map.

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

12 years agoUse VLD1 in NEON extenting-load patterns instead of VLDR.
Tim Northover [Thu, 26 Apr 2012 08:46:29 +0000 (08:46 +0000)]
Use VLD1 in NEON extenting-load patterns instead of VLDR.

On some cores it's a bad idea for performance to mix VFP and NEON instructions
and since these patterns are NEON anyway, the NEON load should be used.

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