oota-llvm.git
12 years agoPut flag names on one line.
Bill Wendling [Tue, 19 Jun 2012 09:29:05 +0000 (09:29 +0000)]
Put flag names on one line.

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

12 years agoFix italicized text.
Bill Wendling [Tue, 19 Jun 2012 09:27:54 +0000 (09:27 +0000)]
Fix italicized text.

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

12 years agoUse correct URL.
Bill Wendling [Tue, 19 Jun 2012 09:26:15 +0000 (09:26 +0000)]
Use correct URL.

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

12 years agoFix numbering of list items.
Bill Wendling [Tue, 19 Jun 2012 09:25:04 +0000 (09:25 +0000)]
Fix numbering of list items.

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

12 years agoFix some Sphinx mistakes.
Bill Wendling [Tue, 19 Jun 2012 09:23:23 +0000 (09:23 +0000)]
Fix some Sphinx mistakes.

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

12 years agoFirst attempt at Sphinx. Convert the Projects.html file to Sphinx format.
Bill Wendling [Tue, 19 Jun 2012 09:18:34 +0000 (09:18 +0000)]
First attempt at Sphinx. Convert the Projects.html file to Sphinx format.

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

12 years ago[Support/PathV2] Fix out of bounds access in identify_magic when the file is empty.
Michael J. Spencer [Tue, 19 Jun 2012 05:29:57 +0000 (05:29 +0000)]
[Support/PathV2] Fix out of bounds access in identify_magic when the file is empty.

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

12 years agoMake MipsLongBranch::runOnMachineFunction return true.
Akira Hatanaka [Tue, 19 Jun 2012 03:45:29 +0000 (03:45 +0000)]
Make MipsLongBranch::runOnMachineFunction return true.

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

12 years agoUse MachineBasicBlock::instr_iterator instead of MachineBasicBlock::iterator in
Akira Hatanaka [Tue, 19 Jun 2012 03:39:45 +0000 (03:39 +0000)]
Use MachineBasicBlock::instr_iterator instead of MachineBasicBlock::iterator in
MipsCodeEmitter.cpp.

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

12 years agoAdd support for generating reg+reg preinc stores on PPC.
Hal Finkel [Tue, 19 Jun 2012 02:34:32 +0000 (02:34 +0000)]
Add support for generating reg+reg preinc stores on PPC.

PPC will now generate STWUX and friends.

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

12 years agoreally add a triple :-(
Rafael Espindola [Tue, 19 Jun 2012 02:17:35 +0000 (02:17 +0000)]
really add a triple :-(

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

12 years agoAdd a triple to the test.
Rafael Espindola [Tue, 19 Jun 2012 01:42:34 +0000 (01:42 +0000)]
Add a triple to the test.

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

12 years agoMove the support for using .init_array from ARM to the generic
Rafael Espindola [Tue, 19 Jun 2012 00:48:28 +0000 (00:48 +0000)]
Move the support for using .init_array from ARM to the generic
TargetLoweringObjectFileELF. Use this to support it on X86. Unlike ARM,
on X86 it is not easy to find out if .init_array should be used or not, so
the decision is made via TargetOptions and defaults to off.

Add a command line option to llc that enables it.

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

12 years agorevert r158660, since Chris has some issues with this patch (namely using code to...
Nuno Lopes [Mon, 18 Jun 2012 23:34:26 +0000 (23:34 +0000)]
revert r158660, since Chris has some issues with this patch (namely using code to reprent information only used by the compiler)

Original commit msg:
add the 'alloc' metadata node to represent the size of offset of buffers pointed to by pointers.
This metadata can be attached to any instruction returning a pointer

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

12 years agoDon't copy a potentially-uninitialized variable.
David Blaikie [Mon, 18 Jun 2012 22:31:28 +0000 (22:31 +0000)]
Don't copy a potentially-uninitialized variable.

Based on review discussion of r158638 with Chandler Carruth, Tobias von Koch, and Duncan Sands and a -Wmaybe-uninitialized warning from GCC.

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

12 years agoARM: use NOEN loads and stores if possible when handling struct byval.
Manman Ren [Mon, 18 Jun 2012 22:23:48 +0000 (22:23 +0000)]
ARM: use NOEN loads and stores if possible when handling struct byval.

This change is to be enabled in clang.

rdar://9877866

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

12 years agoAllow up to 64 functional units per processor itinerary.
Hal Finkel [Mon, 18 Jun 2012 21:08:18 +0000 (21:08 +0000)]
Allow up to 64 functional units per processor itinerary.

This patch changes the type used to hold the FU bitset from unsigned to uint64_t.
This will be needed for some upcoming PowerPC itineraries.

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

12 years ago[docs] Port FAQ over to Sphinx.
Michael J. Spencer [Mon, 18 Jun 2012 20:21:38 +0000 (20:21 +0000)]
[docs] Port FAQ over to Sphinx.

Patch by Mikael Lyngvig!

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

12 years agoAdded accessors for getting coff_relocation info
Marshall Clow [Mon, 18 Jun 2012 19:47:16 +0000 (19:47 +0000)]
Added accessors for getting coff_relocation info

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

12 years agoARM: Define generic HINT instruction.
Jim Grosbach [Mon, 18 Jun 2012 19:45:50 +0000 (19:45 +0000)]
ARM: Define generic HINT instruction.

The NOP, WFE, WFI, SEV and YIELD instructions are all hints w/
a different immediate value in bits [7,0]. Define a generic HINT
instruction and refactor NOP, WFI, WFI, SEV and YIELD to be
assembly aliases of that.

rdar://11600518

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

12 years agoTableGen: AsmMatcher missing-features list minimization.
Jim Grosbach [Mon, 18 Jun 2012 19:45:46 +0000 (19:45 +0000)]
TableGen: AsmMatcher missing-features list minimization.

When returning a 'cannot match due to missing CPU features' error code,
if there are multiple potential matches with different feature sets,
return the smallest set of missing features from the alternatives as
that's most likely to be the one that's desired.

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

12 years agoAdd mipsel-* to the list of targets recognized by configure script.
Simon Atanasyan [Mon, 18 Jun 2012 19:06:25 +0000 (19:06 +0000)]
Add mipsel-* to the list of targets recognized by configure script.

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

12 years agoadd the 'alloc' metadata node to represent the size of offset of buffers pointed...
Nuno Lopes [Mon, 18 Jun 2012 16:04:04 +0000 (16:04 +0000)]
add the 'alloc' metadata node to represent the size of offset of buffers pointed to by pointers.
This metadata can be attached to any instruction returning a pointer

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

12 years agoThis change handles a another case for generating the bic instruction
Joel Jones [Mon, 18 Jun 2012 14:51:32 +0000 (14:51 +0000)]
This change handles a another case for generating the bic instruction
when a compile time constant is known.  This occurs when implicitly zero
extending function arguments from 16 bits to 32 bits.  The 8 bit case doesn't
need to be handled, as the 8 bit constants are encoded directly, thereby
not needing a separate load instruction to form the constant into a register.

<rdar://problem/11481151>

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

12 years agoAdd a regression test for the bug exposed by r158087, which has been
Chandler Carruth [Mon, 18 Jun 2012 09:15:04 +0000 (09:15 +0000)]
Add a regression test for the bug exposed by r158087, which has been
temporarily reverted.

This test is annoyingly overspecified, but I don't know of another way
to thoroughly test the saving and restoring of the registers. While this
will have to be adjusted even with the issue fixed in order to re-apply
r158087, those adjustments should very clearly indicate that it is still
correct (%esp getting restored prior to pops), whereas without it, this
case can easily slip under the radar.

Still, any suggestions for improvements are very welcome.

All credit to Matt Beaumont-Gay for reducing this out of an insane
Address Sanitizer crash to a reasonably small seg-faulting C program
when built with -mstackrealign. I just reduced it to IR, which was much
simpler. =]

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

12 years agoTemporarily revert r158087.
Chandler Carruth [Mon, 18 Jun 2012 07:03:12 +0000 (07:03 +0000)]
Temporarily revert r158087.

This patch causes problems when both dynamic stack realignment and
dynamic allocas combine in the same function. With this patch, we no
longer build the epilog correctly, and silently restore registers from
the wrong position in the stack.

Thanks to Matt for tracking this down, and getting at least an initial
test case to Chad. I'm going to try to check a variation of that test
case in so we can easily track the fixes required.

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

12 years agoTableGen.cmake: Fix to work without LLVM_COMMON_DEPENDS.
NAKAMURA Takumi [Sun, 17 Jun 2012 15:41:56 +0000 (15:41 +0000)]
TableGen.cmake: Fix to work without LLVM_COMMON_DEPENDS.

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

12 years agoFor reasons I can't fathom MSVC supports ULL but not LLU suffixes on long long intege...
Benjamin Kramer [Sun, 17 Jun 2012 14:53:53 +0000 (14:53 +0000)]
For reasons I can't fathom MSVC supports ULL but not LLU suffixes on long long integer literals.

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

12 years agoAdd missing unittest files to the cmake build.
Benjamin Kramer [Sun, 17 Jun 2012 14:42:49 +0000 (14:42 +0000)]
Add missing unittest files to the cmake build.

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

12 years agoRemove SmallMap unittests, unbreaking the build.
Benjamin Kramer [Sun, 17 Jun 2012 12:46:18 +0000 (12:46 +0000)]
Remove SmallMap unittests, unbreaking the build.

I don't know how useful these are for SmallDenseMap, I'll leave that decision to Chandler.

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

12 years agoBring the return value of SmallVector::insert in line with std::vector::insert.
Benjamin Kramer [Sun, 17 Jun 2012 12:46:13 +0000 (12:46 +0000)]
Bring the return value of SmallVector::insert in line with std::vector::insert.

It always returns the iterator for the first inserted element, or the passed in
iterator if the inserted range was empty. Flesh out the unit test more and fix
all the cases it uncovered so far.

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

12 years agoRemove SmallMap, and the several files that were used to implement it.
Chandler Carruth [Sun, 17 Jun 2012 12:07:42 +0000 (12:07 +0000)]
Remove SmallMap, and the several files that were used to implement it.
We have SmallDenseMap now that has more correct and predictable
semantics, even though it is a more narrow abstraction.

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

12 years agoSmallVector: return a valid iterator for the rare case of inserting an empty range...
Benjamin Kramer [Sun, 17 Jun 2012 11:52:22 +0000 (11:52 +0000)]
SmallVector: return a valid iterator for the rare case of inserting an empty range into a SmallVector.

Patch by Johannes Schaub!

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

12 years agoAdd a unit test for 'swap', and fix a pile of bugs in
Chandler Carruth [Sun, 17 Jun 2012 11:28:13 +0000 (11:28 +0000)]
Add a unit test for 'swap', and fix a pile of bugs in
SmallDenseMap::swap.

First, make it parse cleanly. Yay for uninstantiated methods.

Second, make the inline-buckets case work correctly. This is way
trickier than it should be due to the uninitialized values in empty and
tombstone buckets.

Finally fix a few typos that caused construction/destruction mismatches
in the counting unittest.

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

12 years agoDisable a particular assertion on MSVC... I'm deeply disturbed by its
Chandler Carruth [Sun, 17 Jun 2012 10:36:49 +0000 (10:36 +0000)]
Disable a particular assertion on MSVC... I'm deeply disturbed by its
implementation of the class layout for the V8 type.

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

12 years agoAdd tests for *DenesMap for both key and value types' construction and
Chandler Carruth [Sun, 17 Jun 2012 10:33:51 +0000 (10:33 +0000)]
Add tests for *DenesMap for both key and value types' construction and
destruction and fix a bug in SmallDenseMap they caught.

This is kind of a poor-man's version of the testing that just adds the
addresses to a set on construction and removes them on destruction. We
check that double construction and double destruction don't occur.
Amusingly enough, this is enough to catch a lot of SmallDenseMap issues
because we spend a lot of time with fixed stable addresses in the inline
buffer.

The SmallDenseMap bug fix included makes grow() not double-destroy in
some cases. It also fixes a FIXME there, the code was pretty crappy. We
now don't have any wasted initialization, but we do move the entries in
inline bucket array an extra time. It's probably a better tradeoff, and
is much easier to get correct.

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

12 years agoIntroduce a SmallDenseMap container that re-uses the existing DenseMap
Chandler Carruth [Sun, 17 Jun 2012 09:05:09 +0000 (09:05 +0000)]
Introduce a SmallDenseMap container that re-uses the existing DenseMap
implementation.

This type includes an inline bucket array which is used initially. Once
it is exceeded, an array of 64 buckets is allocated on the heap. The
bucket count grows from there as needed. Some highlights of this
implementation:

- The inline buffer is very carefully aligned, and so supports types
  with alignment constraints.
- It works hard to avoid aliasing issues.
- Supports types with non-trivial constructors, destructors, copy
  constructions, etc. It works reasonably hard to minimize copies and
  unnecessary initialization. The most common initialization is to set
  keys to the empty key, and so that should be fast if at all possible.

This class has a performance / space trade-off. It tries to optimize for
relatively small maps, and so packs the inline bucket array densely into
the object. It will be marginally slower than a normal DenseMap in a few
use patterns, so it isn't appropriate everywhere.

The unit tests for DenseMap have been generalized a bit to support
running over different map implementations in addition to different
key/value types. They've then been automatically extended to cover the
new container through the magic of GoogleTest's typed tests.

All of this is still a bit rough though. I'm going to be cleaning up
some aspects of the implementation, documenting things better, and
adding tests which include non-trivial types. As soon as I'm comfortable
with the correctness, I plan to switch existing users of SmallMap over
to this class as it is already more correct w.r.t. construction and
destruction of objects iin the map.

Thanks to Benjamin Kramer for all the reviews of this and the lead-up
patches. That said, more review on this would really be appreciated. As
I've noted a few times, I'm quite surprised how hard it is to get the
semantics for a hashtable-based map container with a small buffer
optimization correct. =]

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

12 years agoAdd some somewhat exhaustive tests of sizeof properties of this horrible
Chandler Carruth [Sun, 17 Jun 2012 09:05:04 +0000 (09:05 +0000)]
Add some somewhat exhaustive tests of sizeof properties of this horrible
construct just for my sanity.

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

12 years agoNow that SROA can form alloca's for dynamic vector accesses, further improve it to...
Pete Cooper [Sun, 17 Jun 2012 03:58:26 +0000 (03:58 +0000)]
Now that SROA can form alloca's for dynamic vector accesses, further improve it to be able to replace operations on these vector alloca's with insert/extract element insts

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

12 years agoDisable the right instance of TheJIT, this one is only used in asserts.
Benjamin Kramer [Sat, 16 Jun 2012 21:55:52 +0000 (21:55 +0000)]
Disable the right instance of TheJIT, this one is only used in asserts.

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

12 years agoGuard private fields that are unused in Release builds with #ifndef NDEBUG.
Benjamin Kramer [Sat, 16 Jun 2012 21:48:13 +0000 (21:48 +0000)]
Guard private fields that are unused in Release builds with #ifndef NDEBUG.

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

12 years agoCleanup trip-count finding for PPC CTR loops (and some bug fixes).
Hal Finkel [Sat, 16 Jun 2012 20:34:07 +0000 (20:34 +0000)]
Cleanup trip-count finding for PPC CTR loops (and some bug fixes).

This cleans up the method used to find trip counts in order to form CTR loops on PPC.
This refactoring allows the pass to find loops which have a constant trip count but also
happen to end with a comparison to zero. This also adds explicit FIXMEs to mark two different
classes of loops that are currently ignored.

In addition, we now search through all potential induction operations instead of just the first.
Also, we check the predicate code on the conditional branch and abort the transformation if the
code is not EQ or NE, and we then make sure that the branch to be transformed matches the
condition register defined by the comparison (multiple possible comparisons will be considered).

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

12 years agoTeach BBVectorize to combine, when possible, or discard metadata when fusing instruct...
Hal Finkel [Sat, 16 Jun 2012 20:34:06 +0000 (20:34 +0000)]
Teach BBVectorize to combine, when possible, or discard metadata when fusing instructions.

The present implementation handles only TBAA and FP metadata, discarding everything else.
For debug metadata, the current behavior is maintained (the debug metadata associated with
one of the instructions will be kept, discarding that attached to the other).

This should address PR 13040.

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

12 years agoMove the Metadata merging methods from GVN and make them public in MDNode.
Hal Finkel [Sat, 16 Jun 2012 20:33:37 +0000 (20:33 +0000)]
Move the Metadata merging methods from GVN and make them public in MDNode.

There are other passes, BBVectorize specifically, that also need some of
this functionality.

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

12 years agoImplement irpc. Extracted from a patch by the PaX team. I just added the test.
Rafael Espindola [Sat, 16 Jun 2012 18:03:25 +0000 (18:03 +0000)]
Implement irpc. Extracted from a patch by the PaX team. I just added the test.

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

12 years ago*no need to pollute Intel syntax with bonus mnemonics; operand size is explicitly...
Kay Tiong Khoo [Sat, 16 Jun 2012 17:19:49 +0000 (17:19 +0000)]
*no need to pollute Intel syntax with bonus mnemonics; operand size is explicitly specified

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

12 years agoMips/AsmParser/CMakeLists.txt: Fix dependency.
NAKAMURA Takumi [Sat, 16 Jun 2012 15:33:52 +0000 (15:33 +0000)]
Mips/AsmParser/CMakeLists.txt: Fix dependency.

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

12 years agoUpdate CMake build.
Benjamin Kramer [Sat, 16 Jun 2012 10:53:58 +0000 (10:53 +0000)]
Update CMake build.

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

12 years agoMerge the SmallBitVector and BitVector unit tests with gtest's typed test magic and...
Benjamin Kramer [Sat, 16 Jun 2012 10:51:07 +0000 (10:51 +0000)]
Merge the SmallBitVector and BitVector unit tests with gtest's typed test magic and bring SmallBitVector up to date.

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

12 years agoRelax one assertion -- long double has strange alignments on lots of
Chandler Carruth [Sat, 16 Jun 2012 09:44:00 +0000 (09:44 +0000)]
Relax one assertion -- long double has strange alignments on lots of
platforms.

Also, remove one assertion on MSVC because it produces a completely
preposterous result, claiming something needs 12-byte alignment.

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

12 years agoTry to reduce the size of the array used for compile-time testing by
Chandler Carruth [Sat, 16 Jun 2012 09:25:11 +0000 (09:25 +0000)]
Try to reduce the size of the array used for compile-time testing by
making the bounds all '1', and chunking it a bit.

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

12 years agoAdd support to the alignment support header for conjuring a character
Chandler Carruth [Sat, 16 Jun 2012 08:52:57 +0000 (08:52 +0000)]
Add support to the alignment support header for conjuring a character
array of a suitable size and alignment for any of a number of different
types to be stored into the character array.

The mechanisms for producing an explicitly aligned type are fairly
complex because this operation is poorly supported on all compilers.
We've spent a fairly significant amount of time experimenting with
different implementations inside of Google, and the one using explicitly
expanded templates has been the most robust.

Credit goes to Nick Lewycky for writing the first 20 versions or so of
this logic we had inside of Google. I based this on the only one to
actually survive. In case anyone is worried, yes we are both explicitly
re-contributing and re-licensing it for LLVM. =]

Once the issues with actually specifying the alignment are finished, it
turns out that most compilers don't in turn align anything the way they
are instructed. Testing of this logic against both Clang and GCC
indicate that the alignment constraints are largely ignored by both
compilers! I've come up with and used a work-around by wrapping each
alignment-hinted type directly in a struct, and using that struct to
align the character array through a union. This elaborate hackery is
terrifying, but I've included testing that caught a terrifying number of
bugs in every other technique I've tried.

All of this in order to implement a poor C++98 programmers emulation of
C++11 unrestricted unions in classes such as SmallDenseMap.

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

12 years agoIt's not deterministic to iterate over SmallPtrSet. Replace it with SmallSetVector...
Evan Cheng [Sat, 16 Jun 2012 04:28:11 +0000 (04:28 +0000)]
It's not deterministic to iterate over SmallPtrSet. Replace it with SmallSetVector. Patch by Daniel Reynaud. rdar://11671029

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

12 years agoWork around a bug with MSVC 10 where it fails to recognize a valid use
Chandler Carruth [Sat, 16 Jun 2012 03:54:11 +0000 (03:54 +0000)]
Work around a bug with MSVC 10 where it fails to recognize a valid use
of typename. GCC and Clang were fine with this, but MSVC won't accept
it. Fortunately, it also doesn't need it. Yuck.

Thanks to Nakamura for pointing this out in IRC.

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

12 years agoFix crash from r158529 on Bullet.
Pete Cooper [Sat, 16 Jun 2012 01:43:26 +0000 (01:43 +0000)]
Fix crash from r158529 on Bullet.

Dynamic GEPs created by SROA needed to insert extra "i32 0"
operands to index through structs and arrays to get to the
vector being indexed.

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

12 years agoType parameterize the DenseMap unit tests.
Chandler Carruth [Sat, 16 Jun 2012 01:31:33 +0000 (01:31 +0000)]
Type parameterize the DenseMap unit tests.

These were already trying to be type parameterized over different
key/value pairs. I've realized this goal using GoogleTest's typed test
functionality. This allows us to easily replicate the tests across
different key/value combinations and soon different mapping templates.

I've fixed a few bugs in the tests and extended them a bit in the
process as many tests were only applying to the int->int mapping.

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

12 years agoLift the NumElements and NumTombstones members into the super class
Chandler Carruth [Sat, 16 Jun 2012 01:18:07 +0000 (01:18 +0000)]
Lift the NumElements and NumTombstones members into the super class
rather than the base class. Add a pile of boilerplate to indirect around
this.

This is pretty ugly, but it allows the super class to change the
representation of these values, which will be key for doing
a SmallDenseMap.

Suggestions on better method structuring / naming are welcome, but keep
in mind that SmallDenseMap won't have an 'unsigned' member to expose
a reference to... =/

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

12 years agoFactor DenseMap into a base class that implements the hashtable logic,
Chandler Carruth [Sat, 16 Jun 2012 01:05:01 +0000 (01:05 +0000)]
Factor DenseMap into a base class that implements the hashtable logic,
and a derived class that provides the allocation and growth strategy.

This is the first (and biggest) step toward building a SmallDenseMap
that actually behaves exactly the same as DenseMap, and supports all the
same types and interface points with the same semantics.

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

12 years agoDon't call 'FilesToRemove[0]' when the vector is empty, even to compute
Chandler Carruth [Sat, 16 Jun 2012 00:44:07 +0000 (00:44 +0000)]
Don't call 'FilesToRemove[0]' when the vector is empty, even to compute
the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

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

12 years agoHarden the Unix signals code to be more async signal safe.
Chandler Carruth [Sat, 16 Jun 2012 00:09:41 +0000 (00:09 +0000)]
Harden the Unix signals code to be more async signal safe.

This is likely only the tip of the ice berg, but this particular bug
caused any double-free on a glibc system to turn into a deadlock! It is
not generally safe to either allocate or release heap memory from within
the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting
memory and causing the deadlock. What's worse, eraseFromDisk in PathV1
has lots of allocation and deallocation paths. We even passed 'true' in
a place that would have caused the *signal handler* to try to run the
'system' system call and shell out to 'rm -rf'. That was never going to
work...

This patch switches the file removal to use a vector of strings so that
the exact text needed for the 'unlink' system call can be stored there.
It switches the loop to be a boring indexed loop, and directly calls
unlink without looking at the error. It also works quite hard to ensure
that calling 'c_str()' is safe, by ensuring that the non-signal-handling
code path that manipulates the vector always leaves it in a state where
every element has already had 'c_str()' called at least once.

I dunno exactly how overkill this is, but it fixes the
deadlock-on-double free issue, and seems likely to prevent any other
issues from sneaking up.

Sorry for not having a test case, but I *really* don't know how to test
signal handling code easily....

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

12 years agoRemove final verification in RABasic.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 23:48:48 +0000 (23:48 +0000)]
Remove final verification in RABasic.

We now have a proper machine code verifier pass between register
allocation and rewriting.

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

12 years agoPrint out register number in InlineSpiller.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 23:47:09 +0000 (23:47 +0000)]
Print out register number in InlineSpiller.

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

12 years agoUnit test for LSR kind=Special fix: r158536.
Andrew Trick [Fri, 15 Jun 2012 22:46:31 +0000 (22:46 +0000)]
Unit test for LSR kind=Special fix: r158536.

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

12 years agoAccept null PhysReg arguments to checkRegMaskInterference.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 22:24:22 +0000 (22:24 +0000)]
Accept null PhysReg arguments to checkRegMaskInterference.

Calling checkRegMaskInterference(VirtReg) checks if VirtReg crosses any
regmask operands, regardless of the registers they clobber.

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

12 years ago[docs] Make it pretty.
Michael J. Spencer [Fri, 15 Jun 2012 22:17:44 +0000 (22:17 +0000)]
[docs] Make it pretty.

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

12 years agoFix the encoding of the armv7m (MClass) for MSR registers other than aspr,
Kevin Enderby [Fri, 15 Jun 2012 22:14:44 +0000 (22:14 +0000)]
Fix the encoding of the armv7m (MClass) for MSR registers other than aspr,
iaspr, espr and xpsr which also needed to have 0b10 in their mask encoding bits.

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

12 years agoARM: optimization for sub+abs.
Manman Ren [Fri, 15 Jun 2012 21:32:12 +0000 (21:32 +0000)]
ARM: optimization for sub+abs.

This patch will optimize abs(x-y)
FROM
sub, movs, rsbmi
TO
subs, rsbmi

For abs, we will use cmp instead of movs. This is necessary because we already
have an existing peephole pass which optimizes away cmp following sub.

rdar: 11633193

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

12 years ago*fixed to separate mnemonic from operands with tab
Kay Tiong Khoo [Fri, 15 Jun 2012 21:04:21 +0000 (21:04 +0000)]
*fixed to separate mnemonic from operands with tab

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

12 years agoLSR: fix expansion of scaled reg in non-address type formulae.
Andrew Trick [Fri, 15 Jun 2012 20:07:29 +0000 (20:07 +0000)]
LSR: fix expansion of scaled reg in non-address type formulae.

For non-address users, Base and Scaled registers are not specially
associated to fit an address mode, so SCEVExpander should apply normal
expansion rules. Otherwise we may sink computation into inner loops
that have already been optimized.

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

12 years agoLSR fix: "Special" users are just like "Basic" users but allow -1 scale.
Andrew Trick [Fri, 15 Jun 2012 20:07:26 +0000 (20:07 +0000)]
LSR fix: "Special" users are just like "Basic" users but allow -1 scale.

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

12 years agoRemove assignments which aren't used afterwards.
Bill Wendling [Fri, 15 Jun 2012 19:30:42 +0000 (19:30 +0000)]
Remove assignments which aren't used afterwards.

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

12 years agoRemove assignments which aren't used afterwards.
Bill Wendling [Fri, 15 Jun 2012 19:28:20 +0000 (19:28 +0000)]
Remove assignments which aren't used afterwards.

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

12 years agoAllow SROA to split up an array of vectors into multiple vectors, even when the vecto...
Pete Cooper [Fri, 15 Jun 2012 18:07:29 +0000 (18:07 +0000)]
Allow SROA to split up an array of vectors into multiple vectors, even when the vectors are dynamically indexed

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

12 years agoSome optimizations done by globalopt are safe only for internal linkage, not
Rafael Espindola [Fri, 15 Jun 2012 18:00:24 +0000 (18:00 +0000)]
Some optimizations done by globalopt are safe only for internal linkage, not
linkonce linkage. For example, it is not valid to add unnamed_addr.

This also fixes a crash in g++.dg/opt/static5.C.

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

12 years agoPreserve <undef> flags in ARMExpandPseudo.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 17:46:54 +0000 (17:46 +0000)]
Preserve <undef> flags in ARMExpandPseudo.

This probably mostly shows up in bugpoint-generated code.

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

12 years agoUse regunit liveness in RegisterCoalescer when it is available.
Jakob Stoklund Olesen [Fri, 15 Jun 2012 17:36:48 +0000 (17:36 +0000)]
Use regunit liveness in RegisterCoalescer when it is available.

We only do very limited physreg coalescing now, but we still merge
virtual registers into reserved registers.

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

12 years agoFactor macro argument parsing into helper methods and add support for .irp.
Rafael Espindola [Fri, 15 Jun 2012 14:02:34 +0000 (14:02 +0000)]
Factor macro argument parsing into helper methods and add support for .irp.
Patch extracted from a larger one by the PaX team. I added the testcases
and tightened error handling a bit.

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

12 years agoFree the allocated filename. Found by clang static analyzer.
Bill Wendling [Fri, 15 Jun 2012 09:11:47 +0000 (09:11 +0000)]
Free the allocated filename. Found by clang static analyzer.

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

12 years agoFix issues (infinite loop and/or crash) with self-referential instructions, for
Duncan Sands [Fri, 15 Jun 2012 08:37:50 +0000 (08:37 +0000)]
Fix issues (infinite loop and/or crash) with self-referential instructions, for
example degenerate phi nodes and binops that use themselves in unreachable code.
Thanks to Charles Davis for the testcase that uncovered this can of worms.

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

12 years agoMove AVX version of convert instructions that write to GPRs to the Op1 table.
Craig Topper [Fri, 15 Jun 2012 07:02:58 +0000 (07:02 +0000)]
Move AVX version of convert instructions that write to GPRs to the Op1 table.

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

12 years agoHad a closing brace inside an #ifdef -- oops!
Marshall Clow [Fri, 15 Jun 2012 01:15:47 +0000 (01:15 +0000)]
Had a closing brace inside an #ifdef -- oops!

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

12 years agoAdding acessors to COFFObjectFile so that clients can get at the (non-generic) bits
Marshall Clow [Fri, 15 Jun 2012 01:08:25 +0000 (01:08 +0000)]
Adding acessors to COFFObjectFile so that clients can get at the (non-generic) bits

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

12 years agoRecommit r158407: Allow SROA to look at a vector type and see if the offset is out...
Pete Cooper [Thu, 14 Jun 2012 23:53:53 +0000 (23:53 +0000)]
Recommit r158407: Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access.  Now with additional fix and test for indexing into a vector inside a struct

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

12 years agoImplement the isSafeToDiscardIfUnused predicate and use it in globalopt and
Rafael Espindola [Thu, 14 Jun 2012 22:48:13 +0000 (22:48 +0000)]
Implement the isSafeToDiscardIfUnused predicate and use it in globalopt and
globaldce. Globaldce was already removing linkonce globals, but globalopt was
not.

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

12 years agoMove X86::VCVTTSD2SIrr from the 2 operand to 1 operand MemRegOp table.
Pete Cooper [Thu, 14 Jun 2012 22:12:58 +0000 (22:12 +0000)]
Move X86::VCVTTSD2SIrr from the 2 operand to 1 operand MemRegOp table.

Can someone with more knowledge of this please look at other entries
to see if others need moved.

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

12 years agoFix coding style violations. Remove white spaces and tabs.
Akira Hatanaka [Thu, 14 Jun 2012 21:10:56 +0000 (21:10 +0000)]
Fix coding style violations. Remove white spaces and tabs.

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

12 years ago1. introduce MipsPat in place of Pat in order to exclude those from
Akira Hatanaka [Thu, 14 Jun 2012 21:03:23 +0000 (21:03 +0000)]
1. introduce MipsPat in place of Pat in order to exclude those from
being used by Mips16 or Micro Mips
2. clean up a few lines too long encountered

Patch by Reed Kotler.

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

12 years agoMake machine verifier check the first instruction of the last bundle instead of
Akira Hatanaka [Thu, 14 Jun 2012 20:51:13 +0000 (20:51 +0000)]
Make machine verifier check the first instruction of the last bundle instead of
the last instruction of a basic block.

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

12 years agoMake comment slightly more helpful.
Lang Hames [Thu, 14 Jun 2012 20:37:15 +0000 (20:37 +0000)]
Make comment slightly more helpful.

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

12 years agoRevert r158454: Allow SROA to look at a vector type... Its breaking the vectorise...
Pete Cooper [Thu, 14 Jun 2012 18:32:52 +0000 (18:32 +0000)]
Revert r158454: Allow SROA to look at a vector type...  Its breaking the vectorise buildbot

This reverts commit 12c1f86ffa731e2952c80d2cc577000c96b8962c.

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

12 years agomisched: disable SSA check pending PR13112.
Andrew Trick [Thu, 14 Jun 2012 17:48:49 +0000 (17:48 +0000)]
misched: disable SSA check pending PR13112.

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

12 years agoSmallMap, FlatArrayMap::copyFrom
Stepan Dyatkovskiy [Thu, 14 Jun 2012 16:59:43 +0000 (16:59 +0000)]
SmallMap, FlatArrayMap::copyFrom
Replaced memcpy with std::copy, since the first one may work improperly with non POD data.

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

12 years agoRemove/modify C backend references from LLVM documentation.
David Blaikie [Thu, 14 Jun 2012 16:52:55 +0000 (16:52 +0000)]
Remove/modify C backend references from LLVM documentation.

Patch by Wei-Ren Chen.

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

12 years agoRemove C backend reference from the FAQ.
David Blaikie [Thu, 14 Jun 2012 16:43:11 +0000 (16:43 +0000)]
Remove C backend reference from the FAQ.

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

12 years agoRecommit r158407: Allow SROA to look at a vector type and see if the offset is out...
Pete Cooper [Thu, 14 Jun 2012 16:38:13 +0000 (16:38 +0000)]
Recommit r158407: Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access.  Now with additional fix and test for indexing into a vector inside a struct

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

12 years agoClarify a bit that the types have to be the same. Came up on IRC.
Duncan Sands [Thu, 14 Jun 2012 14:58:28 +0000 (14:58 +0000)]
Clarify a bit that the types have to be the same.  Came up on IRC.

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

12 years agoMipsLongBranch.cpp: Tweak llvm::next() to appease msvc.
NAKAMURA Takumi [Thu, 14 Jun 2012 12:29:48 +0000 (12:29 +0000)]
MipsLongBranch.cpp: Tweak llvm::next() to appease msvc.

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

12 years agoReplace assertion failure for badly formatted CPS instrution with error message.
Richard Barton [Thu, 14 Jun 2012 10:48:04 +0000 (10:48 +0000)]
Replace assertion failure for badly formatted CPS instrution with error message.

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

12 years agoCleanup whitespace.
Jush Lu [Thu, 14 Jun 2012 06:08:19 +0000 (06:08 +0000)]
Cleanup whitespace.

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

12 years agoRevert: test/CodeGen/ARM/iabs.ll in r158441
Manman Ren [Thu, 14 Jun 2012 06:04:02 +0000 (06:04 +0000)]
Revert: test/CodeGen/ARM/iabs.ll in r158441

Sorry that I accidently checked in this file with my previous commit.

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