oota-llvm.git
11 years agoDo not optimise fprintf() calls if its return value is used.
Peter Collingbourne [Wed, 17 Apr 2013 02:01:10 +0000 (02:01 +0000)]
Do not optimise fprintf() calls if its return value is used.

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

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

11 years agoMips assembler: Enable handling of nested expressions
Jack Carter [Wed, 17 Apr 2013 00:18:04 +0000 (00:18 +0000)]
Mips assembler: Enable handling of nested expressions

This patch allows the Mips assembler to parse and emit nested
expressions as instruction operands. It also extends the
expansion of memory instructions when an offset is given as
an expression.

Contributer: Vladimir Medic

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

11 years ago[ms-inline asm] Add support for parsing complex immediate expressions. Test
Chad Rosier [Wed, 17 Apr 2013 00:11:46 +0000 (00:11 +0000)]
[ms-inline asm] Add support for parsing complex immediate expressions.  Test
cases to be submitted on clang side shortly.
rdar://13663768 and PR15760

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

11 years agoC API: Add LLVMTargetMachineEmitToMemoryBuffer()
Tom Stellard [Tue, 16 Apr 2013 23:12:56 +0000 (23:12 +0000)]
C API: Add LLVMTargetMachineEmitToMemoryBuffer()

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

11 years agoC API: Add LLVMGetBufferSize()
Tom Stellard [Tue, 16 Apr 2013 23:12:51 +0000 (23:12 +0000)]
C API: Add LLVMGetBufferSize()

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

11 years agoC API: Add LLVMGetBufferStart()
Tom Stellard [Tue, 16 Apr 2013 23:12:47 +0000 (23:12 +0000)]
C API: Add LLVMGetBufferStart()

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

11 years agoC API: Add LLVMAddTargetDependentFunctionAttr()
Tom Stellard [Tue, 16 Apr 2013 23:12:43 +0000 (23:12 +0000)]
C API: Add LLVMAddTargetDependentFunctionAttr()

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

11 years agoPrint out the target-independent attributes in a comment before the function definition.
Bill Wendling [Tue, 16 Apr 2013 20:55:47 +0000 (20:55 +0000)]
Print out the target-independent attributes in a comment before the function definition.

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

11 years ago[XCore] Extend test to check positve offsets are folded into addresses.
Richard Osborne [Tue, 16 Apr 2013 20:05:52 +0000 (20:05 +0000)]
[XCore] Extend test to check positve offsets are folded into addresses.

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

11 years ago[XCore] Give test more generic name.
Richard Osborne [Tue, 16 Apr 2013 19:56:55 +0000 (19:56 +0000)]
[XCore] Give test more generic name.

I intend to extend the test with more offset folding checks

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

11 years ago[XCore] Convert a couple of tests to FileCheck.
Richard Osborne [Tue, 16 Apr 2013 19:41:19 +0000 (19:41 +0000)]
[XCore] Convert a couple of tests to FileCheck.

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

11 years agoRemove unused variable from previous refactor.
Chad Rosier [Tue, 16 Apr 2013 18:20:10 +0000 (18:20 +0000)]
Remove unused variable from previous refactor.

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

11 years ago[ms-inline asm] Refactor. No functional change intended.
Chad Rosier [Tue, 16 Apr 2013 18:15:40 +0000 (18:15 +0000)]
[ms-inline asm] Refactor. No functional change intended.

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

11 years ago[ms-inline asm] Remove some dead code.
Chad Rosier [Tue, 16 Apr 2013 17:27:40 +0000 (17:27 +0000)]
[ms-inline asm] Remove some dead code.

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

11 years agoCleanup naming: DataLayout s/TD/DL/
Eli Bendersky [Tue, 16 Apr 2013 15:41:18 +0000 (15:41 +0000)]
Cleanup naming: DataLayout s/TD/DL/

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

11 years agoFix build failure introduced in 179591 when assertions are disabled.
Logan Chien [Tue, 16 Apr 2013 14:02:30 +0000 (14:02 +0000)]
Fix build failure introduced in 179591 when assertions are disabled.

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

11 years agoImplement ARM unwind opcode assembler.
Logan Chien [Tue, 16 Apr 2013 12:02:21 +0000 (12:02 +0000)]
Implement ARM unwind opcode assembler.

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

11 years agollvm-objdump: Don't print contents of BSS sections: it makes no sense and crashes...
Alexey Samsonov [Tue, 16 Apr 2013 10:53:11 +0000 (10:53 +0000)]
llvm-objdump: Don't print contents of BSS sections: it makes no sense and crashes llvm-objdump on relocated objects with large bss

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

11 years agoAdd four new functions and one new enum to the C API:
Hans Wennborg [Tue, 16 Apr 2013 08:58:59 +0000 (08:58 +0000)]
Add four new functions and one new enum to the C API:

LLVMGetThreadLocalMode - exposes GlobalVariable::getThreadLocalMode
LLVMSetThreadLocalMode - exposes GlobalVariable::setThreadLocalMode
LLVMIsExternallyInitialized - exposes GlobalVariable::isExternallyInitialized
LLVMSetExternallyInitialized - exposes GlobalVariable::setExternallyInitialized
LLVMThreadLocalMode - maps to GlobalVariable::ThreadLocalMode

Patch by Moritz Maxeiner!

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

11 years agosimplifycfg: Fix integer overflow converting switch into icmp.
Hans Wennborg [Tue, 16 Apr 2013 08:35:36 +0000 (08:35 +0000)]
simplifycfg: Fix integer overflow converting switch into icmp.

If a switch instruction has a case for every possible value of its type,
with the same successor, SimplifyCFG would replace it with an icmp ult,
but the computation of the bound overflows in that case, which inverts
the test.

Patch by Jed Davis!

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

11 years agoAdd 64-bit multiply and divide instructions for SPARC v9.
Jakob Stoklund Olesen [Tue, 16 Apr 2013 02:57:02 +0000 (02:57 +0000)]
Add 64-bit multiply and divide instructions for SPARC v9.

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

11 years agoARM: Add VACLT and VACLE assembly aliases.
Jim Grosbach [Mon, 15 Apr 2013 22:42:50 +0000 (22:42 +0000)]
ARM: Add VACLT and VACLE assembly aliases.

These are aliases for VACGT and VACGE, respectively, with the source
operands reversed.

rdar://13638090

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

11 years agoWe are not able to bitcast a pointer to an integral value.
Bill Wendling [Mon, 15 Apr 2013 22:33:50 +0000 (22:33 +0000)]
We are not able to bitcast a pointer to an integral value.

Two return types are not equivalent if one is a pointer and the other is an
integral. This is because we cannot bitcast a pointer to an integral value.
PR15185

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

11 years agoMips assembler: Explicit floating point condition register recognition.
Jack Carter [Mon, 15 Apr 2013 22:21:55 +0000 (22:21 +0000)]
Mips assembler: Explicit floating point condition register recognition.

This patch allows the assembler to recognize $fcc0
as a valid register for conditional move instructions.

Corresponding test cases have been added.

Contributer: Vladimir Medic

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

11 years agoFix a grammar mistake, and add a line about the two phases that the BB/SLP vectorizer...
Nadav Rotem [Mon, 15 Apr 2013 22:21:25 +0000 (22:21 +0000)]
Fix a grammar mistake, and add a line about the two phases that the BB/SLP vectorizers have (top-down and bottom-up).

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

11 years agoFix the internal link.
Nadav Rotem [Mon, 15 Apr 2013 22:11:07 +0000 (22:11 +0000)]
Fix the internal link.

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

11 years agoUpdate the release notes about the vectorizers.
Nadav Rotem [Mon, 15 Apr 2013 22:10:39 +0000 (22:10 +0000)]
Update the release notes about the vectorizers.

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

11 years agoSLPVectorizer: Make it a function pass and add code for hoisting the vector-gather...
Nadav Rotem [Mon, 15 Apr 2013 22:00:26 +0000 (22:00 +0000)]
SLPVectorizer: Make it a function pass and add code for hoisting the vector-gather sequence out of loops.

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

11 years agoFix silly typo that broke big endian hosts.
Rafael Espindola [Mon, 15 Apr 2013 20:13:59 +0000 (20:13 +0000)]
Fix silly typo that broke big endian hosts.

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

11 years agoFix endianness on some MSVC versions.
Rafael Espindola [Mon, 15 Apr 2013 19:28:45 +0000 (19:28 +0000)]
Fix endianness on some MSVC versions.

Looks like it was evaluating undef == undef to true.

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

11 years agoR600/SI: Emit config values in register value pairs.
Tom Stellard [Mon, 15 Apr 2013 17:51:35 +0000 (17:51 +0000)]
R600/SI: Emit config values in register value pairs.

Instead of emitting config values in a predefined order, the code
emitter will now emit a 32-bit register index followed by the 32-bit
config value.

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

11 years agoR600/SI: Emit configuration value in the .AMDGPU.config ELF section
Tom Stellard [Mon, 15 Apr 2013 17:51:30 +0000 (17:51 +0000)]
R600/SI: Emit configuration value in the .AMDGPU.config ELF section

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

11 years agoR600: Emit ELF formatted code rather than raw ISA.
Tom Stellard [Mon, 15 Apr 2013 17:51:21 +0000 (17:51 +0000)]
R600: Emit ELF formatted code rather than raw ISA.

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

11 years agoFix a typo in comment.
Jim Grosbach [Mon, 15 Apr 2013 17:40:48 +0000 (17:40 +0000)]
Fix a typo in comment.

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

11 years agoSimplify the MCInst operator iterator declaration.
Jim Grosbach [Mon, 15 Apr 2013 17:40:45 +0000 (17:40 +0000)]
Simplify the MCInst operator iterator declaration.

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

11 years agoGrammar and punctuation fixes.
John Criswell [Mon, 15 Apr 2013 17:38:06 +0000 (17:38 +0000)]
Grammar and punctuation fixes.
No content changes.

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

11 years agoTry to fix the mingw builds.
Rafael Espindola [Mon, 15 Apr 2013 16:46:43 +0000 (16:46 +0000)]
Try to fix the mingw builds.

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

11 years agoFix bit size of v64i8 and v32i16 vector types.
Arnold Schwaighofer [Mon, 15 Apr 2013 16:11:25 +0000 (16:11 +0000)]
Fix bit size of v64i8 and v32i16 vector types.

Patch by Cameron McInally <cameron.mcinally@nyu.edu>.

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

11 years agoRemove getters now that we can specialize structs on the host endianness.
Rafael Espindola [Mon, 15 Apr 2013 16:08:02 +0000 (16:08 +0000)]
Remove getters now that we can specialize structs on the host endianness.

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

11 years agoAvoid outputting temporary test file into source tree.
Tim Northover [Mon, 15 Apr 2013 15:49:13 +0000 (15:49 +0000)]
Avoid outputting temporary test file into source tree.

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

11 years agoRemove unused function.
Rafael Espindola [Mon, 15 Apr 2013 15:13:10 +0000 (15:13 +0000)]
Remove unused function.

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

11 years agoMake the host endianness check an integer constant expression.
Rafael Espindola [Mon, 15 Apr 2013 14:44:24 +0000 (14:44 +0000)]
Make the host endianness check an integer constant expression.

I will remove the isBigEndianHost function once I update clang.

The ifdef logic is designed to
* not use configure/cmake to avoid breaking -arch i686 -arch ppc.
* default to little endian
* be as small as possible

It looks like sys/endian.h is the preferred header on most modern BSD systems,
but it is better to change this in a followup patch as machine/endian.h is
available on FreeBSD, OpenBSD, NetBSD and OS X.

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

11 years agoReplace uses of the deprecated std::auto_ptr with OwningPtr.
Andy Gibbs [Mon, 15 Apr 2013 12:06:32 +0000 (12:06 +0000)]
Replace uses of the deprecated std::auto_ptr with OwningPtr.

This is a rework of the broken parts in r179373 which were subsequently reverted in r179374 due to incompatibility with C++98 compilers.  This version should be ok under C++98.

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

11 years agoEnable all targets by default on Visual Studio.
Tim Northover [Mon, 15 Apr 2013 11:53:05 +0000 (11:53 +0000)]
Enable all targets by default on Visual Studio.

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

11 years agoRevert "Recommit r179497 after fixing uninitialized variable." until
Eric Christopher [Mon, 15 Apr 2013 07:31:37 +0000 (07:31 +0000)]
Revert "Recommit r179497 after fixing uninitialized variable." until
I can fix the testcases here:

http://lab.llvm.org:8011/builders/clang-native-arm-cortex-a9/builds/6952

This reverts commit r179512 due to testcases specifying triples
that they didn't actually mean and causing failures on other platforms.

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

11 years agoRecommit r179497 after fixing uninitialized variable.
Eric Christopher [Mon, 15 Apr 2013 07:07:21 +0000 (07:07 +0000)]
Recommit r179497 after fixing uninitialized variable.

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

11 years agoDocument our desire to enable the loop vectorizer on -Os in future releases.
Nadav Rotem [Mon, 15 Apr 2013 05:56:55 +0000 (05:56 +0000)]
Document our desire to enable the loop vectorizer on -Os in future releases.

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

11 years agoDocs: merge the description of the BB and SLP vectorizers and document the -fslp...
Nadav Rotem [Mon, 15 Apr 2013 05:53:23 +0000 (05:53 +0000)]
Docs: merge the description of the BB and SLP vectorizers and document the -fslp-vectorize-aggressive flag.

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

11 years agoAdd an option -vectorize-slp-aggressive for running the BB vectorizer. Make -fslp...
Nadav Rotem [Mon, 15 Apr 2013 05:39:58 +0000 (05:39 +0000)]
Add an option -vectorize-slp-aggressive for running the BB vectorizer. Make -fslp-vectorize run the slp-vectorizer.

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

11 years agoRename the slp-vectorizer clang/llvm flags. No functionality change.
Nadav Rotem [Mon, 15 Apr 2013 04:54:42 +0000 (04:54 +0000)]
Rename the slp-vectorizer clang/llvm flags. No functionality change.

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

11 years agoSLPVectorizer: Add support for vectorizing trees that start at compare instructions.
Nadav Rotem [Mon, 15 Apr 2013 04:25:27 +0000 (04:25 +0000)]
SLPVectorizer: Add support for vectorizing trees that start at compare instructions.

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

11 years agofix include path in doc Extending LLVM
Jia Liu [Mon, 15 Apr 2013 03:26:13 +0000 (03:26 +0000)]
fix include path in doc Extending LLVM

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

11 years agoMark all PPC comparison instructions as not having side effects
Hal Finkel [Mon, 15 Apr 2013 02:37:46 +0000 (02:37 +0000)]
Mark all PPC comparison instructions as not having side effects

Now that the CR spilling issues have been resolved, we can remove the
unmodeled-side-effect attributes from the comparison instructions (and also
mark them as isCompare). By allowing these, by default, to have unmodeled side
effects, we were hiding problems with CR spilling; but everything seems much
happier now.

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

11 years agoFix PPC64 CR spill location for callee-saved registers
Hal Finkel [Mon, 15 Apr 2013 02:07:05 +0000 (02:07 +0000)]
Fix PPC64 CR spill location for callee-saved registers

This fixes an ABI bug for non-Darwin PPC64. For the callee-saved condition
registers, the spill location is specified relative to the stack pointer (SP +
8). However, this is not relative to the SP after the new stack frame is
established, but instead relative to the caller's stack pointer (it is stored
into the linkage area of the parent's stack frame).

So, like with the link register, we don't directly spill the CRs with other
callee-saved registers, but just mark them to be spilled during prologue
generation.

In practice, this reverts r179457 for PPC64 (but leaves it in place for PPC32).

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

11 years agoRevert "Remove some unused triple and data layout."
Eric Christopher [Sun, 14 Apr 2013 23:35:36 +0000 (23:35 +0000)]
Revert "Remove some unused triple and data layout."

This reverts commit r179497 and the accompanying commit as it broke random platforms that aren't osx.

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

11 years agoRemove some unused triple and data layout.
Eric Christopher [Sun, 14 Apr 2013 23:32:44 +0000 (23:32 +0000)]
Remove some unused triple and data layout.

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

11 years agoIf we've specified a triple on the command line then go ahead
Eric Christopher [Sun, 14 Apr 2013 23:32:40 +0000 (23:32 +0000)]
If we've specified a triple on the command line then go ahead
and use that as the default triple for the module and target
data layout.

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

11 years agoUse object file specific section type for initial text section
Nico Rieck [Sun, 14 Apr 2013 21:18:36 +0000 (21:18 +0000)]
Use object file specific section type for initial text section

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

11 years agoReorders two transforms that collide with each other
David Majnemer [Sun, 14 Apr 2013 21:15:43 +0000 (21:15 +0000)]
Reorders two transforms that collide with each other

One performs: (X == 13 | X == 14) -> X-13 <u 2
The other: (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1

The problem is that there are certain values of C1 and C2 that
trigger both transforms but the first one blocks out the second,
this generates suboptimal code.

Reordering the transforms should be better in every case and
allows us to do interesting stuff like turn:
  %shr = lshr i32 %X, 4
  %and = and i32 %shr, 15
  %add = add i32 %and, -14
  %tobool = icmp ne i32 %add, 0

into:
  %and = and i32 %X, 240
  %tobool = icmp ne i32 %and, 224

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

11 years agoMake the command line triple match the module triple.
Nadav Rotem [Sun, 14 Apr 2013 20:13:05 +0000 (20:13 +0000)]
Make the command line triple match the module triple.

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

11 years agoMiscellaneous cleanups for VecUtils.h
Benjamin Kramer [Sun, 14 Apr 2013 09:33:08 +0000 (09:33 +0000)]
Miscellaneous cleanups for VecUtils.h

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

11 years agoDocument the SLP infrastructure.
Nadav Rotem [Sun, 14 Apr 2013 07:42:25 +0000 (07:42 +0000)]
Document the SLP infrastructure.

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

11 years agoSLP: Document the scalarization cost method.
Nadav Rotem [Sun, 14 Apr 2013 07:22:22 +0000 (07:22 +0000)]
SLP: Document the scalarization cost method.

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

11 years agoDocument the decision to assume that the cost of floats is twice as much as integers.
Nadav Rotem [Sun, 14 Apr 2013 05:55:18 +0000 (05:55 +0000)]
Document the decision to assume that the cost of floats is twice as much as integers.

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

11 years agoUse i32 for all SPARC shift amounts, even in 64-bit mode.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 05:48:50 +0000 (05:48 +0000)]
Use i32 for all SPARC shift amounts, even in 64-bit mode.

Test case by llvm-stress.

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

11 years agoRemove unused function attributes.
Nadav Rotem [Sun, 14 Apr 2013 05:47:04 +0000 (05:47 +0000)]
Remove unused function attributes.

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

11 years agoSLPVectorizer: Add support for trees that don't start at binary operators, and add...
Nadav Rotem [Sun, 14 Apr 2013 05:15:53 +0000 (05:15 +0000)]
SLPVectorizer: Add support for trees that don't start at binary operators, and add the cost of extracting values from the roots of the tree.

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

11 years agoAdd support for the abs64 SPARC v9 code model.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 05:10:36 +0000 (05:10 +0000)]
Add support for the abs64 SPARC v9 code model.

For when 16 TB just isn't enough.

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

11 years agoAdd support for the SPARC v9 abs44 code model.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 04:57:51 +0000 (04:57 +0000)]
Add support for the SPARC v9 abs44 code model.

This is the default model for non-PIC 64-bit code. It supports
text+data+bss linked anywhere in the low 16 TB of the address space.

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

11 years agoUse target flags for printing SPARC asm operands.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 04:35:19 +0000 (04:35 +0000)]
Use target flags for printing SPARC asm operands.

64-bit code models need multiple relocations that can't be inferred from
the opcode like they can in 32-bit code.

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

11 years agoAlso put target flags on SPARC constant pool references.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 04:35:16 +0000 (04:35 +0000)]
Also put target flags on SPARC constant pool references.

Constant pool entries are accessed exactly the same way as global
variables.

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

11 years agoSLPVectorizer: add initial support for reduction variable vectorization.
Nadav Rotem [Sun, 14 Apr 2013 03:22:20 +0000 (03:22 +0000)]
SLPVectorizer: add initial support for reduction variable vectorization.

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

11 years agoFix patterns for 64-bit pointers.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 01:53:23 +0000 (01:53 +0000)]
Fix patterns for 64-bit pointers.

This fixes the pic32 code model for SPARC v9.

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

11 years agoAdd target flags to SPARC address operands.
Jakob Stoklund Olesen [Sun, 14 Apr 2013 01:33:32 +0000 (01:33 +0000)]
Add target flags to SPARC address operands.

SDNodes and MachineOperands get target flags representing the %hi() and
%lo() assembly annotations that eventually become relocations.

Also define flags to be used by the 64-bit code models.

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

11 years agoMark all PPC CR registers to be spilled as live-in and tag MFCR appropriately
Hal Finkel [Sat, 13 Apr 2013 23:06:15 +0000 (23:06 +0000)]
Mark all PPC CR registers to be spilled as live-in and tag MFCR appropriately

Leaving MFCR has having unmodeled side effects is not enough to prevent
unwanted instruction reordering post-RA. We could probably apply a stronger
barrier attribute, but there is a better way: Add all (not just the first) CR
to be spilled as live-in to the entry block, and add all CRs to the MFCR
instruction as implicitly killed.

Unfortunately, I don't have a small test case.

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

11 years agoDefine SPARC code models.
Jakob Stoklund Olesen [Sat, 13 Apr 2013 19:02:23 +0000 (19:02 +0000)]
Define SPARC code models.

Currently, only abs32 and pic32 are implemented. Add a test case for
abs32 with 64-bit code. 64-bit PIC code is currently broken.

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

11 years agoUse the correct types when matching ADDRri patterns from frame indexes.
Jakob Stoklund Olesen [Sat, 13 Apr 2013 19:02:16 +0000 (19:02 +0000)]
Use the correct types when matching ADDRri patterns from frame indexes.

It doesn't seem like anybody is checking types this late in isel, so no
test case.

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

11 years agoGlobalDCE: Fix an oversight in my last commit that could lead to crashes.
Benjamin Kramer [Sat, 13 Apr 2013 16:11:14 +0000 (16:11 +0000)]
GlobalDCE: Fix an oversight in my last commit that could lead to crashes.

There is a Constant with non-constant operands: blockaddress.

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

11 years agoFix a scalability issue with complex ConstantExprs.
Benjamin Kramer [Sat, 13 Apr 2013 12:53:18 +0000 (12:53 +0000)]
Fix a scalability issue with complex ConstantExprs.

This is basically the same fix in three different places. We use a set to avoid
walking the whole tree of a big ConstantExprs multiple times.

For example: (select cmp, (add big_expr 1), (add big_expr 2))
We don't want to visit big_expr twice here, it may consist of thousands of
nodes.

The testcase exercises this by creating an insanely large ConstantExprs out of
a loop. It's questionable if the optimizer should ever create those, but this
can be triggered with real C code. Fixes PR15714.

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

11 years agoSpill and restore PPC CR registers using the FP when we have one
Hal Finkel [Sat, 13 Apr 2013 08:09:20 +0000 (08:09 +0000)]
Spill and restore PPC CR registers using the FP when we have one

For functions that need to spill CRs, and have dynamic stack allocations, the
value of the SP during the restore is not what it was during the save, and so
we need to use the FP in these cases (as for all of the other spills and
restores, but the CR restore has a special code path because its reserved slot,
like the link register, is specified directly relative to the adjusted SP).

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

11 years agoFurther generalize this scheduler test.
Andrew Trick [Sat, 13 Apr 2013 07:37:27 +0000 (07:37 +0000)]
Further generalize this scheduler test.

The order of copies depends on queue order, which is not very stable.

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

11 years agoFix a dislexic regex.
Andrew Trick [Sat, 13 Apr 2013 07:29:21 +0000 (07:29 +0000)]
Fix a dislexic regex.

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

11 years agoAdd a missing REQUIRES: asserts
Andrew Trick [Sat, 13 Apr 2013 06:12:46 +0000 (06:12 +0000)]
Add a missing REQUIRES: asserts

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

11 years agoMI-Sched: DEBUG formatting.
Andrew Trick [Sat, 13 Apr 2013 06:07:49 +0000 (06:07 +0000)]
MI-Sched: DEBUG formatting.

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

11 years agoMI-Sched cleanup. If an instruction has no valid sched class, do not attempt to check...
Andrew Trick [Sat, 13 Apr 2013 06:07:45 +0000 (06:07 +0000)]
MI-Sched cleanup. If an instruction has no valid sched class, do not attempt to check for a variant.

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

11 years agoX86 machine model: reduce SandyBridge and Haswell ILPWindow.
Andrew Trick [Sat, 13 Apr 2013 06:07:43 +0000 (06:07 +0000)]
X86 machine model: reduce SandyBridge and Haswell ILPWindow.

The initial values were arbitrary. I want them to be more
conservative. This represents the number of latency cycles hidden by
OOO execution. In practice, I think it should be within a small factor
of the complex floating point operation latency so the scheduler can
make some attempt to hide latency even for smallish blocks.

These are by no means the best values, just a starting point for
tuning heuristics. Some benchmarks such as TSVC run faster with this
lower value for SandyBridge. I haven't run anything on Haswell, but
it's shouldn't be 2x SB.

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

11 years agoMI-Sched: schedule physreg copies.
Andrew Trick [Sat, 13 Apr 2013 06:07:40 +0000 (06:07 +0000)]
MI-Sched: schedule physreg copies.

The register allocator expects minimal physreg live ranges. Schedule
physreg copies accordingly. This is slightly tricky when they occur in
the middle of the scheduling region. For now, this is handled by
rescheduling the copy when its associated instruction is
scheduled. Eventually we may instead bundle them, but only if we can
preserve the bundles as parallel copies during regalloc.

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

11 years agoCatch another case where SD fails to propagate node order.
Andrew Trick [Sat, 13 Apr 2013 06:07:36 +0000 (06:07 +0000)]
Catch another case where SD fails to propagate node order.

I need to handle this for the test case in my following scheduler
commit.

Work is already under way to redesign the mechanism for node order
propagation because this case by case approach is unmaintainable.

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

11 years agoAdd typenames to see if bot goes green.
Rafael Espindola [Sat, 13 Apr 2013 02:31:34 +0000 (02:31 +0000)]
Add typenames to see if bot goes green.

I hope this brings http://lab.llvm.org:8011/builders/clang-x86_64-darwin11-self-mingw32 back.

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

11 years ago[mips] Move MipsTargetLowering::lowerINTRINSIC_W_CHAIN and
Akira Hatanaka [Sat, 13 Apr 2013 02:13:30 +0000 (02:13 +0000)]
[mips] Move MipsTargetLowering::lowerINTRINSIC_W_CHAIN and
lowerINTRINSIC_WO_CHAIN into MipsSETargetLowering.

No functionality changes.

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

11 years agoSome versions of gcc don't like typenames in these places.
Rafael Espindola [Sat, 13 Apr 2013 01:55:34 +0000 (01:55 +0000)]
Some versions of gcc don't like typenames in these places.

Should fix the bots.

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

11 years agoFinish templating MachObjectFile over endianness.
Rafael Espindola [Sat, 13 Apr 2013 01:45:40 +0000 (01:45 +0000)]
Finish templating MachObjectFile over endianness.

We are now able to handle big endian macho files in llvm-readobject. Thanks to
David Fang for providing the object files.

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

11 years ago[mips] Reapply r179420 and r179421.
Akira Hatanaka [Sat, 13 Apr 2013 00:55:41 +0000 (00:55 +0000)]
[mips] Reapply r179420 and r179421.

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

11 years ago[mips] Override TargetLoweringBase::isShuffleMaskLegal.
Akira Hatanaka [Sat, 13 Apr 2013 00:45:02 +0000 (00:45 +0000)]
[mips] Override TargetLoweringBase::isShuffleMaskLegal.

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

11 years ago[ms-inline asm] Simplify the logic by using parsePrimaryExpr. No functional
Chad Rosier [Fri, 12 Apr 2013 23:03:20 +0000 (23:03 +0000)]
[ms-inline asm] Simplify the logic by using parsePrimaryExpr.  No functional
change intended.  Test case previously added in r178568.
Part of rdar://13611297

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

11 years agoRevert r179420 and r179421.
Akira Hatanaka [Fri, 12 Apr 2013 22:40:07 +0000 (22:40 +0000)]
Revert r179420 and r179421.

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

11 years ago[mips] Instruction selection patterns for carry-setting and using add
Akira Hatanaka [Fri, 12 Apr 2013 22:24:52 +0000 (22:24 +0000)]
[mips] Instruction selection patterns for carry-setting and using add
instructions.

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

11 years ago[mips] v4i8 and v2i16 add, sub and mul instruction selection patterns.
Akira Hatanaka [Fri, 12 Apr 2013 22:14:24 +0000 (22:14 +0000)]
[mips] v4i8 and v2i16 add, sub and mul instruction selection patterns.

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

11 years agoRevert r179409 because it caused some warnings and some of the build bots fail.
Nadav Rotem [Fri, 12 Apr 2013 22:02:26 +0000 (22:02 +0000)]
Revert r179409 because it caused some warnings and some of the build bots fail.

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

11 years agoInstCombine: Check the operand types before merging fcmp ord & fcmp ord.
Benjamin Kramer [Fri, 12 Apr 2013 21:56:23 +0000 (21:56 +0000)]
InstCombine: Check the operand types before merging fcmp ord & fcmp ord.

Fixes PR15737.

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