platform/upstream/llvm.git
9 years agoUse lit.util.executeCommand instead of our own version
Eric Fiselier [Tue, 25 Nov 2014 03:06:31 +0000 (03:06 +0000)]
Use lit.util.executeCommand instead of our own version

llvm-svn: 222718

9 years agoUse lit.util.executeCommand instead of our own version
Eric Fiselier [Tue, 25 Nov 2014 03:03:32 +0000 (03:03 +0000)]
Use lit.util.executeCommand instead of our own version

llvm-svn: 222717

9 years agoInstSimplify: Handle some simple tautological comparisons
David Majnemer [Tue, 25 Nov 2014 02:55:48 +0000 (02:55 +0000)]
InstSimplify: Handle some simple tautological comparisons

This handles cases where we are comparing a masked value against itself.
The analysis could be further improved by making it recursive but such
expense is not currently justified.

llvm-svn: 222716

9 years agoRevert "unique_ptrify LLVMContextImpl::CAZConstants"
David Blaikie [Tue, 25 Nov 2014 02:26:22 +0000 (02:26 +0000)]
Revert "unique_ptrify LLVMContextImpl::CAZConstants"

Missed the complexities of how these elements are destroyed.

This reverts commit r222714.

llvm-svn: 222715

9 years agounique_ptrify LLVMContextImpl::CAZConstants
David Blaikie [Tue, 25 Nov 2014 02:13:54 +0000 (02:13 +0000)]
unique_ptrify LLVMContextImpl::CAZConstants

llvm-svn: 222714

9 years ago[PowerPC] Add the 'attn' instruction
Hal Finkel [Tue, 25 Nov 2014 00:30:11 +0000 (00:30 +0000)]
[PowerPC] Add the 'attn' instruction

The attn instruction is not part of the Power ISA, but is documented in the A2
user manual, and is accepted by the GNU assembler for the A2 and the POWER4+.
Reported as part of PR21650.

llvm-svn: 222712

9 years agoPrint lit configuration information after all configuration is done.
Eric Fiselier [Mon, 24 Nov 2014 23:46:42 +0000 (23:46 +0000)]
Print lit configuration information after all configuration is done.

llvm-svn: 222711

9 years ago[PowerPC] Implement combineRepeatedFPDivisors
Hal Finkel [Mon, 24 Nov 2014 23:45:21 +0000 (23:45 +0000)]
[PowerPC] Implement combineRepeatedFPDivisors

This does not matter on newer cores (where we can use reciprocal estimates in
fast-math mode anyway), but for older cores this allows us to generate better
fast-math code where we have multiple FDIVs with a common divisor.

llvm-svn: 222710

9 years agoFactor check for the assume intrinsic out of checks in computeKnownBitsFromAssume
Philip Reames [Mon, 24 Nov 2014 23:44:28 +0000 (23:44 +0000)]
Factor check for the assume intrinsic out of checks in computeKnownBitsFromAssume

We were matching against the assume intrinsic in every check.  Since we know that it must be an assume, this is just wasted work.  Somewhat surprisingly, matching an intrinsic id is actually relatively expensive.  It devolves to a string construction and comparison in Function::isIntrinsic.

I originally spotted this because it showed up in a performance profile of my compiler.  I've since discovered a separate issue which seems to be the actual root cause, but this is minor perf goodness regardless.

I'm likely to follow up with another change to factor out the comparison matching.  There's no need to match the compare instruction in every single one of the tests.

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

llvm-svn: 222709

9 years agoSee if this fixes Mips bot; ignore contents of parameter lists.
Paul Robinson [Mon, 24 Nov 2014 23:30:12 +0000 (23:30 +0000)]
See if this fixes Mips bot; ignore contents of parameter lists.

llvm-svn: 222708

9 years agoIncorporate review comments from r221742
Philip Reames [Mon, 24 Nov 2014 23:24:24 +0000 (23:24 +0000)]
Incorporate review comments from r221742

This change implements the comment and style changes Sean requested during post commit review with r221742.  Sorry for the delay.

llvm-svn: 222707

9 years agoBug 21610: Canonicalize min/max fcmp selects to use ordered comparisons
Matt Arsenault [Mon, 24 Nov 2014 23:15:18 +0000 (23:15 +0000)]
Bug 21610: Canonicalize min/max fcmp selects to use ordered comparisons

llvm-svn: 222705

9 years agoConvert test to FileCheck and use CHECK-LABEL
Matt Arsenault [Mon, 24 Nov 2014 23:03:17 +0000 (23:03 +0000)]
Convert test to FileCheck and use CHECK-LABEL

llvm-svn: 222704

9 years ago[libcxxabi] Refactor building and testing libc++abi without threads
Eric Fiselier [Mon, 24 Nov 2014 22:42:03 +0000 (22:42 +0000)]
[libcxxabi] Refactor building and testing libc++abi without threads

Summary:
This patch adds CMake support for building and testing libc++abi without threads.

1. Add `LIBCXXABI_ENABLE_THREADS` option to CMake.
2. Propagate `LIBCXXABI_ENABLE_THREADS` to lit via lit.site.cfg.in
3. Configure tests for `LIBCXXABI_ENABLE_THREADS=OFF

Currently the test suite does not work when libc++abi is built without threads because that information does not propagate to the test suite.

Reviewers: danalbert, mclow.lists, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 222702

9 years ago[libcxxabi] Refactor test timing logic and disable by default.
Eric Fiselier [Mon, 24 Nov 2014 22:38:57 +0000 (22:38 +0000)]
[libcxxabi] Refactor test timing logic and disable by default.

Summary:
When using LIT the timing output is entirely unused but introduces a dependency on `<chrono>`. When libc++ is built without a montonic clock this causes some of the tests to fail.
This patch factors out all of the timing logic into `support/timer.hpp` and disables it by default. To enable the timing you must define `LIBCXXABI_TIME_TESTS`.

Reviewers: mclow.lists, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 222701

9 years agoClarify wording in the LangRef around !invariant.load
Philip Reames [Mon, 24 Nov 2014 22:32:43 +0000 (22:32 +0000)]
Clarify wording in the LangRef around !invariant.load

Clarify the wording around !invariant.load to properly reflect the semantics of such loads with respect to control dependence and location lifetime.  To the best of my knowledge, the revised wording respects the actual implementation and understanding of issues involved highlighted in the recent 'Optimization hints for "constant" loads' thread on LLVMDev.

In particular, I'm aiming for the following results:
- To clarify that an invariant.load can fault and must respect control dependence.  In particular, it is not sound to unconditionally pull an invariant load out of a loop if that loop would potentially never execute.
- To clarify that the invariant nature of a given pointer does not preclude the modification of that location through a pointer which is unrelated to the load operand.  In particular, initializing a location and then passing a pointer through an opaque intrinsic which produces a new unrelated pointer, should behave as expected provided that the intrinsic is memory dependent on the initializing store.
- To clarify that storing a value to an invariant location is defined.  It can not, for example, be considered unreachable.  The value stored can be assumed to be equal to the value of any previous (or following!) invariant load, but the store itself is defined.

I recommend that anyone interested in using !invariant.load, or optimizing for them, read over the discussion in the review thread.  A number of motivating examples are discussed.

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

llvm-svn: 222700

9 years ago[TSan] Deflake test
Alexey Samsonov [Mon, 24 Nov 2014 22:27:34 +0000 (22:27 +0000)]
[TSan] Deflake test

llvm-svn: 222699

9 years agoAdd better support for custom test runners.
Dan Albert [Mon, 24 Nov 2014 22:24:06 +0000 (22:24 +0000)]
Add better support for custom test runners.

Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.

First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.

Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.

As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/

Reviewers: jroelofs, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 222698

9 years agoRemove unnecessary environment switch
Reid Kleckner [Mon, 24 Nov 2014 22:05:42 +0000 (22:05 +0000)]
Remove unnecessary environment switch

All supported environments on x86 Windows return structs in EAX:EDX.
This removes code added in r204978 that had to get updated in r222680.
We should now have the same behavior we had before r204978.

llvm-svn: 222697

9 years agoForce the correction of delayed typos in casts in non-C++ code.
Kaelyn Takata [Mon, 24 Nov 2014 21:46:59 +0000 (21:46 +0000)]
Force the correction of delayed typos in casts in non-C++ code.

Fixes PR21656, which is fallout from r222551 caused by an untested/missed
code path.

llvm-svn: 222694

9 years agoFilter the toplevel matchers by kind.
Samuel Benzaquen [Mon, 24 Nov 2014 21:21:09 +0000 (21:21 +0000)]
Filter the toplevel matchers by kind.

Summary:
Filter the toplevel matchers by kind.
Decl and Stmt matchers are tied to a specific node kind and trying to
match incompatible nodes is a waste.
Precalculate a filtered list of matchers that have a chance of matching
the node and ignore the rest.
Speeds up our clang-tidy benchmark by ~10%

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 222688

9 years agoAdd a disable-output option to the gold plugin.
Rafael Espindola [Mon, 24 Nov 2014 21:18:14 +0000 (21:18 +0000)]
Add a disable-output option to the gold plugin.

This corresponds to the opt option and is handy for profiling.

llvm-svn: 222687

9 years agotesting: make test use FileCheck
Tim Northover [Mon, 24 Nov 2014 21:03:34 +0000 (21:03 +0000)]
testing: make test use FileCheck

The "grep internal | count" was fragile when your source or remote paths could
contain the word "internal".

llvm-svn: 222685

9 years agoRemove the unused FindUsedTypes pass.
Rafael Espindola [Mon, 24 Nov 2014 20:53:26 +0000 (20:53 +0000)]
Remove the unused FindUsedTypes pass.

It was dead since r134829.

llvm-svn: 222684

9 years agoCorrectly remove OptimizeForSize from functions marked OptimizeNone.
Paul Robinson [Mon, 24 Nov 2014 20:51:42 +0000 (20:51 +0000)]
Correctly remove OptimizeForSize from functions marked OptimizeNone.
This allows using __attribute__((optnone)) and the -Os/-Oz options.
Fixes PR21604.

llvm-svn: 222683

9 years agoAdd and use Type::subtypes. NFC.
Rafael Espindola [Mon, 24 Nov 2014 20:44:36 +0000 (20:44 +0000)]
Add and use Type::subtypes. NFC.

llvm-svn: 222682

9 years agoPass the .ll files to llvm-link directly. NFC.
Rafael Espindola [Mon, 24 Nov 2014 20:35:59 +0000 (20:35 +0000)]
Pass the .ll files to llvm-link directly. NFC.

llvm-svn: 222681

9 years agoCodeGen: make i686-windows-itanium more similar to msvc
Saleem Abdulrasool [Mon, 24 Nov 2014 20:14:29 +0000 (20:14 +0000)]
CodeGen: make i686-windows-itanium more similar to msvc

The itanium environment follows the system calling convention for structures.
Pass small aggregates via registers.

llvm-svn: 222680

9 years agoCodeGen: use a range-based for loop
Saleem Abdulrasool [Mon, 24 Nov 2014 20:14:26 +0000 (20:14 +0000)]
CodeGen: use a range-based for loop

Convert a debug assertion into a range-based loop form.  NFC.

llvm-svn: 222679

9 years agoCorrect path to regression tests in ExtendingLLVM
Sergey Dmitrouk [Mon, 24 Nov 2014 19:40:07 +0000 (19:40 +0000)]
Correct path to regression tests in ExtendingLLVM

llvm-svn: 222678

9 years ago[AArch64] Fix clobber computation in A57LoadBalancing pass.
Chad Rosier [Mon, 24 Nov 2014 18:57:58 +0000 (18:57 +0000)]
[AArch64] Fix clobber computation in A57LoadBalancing pass.

Extremely difficult to reproduce, so no test case included.
PR21637

llvm-svn: 222677

9 years agoRemoving unused variable.
Colin LeMahieu [Mon, 24 Nov 2014 18:55:32 +0000 (18:55 +0000)]
Removing unused variable.

llvm-svn: 222676

9 years ago[asan/coverage] change the way asan coverage instrumentation is done: instead of...
Kostya Serebryany [Mon, 24 Nov 2014 18:49:53 +0000 (18:49 +0000)]
[asan/coverage] change the way asan coverage instrumentation is done: instead of setting the guard to 1 in the generated code, pass the pointer to guard to __sanitizer_cov and set it there. No user-visible functionality change expected

llvm-svn: 222675

9 years ago[libcxxabi] Delay adjustment of pointer to prevent referencing invalid memory.
Eric Fiselier [Mon, 24 Nov 2014 18:46:37 +0000 (18:46 +0000)]
[libcxxabi] Delay adjustment of pointer to prevent referencing invalid memory.

Summary:
This patch delays the dereference adjustment until we are sure the thrown type is a pointer type. It is possible the thrown type is not a pointer and is smaller than `sizeof(void*)`. If the thrown type is is smaller than `sizeof(void*)` the deference adjustment will result in a heap buffer overflow.

I audited all the call sites of `can_catch(...)` and there are no places where `adjustedPtr` is used if `can_catch(...)` returns false. For this reason the patch should not introduce any functionality change.

This patch fixes the following tests when using ASAN:
* unwind_01.cpp
* unwind_02.cpp
* unwind_04.cpp

Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 222674

9 years ago[compiler-rt] Make the MSAN wmemset intercepter call wmemset instead of memset. Fixes...
Eric Fiselier [Mon, 24 Nov 2014 18:17:04 +0000 (18:17 +0000)]
[compiler-rt] Make the MSAN wmemset intercepter call wmemset instead of memset. Fixes PR 21579

Summary:
Exactly what the title says. I've tested this change against the libc++ test failures and it solves all of them. The check-msan rule also still passes.
I'm not sure why it called memset originally.

I can add tests if requested but currently there are no tests involving wide chars and they are a c++11 features.

Reviewers: kcc, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 222673

9 years ago[PowerPC] Fix PR 21652 - copy st_other bits on symbol assignment
Ulrich Weigand [Mon, 24 Nov 2014 18:09:47 +0000 (18:09 +0000)]
[PowerPC] Fix PR 21652 - copy st_other bits on symbol assignment

When processing an assignment in the integrated assembler that sets
a symbol to the value of another symbol, we need to copy the st_other
bits that encode the local entry point offset.

Modeled after MipsTargetELFStreamer::emitAssignment handling of the
ELF::STO_MIPS_MICROMIPS flag.

llvm-svn: 222672

9 years agoMore long path name support on Windows, this time in program execution.
Paul Robinson [Mon, 24 Nov 2014 18:05:29 +0000 (18:05 +0000)]
More long path name support on Windows, this time in program execution.
Allows long paths for the executable and redirected stdin/stdout/stderr.
Addresses PR21563.

llvm-svn: 222671

9 years ago[Hexagon] Adding asrh instruction, removing unused multiclasses.
Colin LeMahieu [Mon, 24 Nov 2014 18:04:42 +0000 (18:04 +0000)]
[Hexagon] Adding asrh instruction, removing unused multiclasses.

llvm-svn: 222670

9 years ago[Hexagon] Adding aslh instruction.
Colin LeMahieu [Mon, 24 Nov 2014 17:44:19 +0000 (17:44 +0000)]
[Hexagon] Adding aslh instruction.

llvm-svn: 222668

9 years agoReverting r222646; the tests do not pass on Windows. Also reverts r222664, which...
Aaron Ballman [Mon, 24 Nov 2014 17:39:44 +0000 (17:39 +0000)]
Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.

llvm-svn: 222667

9 years agoFix line endings
Nico Rieck [Mon, 24 Nov 2014 17:29:52 +0000 (17:29 +0000)]
Fix line endings

llvm-svn: 222666

9 years agoFix crash when using __if_exists in C mode
Nico Rieck [Mon, 24 Nov 2014 17:29:35 +0000 (17:29 +0000)]
Fix crash when using __if_exists in C mode

llvm-svn: 222665

9 years agoUnbreaking the MSVC 2012 build; however, these tests still fail on Windows.
Aaron Ballman [Mon, 24 Nov 2014 17:22:32 +0000 (17:22 +0000)]
Unbreaking the MSVC 2012 build; however, these tests still fail on Windows.

llvm-svn: 222664

9 years ago[Hexagon] Adding zxth instruction.
Colin LeMahieu [Mon, 24 Nov 2014 17:11:34 +0000 (17:11 +0000)]
[Hexagon] Adding zxth instruction.

llvm-svn: 222662

9 years agoAdding const iterator to MCInst. http://reviews.llvm.org/D6359
Colin LeMahieu [Mon, 24 Nov 2014 16:50:40 +0000 (16:50 +0000)]
Adding const iterator to MCInst. reviews.llvm.org/D6359

llvm-svn: 222661

9 years ago[Hexagon] Adding zxtb instruction.
Colin LeMahieu [Mon, 24 Nov 2014 16:48:43 +0000 (16:48 +0000)]
[Hexagon] Adding zxtb instruction.

llvm-svn: 222660

9 years agoInstCombine: Don't create an unused instruction
David Majnemer [Mon, 24 Nov 2014 16:41:13 +0000 (16:41 +0000)]
InstCombine: Don't create an unused instruction

We would create an instruction but not inserting it.
Not inserting the unused instruction would lead us to verification
failure.

This fixes PR21653.

llvm-svn: 222659

9 years ago[mips][microMIPS] Fix JRADDIUSP instruction
Jozef Kolek [Mon, 24 Nov 2014 16:14:10 +0000 (16:14 +0000)]
[mips][microMIPS] Fix JRADDIUSP instruction

Fix JRADDIUSP instruction, remove delay slot flag because this instruction
doesn't have delay slot.

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

llvm-svn: 222658

9 years agoReverting r222638; it broke the MSVC build bots because Visual Studio 2012 does not...
Aaron Ballman [Mon, 24 Nov 2014 15:42:34 +0000 (15:42 +0000)]
Reverting r222638; it broke the MSVC build bots because Visual Studio 2012 does not support variadic templates. Also reverting r222641 because it was relying on 222638.

llvm-svn: 222656

9 years agoFix lldb(1) man page formatting
Ed Maste [Mon, 24 Nov 2014 15:01:11 +0000 (15:01 +0000)]
Fix lldb(1) man page formatting

- Use canonical date order (per groff & mandoc)
- Fix capitalization on one .Nm
- Remove EOL whitespace

Patch by Baptiste Daroussin in FreeBSD svn r274927.

llvm-svn: 222655

9 years agoAdded comment about llvm_execute_on_thread waiting for thread to complete.
Yaron Keren [Mon, 24 Nov 2014 14:51:41 +0000 (14:51 +0000)]
Added comment about llvm_execute_on_thread waiting for thread to complete.

llvm-svn: 222654

9 years ago[mips][microMIPS] Implement LBU16, LHU16, LW16, SB16, SH16 and SW16 instructions
Jozef Kolek [Mon, 24 Nov 2014 14:39:13 +0000 (14:39 +0000)]
[mips][microMIPS] Implement LBU16, LHU16, LW16, SB16, SH16 and SW16 instructions

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

llvm-svn: 222653

9 years ago[mips][microMIPS] Implement 16-bit instructions registers including ZERO instead...
Jozef Kolek [Mon, 24 Nov 2014 14:25:53 +0000 (14:25 +0000)]
[mips][microMIPS] Implement 16-bit instructions registers including ZERO instead of S0

Implement microMIPS 16-bit instructions register set: $0, $2-$7 and $17.

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

llvm-svn: 222652

9 years ago[Mips] Update MIPS relocations list
Simon Atanasyan [Mon, 24 Nov 2014 14:17:33 +0000 (14:17 +0000)]
[Mips] Update MIPS relocations list

No functional changes.

llvm-svn: 222651

9 years agoReplace a comment that says 'unreachable' with llvm_unreachable in TableGen AsmWriter...
Craig Topper [Mon, 24 Nov 2014 14:09:52 +0000 (14:09 +0000)]
Replace a comment that says 'unreachable' with llvm_unreachable in TableGen AsmWriter output.

llvm-svn: 222650

9 years agoRemoving a variable that is initialized but never read. The original author has been...
Aaron Ballman [Mon, 24 Nov 2014 14:03:16 +0000 (14:03 +0000)]
Removing a variable that is initialized but never read. The original author has been alerted to the warning, in case this variable is meant to be used. Fixes -Werror builds in the meantime.

llvm-svn: 222649

9 years ago[mips][microMIPS] Implement disassembler support for 16-bit instructions
Jozef Kolek [Mon, 24 Nov 2014 13:29:59 +0000 (13:29 +0000)]
[mips][microMIPS] Implement disassembler support for 16-bit instructions

With the help of new method readInstruction16() two bytes are read and
decodeInstruction() is called with DecoderTableMicroMips16, if this fails
four bytes are read and decodeInstruction() is called with
DecoderTableMicroMips32.

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

llvm-svn: 222648

9 years ago[X86] Improved target specific combine on VSELECT dag nodes.
Andrea Di Biagio [Mon, 24 Nov 2014 12:23:15 +0000 (12:23 +0000)]
[X86] Improved target specific combine on VSELECT dag nodes.

This patch teaches function 'transformVSELECTtoBlendVECTOR_SHUFFLE' how to
convert VSELECT dag nodes to shuffles on targets that do not have SSE4.1.
On pre-SSE4.1 targets, we can still perform blend operations using movss/movsd.

Also, removed a target specific combine that performed a premature lowering of
VSELECT nodes to target specific MOVSS/MOVSD nodes.

llvm-svn: 222647

9 years agoAdding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Manuel Klimek [Mon, 24 Nov 2014 09:10:56 +0000 (09:10 +0000)]
Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

llvm-svn: 222646

9 years agoInstCombine: Don't assume DataLayout is always available
David Majnemer [Mon, 24 Nov 2014 07:26:20 +0000 (07:26 +0000)]
InstCombine: Don't assume DataLayout is always available

We tried to get the result of DataLayout::getLargestLegalIntTypeSize but
we didn't have a DataLayout.  This resulted in opt crashing.

This fixes PR21651.

llvm-svn: 222645

9 years agoSupport: Add *cast_or_null<> for pointer wrappers
Duncan P. N. Exon Smith [Mon, 24 Nov 2014 03:13:02 +0000 (03:13 +0000)]
Support: Add *cast_or_null<> for pointer wrappers

Fill in omission of `cast_or_null<>` and `dyn_cast_or_null<>` for types
that wrap pointers (e.g., smart pointers).

Type traits need to be slightly stricter than for `cast<>` and
`dyn_cast<>` to resolve ambiguities with simple types.

There didn't seem to be any unit tests for pointer wrappers, so I tested
`isa<>`, `cast<>`, and `dyn_cast<>` while I was in there.

This only supports pointer wrappers with a conversion to `bool` to check
for null.  If in the future it's useful to support wrappers without such
a conversion, it should be a straightforward incremental step to use the
`simplify_type` machinery for the null check.  In that case, the unit
tests should be updated to remove the `operator bool()` from the
`pointer_wrappers::PTy`.

llvm-svn: 222644

9 years agoDetect best type for some static index tables instead of just using uint32_t to reduc...
Craig Topper [Mon, 24 Nov 2014 02:08:35 +0000 (02:08 +0000)]
Detect best type for some static index tables instead of just using uint32_t to reduce total data size.

llvm-svn: 222643

9 years agoclang-format: Make short case labels work with #ifs
Daniel Jasper [Sun, 23 Nov 2014 21:45:03 +0000 (21:45 +0000)]
clang-format: Make short case labels work with #ifs

Before:
  switch (a) {
  #if FOO
  case 0: return 0; #endif
  }

After:
  switch (a) {
  #if FOO
  case 0: return 0;
  #endif
  }

This fixed llvm.org/PR21544.

llvm-svn: 222642

9 years agoclang-format: [Java] Treat 'instanceof' like other binary operators.
Daniel Jasper [Sun, 23 Nov 2014 21:34:25 +0000 (21:34 +0000)]
clang-format: [Java] Treat 'instanceof' like other binary operators.

This fixes llvm.org/PR21436.

llvm-svn: 222641

9 years agoclang-format: [Java] Space before array initializers.
Daniel Jasper [Sun, 23 Nov 2014 20:54:37 +0000 (20:54 +0000)]
clang-format: [Java] Space before array initializers.

Before:
  new int[]{1, 2, 3, 4};

After:
  new int[] {1, 2, 3, 4};

llvm-svn: 222640

9 years agoclang-format: Improve ObjC blocks with return type.
Daniel Jasper [Sun, 23 Nov 2014 19:15:35 +0000 (19:15 +0000)]
clang-format: Improve ObjC blocks with return type.

Before:
  Block b = ^int * (A * a, B * b) {}

After:
  Block b = ^int *(A *a, B *b) {}

This fixed llvm.org/PR21619.

llvm-svn: 222639

9 years agoclang-format: Refactoring.
Daniel Jasper [Sun, 23 Nov 2014 19:03:25 +0000 (19:03 +0000)]
clang-format: Refactoring.

Provide more overloads to simplify testing the type of a token. No
functional changes intended.

llvm-svn: 222638

9 years agoclang-format: [JS] Support Closure's module statements.
Daniel Jasper [Sun, 23 Nov 2014 16:46:28 +0000 (16:46 +0000)]
clang-format: [JS] Support Closure's module statements.

These are like import statements and should not be line-wrapped. Minor
restructuring of the handling of other import statements.

llvm-svn: 222637

9 years agoConverted back to Unix format (after my last commit 222632)
Elena Demikhovsky [Sun, 23 Nov 2014 15:21:53 +0000 (15:21 +0000)]
Converted back to Unix format (after my last commit 222632)

llvm-svn: 222636

9 years ago[X86] Fixes bug in build_vector v4x32 lowering
Michael Kuperstein [Sun, 23 Nov 2014 13:09:06 +0000 (13:09 +0000)]
[X86] Fixes bug in build_vector v4x32 lowering

r222375 made some improvements to build_vector lowering of v4x32 and v4xf32 into an insertps, but it missed a case where:

1. A single extracted element is used twice.
2. The lower of the two non-zero indexes should be preserved, and the higher should be used for the dest mask.

This caused a crash, since the source value for the insertps ends-up uninitialized.

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

llvm-svn: 222635

9 years agoAdd missing override keywords.
Craig Topper [Sun, 23 Nov 2014 09:40:13 +0000 (09:40 +0000)]
Add missing override keywords.

llvm-svn: 222634

9 years agoTablegen output formatting fixes.
Craig Topper [Sun, 23 Nov 2014 09:40:10 +0000 (09:40 +0000)]
Tablegen output formatting fixes.

llvm-svn: 222633

9 years agoMasked Vector Load and Store Intrinsics.
Elena Demikhovsky [Sun, 23 Nov 2014 08:07:43 +0000 (08:07 +0000)]
Masked Vector Load and Store Intrinsics.
Introduced new target-independent intrinsics in order to support masked vector loads and stores. The loop vectorizer optimizes loops containing conditional memory accesses by generating these intrinsics for existing targets AVX2 and AVX-512. The vectorizer asks the target about availability of masked vector loads and stores.
Added SDNodes for masked operations and lowering patterns for X86 code generator.
Examples:
<16 x i32> @llvm.masked.load.v16i32(i8* %addr, <16 x i32> %passthru, i32 4 /* align */, <16 x i1> %mask)
declare void @llvm.masked.store.v8f64(i8* %addr, <8 x double> %value, i32 4, <8 x i1> %mask)

Scalarizer for other targets (not AVX2/AVX-512) will be done in a separate patch.

http://reviews.llvm.org/D6191

llvm-svn: 222632

9 years agoR600: Fix extloads of i1 on R600/Evergreen
Matt Arsenault [Sun, 23 Nov 2014 02:57:54 +0000 (02:57 +0000)]
R600: Fix extloads of i1 on R600/Evergreen

llvm-svn: 222631

9 years agoR600: Fix assert on copy of an i1 on pre-SI
Matt Arsenault [Sun, 23 Nov 2014 02:57:52 +0000 (02:57 +0000)]
R600: Fix assert on copy of an i1 on pre-SI

i1 is not a legal type on Evergreen, so this combine proceeded
and tried to produce a bitcast between i1 and i8.

llvm-svn: 222630

9 years agoR600/SI: Add additional tests for i1 loads
Matt Arsenault [Sun, 23 Nov 2014 02:57:50 +0000 (02:57 +0000)]
R600/SI: Add additional tests for i1 loads

llvm-svn: 222629

9 years agoR600/SI: Fix broken check lines and modernize prefixes
Matt Arsenault [Sun, 23 Nov 2014 02:57:49 +0000 (02:57 +0000)]
R600/SI: Fix broken check lines and modernize prefixes

Use -LABEL and remove -CHECK

llvm-svn: 222628

9 years agoR600/SI: Fix missing -verify-machineinstrs on a test
Matt Arsenault [Sun, 23 Nov 2014 02:57:47 +0000 (02:57 +0000)]
R600/SI: Fix missing -verify-machineinstrs on a test

llvm-svn: 222627

9 years agoCodeGen: tweak struct ABI handling
Saleem Abdulrasool [Sun, 23 Nov 2014 02:16:24 +0000 (02:16 +0000)]
CodeGen: tweak struct ABI handling

Cygwin and MinGW fail to conform to the underlying system's structure passing
ABI.  Make the check more precise to ensure that we correctly generate code for
the itanium environment.

llvm-svn: 222626

9 years agoInstCombine: Propagate exact for (sdiv X, Pow2) -> (udiv X, Pow2)
David Majnemer [Sat, 22 Nov 2014 20:00:41 +0000 (20:00 +0000)]
InstCombine: Propagate exact for (sdiv X, Pow2) -> (udiv X, Pow2)

llvm-svn: 222625

9 years agoInstCombine: Propagate exact for (sdiv X, Y) -> (udiv X, Y)
David Majnemer [Sat, 22 Nov 2014 20:00:38 +0000 (20:00 +0000)]
InstCombine: Propagate exact for (sdiv X, Y) -> (udiv X, Y)

llvm-svn: 222624

9 years agoInstCombine: Propagate exact for (sdiv -X, C) -> (sdiv X, -C)
David Majnemer [Sat, 22 Nov 2014 20:00:34 +0000 (20:00 +0000)]
InstCombine: Propagate exact for (sdiv -X, C) -> (sdiv X, -C)

llvm-svn: 222623

9 years agoTidied up target triple OS detection. NFC
Simon Pilgrim [Sat, 22 Nov 2014 19:12:10 +0000 (19:12 +0000)]
Tidied up target triple OS detection. NFC

Use Triple::isOS*() helper functions where possible.

llvm-svn: 222622

9 years agoReduce size of some tables in tablegen register info output.
Craig Topper [Sat, 22 Nov 2014 18:30:18 +0000 (18:30 +0000)]
Reduce size of some tables in tablegen register info output.

Primarily done by using SequenceToOffsetTable to reduce the register pressure set tables and then sizing the indices into the tables appropriately. Size a few other table entries based on content as well. Reduces X86RegisterInfo.o by ~9k.

llvm-svn: 222621

9 years agoInstCombine: Propagate exact in (udiv (lshr X,C1),C2) -> (udiv x,C1<<C2)
David Majnemer [Sat, 22 Nov 2014 18:16:54 +0000 (18:16 +0000)]
InstCombine: Propagate exact in (udiv (lshr X,C1),C2) -> (udiv x,C1<<C2)

llvm-svn: 222620

9 years agoTry to fix ARM buildbots
Renato Golin [Sat, 22 Nov 2014 16:59:03 +0000 (16:59 +0000)]
Try to fix ARM buildbots

llvm-svn: 222619

9 years agoSupport matching signext attribute in the parallel_num_threads_codegen test to appeas...
Daniel Sanders [Sat, 22 Nov 2014 16:21:18 +0000 (16:21 +0000)]
Support matching signext attribute in the parallel_num_threads_codegen test to appease clang-cmake-mips builder.

The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222618

9 years agoSupport matching signext attribute in vla-lambda-capturing test to appease clang...
Daniel Sanders [Sat, 22 Nov 2014 16:08:56 +0000 (16:08 +0000)]
Support matching signext attribute in vla-lambda-capturing test to appease clang-cmake-mips builder.

The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222617

9 years agoCodeGen: Make atomic operations play nice with address spaces
David Majnemer [Sat, 22 Nov 2014 10:44:12 +0000 (10:44 +0000)]
CodeGen: Make atomic operations play nice with address spaces

We were being a little sloppy with our pointer/address space casts.

This fixes PR21643.

llvm-svn: 222615

9 years ago[x86] Teach the vector shuffle yet another step of canonicalization.
Chandler Carruth [Sat, 22 Nov 2014 09:18:53 +0000 (09:18 +0000)]
[x86] Teach the vector shuffle yet another step of canonicalization.

No functionality changed yet, but this will prevent subsequent patches
from having to handle permutations of various interleaved shuffle
patterns.

llvm-svn: 222614

9 years agoInstCombine: Propagate NSW/NUW for X*(1<<Y) -> X<<Y
David Majnemer [Sat, 22 Nov 2014 08:57:02 +0000 (08:57 +0000)]
InstCombine: Propagate NSW/NUW for X*(1<<Y) -> X<<Y

llvm-svn: 222613

9 years agoInstCombine: Propagate NSW for -X * -Y -> X * Y
David Majnemer [Sat, 22 Nov 2014 07:25:19 +0000 (07:25 +0000)]
InstCombine: Propagate NSW for -X * -Y -> X * Y

llvm-svn: 222612

9 years agoInstSimplify: Simplify (sub 0, X) -> X if it's NUW
David Majnemer [Sat, 22 Nov 2014 07:15:16 +0000 (07:15 +0000)]
InstSimplify: Simplify (sub 0, X) -> X if it's NUW

This is a generalization of the X - (0 - Y) -> X transform.

llvm-svn: 222611

9 years agoSimplify MicrosoftMangleContextImpl::shouldMangleStringLiteral
David Majnemer [Sat, 22 Nov 2014 06:20:38 +0000 (06:20 +0000)]
Simplify MicrosoftMangleContextImpl::shouldMangleStringLiteral

No functionality changed.

llvm-svn: 222610

9 years agoInstCombine: Silence a parenthesis warning
David Majnemer [Sat, 22 Nov 2014 06:09:28 +0000 (06:09 +0000)]
InstCombine: Silence a parenthesis warning

llvm-svn: 222609

9 years agoMark 9 lldb unit tests for ubuntu as XFAIL.
Siva Chandra [Sat, 22 Nov 2014 05:55:00 +0000 (05:55 +0000)]
Mark 9 lldb unit tests for ubuntu as XFAIL.

The following lldb unit tests fail check-lldb on ubuntu:

TestDataFormatterStdMap.py
TestDataFormatterStdVBool.py
TestDataFormatterStdVector.py
TestDataFormatterSynthVal.py
TestEvents.py
TestInitializerList.py
TestMemoryHistory.py
TestReportData.py
TestValueVarUpdate.py

These unit test failures are for non-core functionality. The intent is to
reduce the check-lldb FAILS to core functionality FAILS and then circle
back later and fix these FAILS at a later date.

llvm-svn: 222608

9 years ago[x86] Add some tests for a common unpack pattern of vector shuffle that
Chandler Carruth [Sat, 22 Nov 2014 05:44:43 +0000 (05:44 +0000)]
[x86] Add some tests for a common unpack pattern of vector shuffle that
has a remarkably unique and efficient lowering.

While we get this some of the time already, we miss a few cases and
there wasn't a principled reason we got it. We should at least test
this. v8 already has tests for this pattern.

llvm-svn: 222607

9 years agoInstCombine: Preserve nsw when folding X*(2^C) -> X << C
David Majnemer [Sat, 22 Nov 2014 04:52:55 +0000 (04:52 +0000)]
InstCombine: Preserve nsw when folding X*(2^C) -> X << C

llvm-svn: 222606

9 years agoInstCombine: Preserve nsw/nuw for ((X << C2)*C1) -> (X * (C1 << C2))
David Majnemer [Sat, 22 Nov 2014 04:52:52 +0000 (04:52 +0000)]
InstCombine: Preserve nsw/nuw for ((X << C2)*C1) -> (X * (C1 << C2))

llvm-svn: 222605

9 years agoInstCombine: Preserve nsw for (mul %V, -1) -> (sub 0, %V)
David Majnemer [Sat, 22 Nov 2014 04:52:38 +0000 (04:52 +0000)]
InstCombine: Preserve nsw for (mul %V, -1) -> (sub 0, %V)

llvm-svn: 222604