oota-llvm.git
12 years agoTidy up a loop to be more idiomatic for LLVM's codebase, and remove some
Chandler Carruth [Sun, 23 Oct 2011 22:40:13 +0000 (22:40 +0000)]
Tidy up a loop to be more idiomatic for LLVM's codebase, and remove some
extraneous whitespace. Trying to clean-up this pass as much as I can
before I start making functional changes.

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

12 years agoAdd X86 SARX, SHRX, and SHLX instructions.
Craig Topper [Sun, 23 Oct 2011 22:18:24 +0000 (22:18 +0000)]
Add X86 SARX, SHRX, and SHLX instructions.

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

12 years agoTeach the BranchProbabilityInfo pass to print its results, and use that
Chandler Carruth [Sun, 23 Oct 2011 21:21:50 +0000 (21:21 +0000)]
Teach the BranchProbabilityInfo pass to print its results, and use that
to bring it under direct test instead of merely indirectly testing it in
the BlockFrequencyInfo pass.

The next step is to start adding tests for the various heuristics
employed, and to start fixing those heuristics once they're under test.

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

12 years agoRename the script to indicate that this is for the TEST=simple tests.
Bill Wendling [Sun, 23 Oct 2011 20:14:06 +0000 (20:14 +0000)]
Rename the script to indicate that this is for the TEST=simple tests.

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

12 years agoResurrect the 'find regressions for the TEST=nightly tests' script.
Bill Wendling [Sun, 23 Oct 2011 20:13:14 +0000 (20:13 +0000)]
Resurrect the 'find regressions for the TEST=nightly tests' script.

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

12 years agoNow that we have comparison on probabilities, add some static functions
Chandler Carruth [Sun, 23 Oct 2011 20:10:34 +0000 (20:10 +0000)]
Now that we have comparison on probabilities, add some static functions
to get important constant branch probabilities and use them for finding
the best branch out of a set of possibilities.

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

12 years agoRemove a commented out line of code that snuck by my auditing.
Chandler Carruth [Sun, 23 Oct 2011 20:10:30 +0000 (20:10 +0000)]
Remove a commented out line of code that snuck by my auditing.

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

12 years agoPrint branch probabilities as percentages.
Benjamin Kramer [Sun, 23 Oct 2011 11:32:54 +0000 (11:32 +0000)]
Print branch probabilities as percentages.

50% is much more readable than 5.000000e-01.

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

12 years agoAdd compare operators to BranchProbability and use it to determine if an edge is...
Benjamin Kramer [Sun, 23 Oct 2011 11:19:14 +0000 (11:19 +0000)]
Add compare operators to BranchProbability and use it to determine if an edge is hot.

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

12 years agoCompletely re-write the algorithm behind MachineBlockPlacement based on
Chandler Carruth [Sun, 23 Oct 2011 09:18:45 +0000 (09:18 +0000)]
Completely re-write the algorithm behind MachineBlockPlacement based on
discussions with Andy. Fundamentally, the previous algorithm is both
counter productive on several fronts and prioritizing things which
aren't necessarily the most important: static branch prediction.

The new algorithm uses the existing loop CFG structure information to
walk through the CFG itself to layout blocks. It coalesces adjacent
blocks within the loop where the CFG allows based on the most likely
path taken. Finally, it topologically orders the block chains that have
been formed. This allows it to choose a (mostly) topologically valid
ordering which still priorizes fallthrough within the structural
constraints.

As a final twist in the algorithm, it does violate the CFG when it
discovers a "hot" edge, that is an edge that is more than 4x hotter than
the competing edges in the CFG. These are forcibly merged into
a fallthrough chain.

Future transformations that need te be added are rotation of loop exit
conditions to be fallthrough, and better isolation of cold block chains.
I'm also planning on adding statistics to model how well the algorithm
does at laying out blocks based on the probabilities it receives.

The old tests mostly still pass, and I have some new tests to add, but
the nested loops are still behaving very strangely. This almost seems
like working-as-intended as it rotated the exit branch to be
fallthrough, but I'm not convinced this is actually the best layout. It
is well supported by the probabilities for loops we currently get, but
those are pretty broken for nested loops, so this may change later.

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

12 years agoAdd X86 RORX instruction
Craig Topper [Sun, 23 Oct 2011 07:34:00 +0000 (07:34 +0000)]
Add X86 RORX instruction

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

12 years agoThe element insertion code in scalar replacement doesn't handle incorrect
Cameron Zwarich [Sun, 23 Oct 2011 07:02:10 +0000 (07:02 +0000)]
The element insertion code in scalar replacement doesn't handle incorrect
element types, even though the element extraction code does. It is surprising
that this bug has been here for so long. Fixes <rdar://problem/10318778>.

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

12 years agoAdd X86 MULX instruction for disassembler.
Craig Topper [Sun, 23 Oct 2011 00:33:32 +0000 (00:33 +0000)]
Add X86 MULX instruction for disassembler.

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

12 years agoRemove some duplicate specifying of neverHasSideEffects and mayLoad from X86 multiply...
Craig Topper [Sat, 22 Oct 2011 23:13:53 +0000 (23:13 +0000)]
Remove some duplicate specifying of neverHasSideEffects and mayLoad from X86 multiply instructions.

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

12 years agoOops! Fix test I forgot to submit as part of r142735.
Nick Lewycky [Sat, 22 Oct 2011 22:07:31 +0000 (22:07 +0000)]
Oops! Fix test I forgot to submit as part of r142735.

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

12 years agoA non-escaping malloc in the entry block is not unlike an alloca. Do dead-store
Nick Lewycky [Sat, 22 Oct 2011 21:59:35 +0000 (21:59 +0000)]
A non-escaping malloc in the entry block is not unlike an alloca. Do dead-store
elimination on them too.

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

12 years agoMake SCEV's brute force analysis stronger in two ways. Firstly, we should be
Nick Lewycky [Sat, 22 Oct 2011 19:58:20 +0000 (19:58 +0000)]
Make SCEV's brute force analysis stronger in two ways. Firstly, we should be
able to constant fold load instructions where the argument is a constant.
Second, we should be able to watch multiple PHI nodes through the loop; this
patch only supports PHIs in loop headers, more can be done here.

With this patch, we now constant evaluate:
  static const int arr[] = {1, 2, 3, 4, 5};
  int test() {
    int sum = 0;
    for (int i = 0; i < 5; ++i) sum += arr[i];
    return sum;
  }

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

12 years agoFix a typo.w
Nadav Rotem [Sat, 22 Oct 2011 18:44:51 +0000 (18:44 +0000)]
Fix a typo.w

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

12 years agoMinor updates.
Jim Grosbach [Sat, 22 Oct 2011 18:17:32 +0000 (18:17 +0000)]
Minor updates.

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

12 years agoAdded my name to CREDITS.TXT
Nadav Rotem [Sat, 22 Oct 2011 17:51:04 +0000 (17:51 +0000)]
Added my name to CREDITS.TXT

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

12 years agoMove various generated tables into read-only memory, fixing up const correctness...
Benjamin Kramer [Sat, 22 Oct 2011 16:50:00 +0000 (16:50 +0000)]
Move various generated tables into read-only memory, fixing up const correctness along the way.

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

12 years agoFix pr11193.
Nadav Rotem [Sat, 22 Oct 2011 12:39:25 +0000 (12:39 +0000)]
Fix pr11193.
SHL inserts zeros from the right, thus even when the original
sign_extend_inreg value was of 1-bit, we need to sra.

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

12 years agoThe different flavors of ARM have different valid subsets of registers. Check
Bill Wendling [Sat, 22 Oct 2011 00:29:28 +0000 (00:29 +0000)]
The different flavors of ARM have different valid subsets of registers. Check
that the set of callee-saved registers is correct for the specific platform.
<rdar://problem/10313708> & ctor_dtor_count & ctor_dtor_count-2

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

12 years agoAssembly parsing for 4-register sequential variant of VLD2.
Jim Grosbach [Fri, 21 Oct 2011 23:58:57 +0000 (23:58 +0000)]
Assembly parsing for 4-register sequential variant of VLD2.

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

12 years agoAssembly parsing for 2-register sequential variant of VLD2.
Jim Grosbach [Fri, 21 Oct 2011 22:21:10 +0000 (22:21 +0000)]
Assembly parsing for 2-register sequential variant of VLD2.

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

12 years agoMake sure that the landing pads themselves have no PHI instructions in them.
Bill Wendling [Fri, 21 Oct 2011 22:08:56 +0000 (22:08 +0000)]
Make sure that the landing pads themselves have no PHI instructions in them.

The assumption in the back-end is that PHIs are not allowed at the start of the
landing pad block for SjLj exceptions.
<rdar://problem/10313708>

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

12 years agoExtend the floating point heuristic to consider NaN checks unlikely.
Benjamin Kramer [Fri, 21 Oct 2011 21:13:47 +0000 (21:13 +0000)]
Extend the floating point heuristic to consider NaN checks unlikely.

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

12 years agoRevert r141657 for now. This has broken css and changed links on llvm.org. I'd like...
Tanya Lattner [Fri, 21 Oct 2011 20:51:54 +0000 (20:51 +0000)]
Revert r141657 for now. This has broken css and changed links on llvm.org. I'd like to understand exactly why the links have changed and if a newer doxygen is required. This may be reapplied once we upgrade on llvm.org and it is fully tested.

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

12 years agoRemap blockaddress correctly when inlining a function. Fixes PR10162.
Eli Friedman [Fri, 21 Oct 2011 20:45:19 +0000 (20:45 +0000)]
Remap blockaddress correctly when inlining a function. Fixes PR10162.

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

12 years agoUse LLVMBool for a function that logically returns a boolean value.
Owen Anderson [Fri, 21 Oct 2011 20:35:58 +0000 (20:35 +0000)]
Use LLVMBool for a function that logically returns a boolean value.

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

12 years agoAssembly parsing for 4-register variant of VLD1.
Jim Grosbach [Fri, 21 Oct 2011 20:35:01 +0000 (20:35 +0000)]
Assembly parsing for 4-register variant of VLD1.

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

12 years agoFix typo.
Owen Anderson [Fri, 21 Oct 2011 20:28:19 +0000 (20:28 +0000)]
Fix typo.

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

12 years agoBranchProbabilityInfo: floating point equality is unlikely.
Benjamin Kramer [Fri, 21 Oct 2011 20:12:47 +0000 (20:12 +0000)]
BranchProbabilityInfo: floating point equality is unlikely.

This is from the same paper from Ball and Larus as the rest of the currently implemented heuristics.

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

12 years agoAssembly parsing for 3-register variant of VLD1.
Jim Grosbach [Fri, 21 Oct 2011 20:02:19 +0000 (20:02 +0000)]
Assembly parsing for 3-register variant of VLD1.

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

12 years agoSTABS symbols are debug symbols.
Owen Anderson [Fri, 21 Oct 2011 19:26:54 +0000 (19:26 +0000)]
STABS symbols are debug symbols.

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

12 years agoMinor simplification: use ShuffleVectorInst::getMaskValue instead of a more expensive...
Eli Friedman [Fri, 21 Oct 2011 19:11:34 +0000 (19:11 +0000)]
Minor simplification: use ShuffleVectorInst::getMaskValue instead of a more expensive helper.

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

12 years agoExtend instcombine's shufflevector simplification to handle more cases where the...
Eli Friedman [Fri, 21 Oct 2011 19:06:29 +0000 (19:06 +0000)]
Extend instcombine's shufflevector simplification to handle more cases where the input and output vectors have different sizes.  Patch by Xiaoyi Guo.

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

12 years agoARM VLD parsing and encoding.
Jim Grosbach [Fri, 21 Oct 2011 18:54:25 +0000 (18:54 +0000)]
ARM VLD parsing and encoding.

Next step in the ongoing saga of NEON load/store assmebly parsing. Handle
VLD1 instructions that take a two-register register list.

Adjust the instruction definitions to only have the single encoded register
as an operand. The super-register from the pseudo is kept as an implicit def,
so passes which come after pseudo-expansion still know that the instruction
defines the other subregs.

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

12 years agoDon't automatically set the "fc" bits on MSR instructions if the user didn't ask...
Owen Anderson [Fri, 21 Oct 2011 18:43:28 +0000 (18:43 +0000)]
Don't automatically set the "fc" bits on MSR instructions if the user didn't ask for them.  This is a divergence from gas' behavior, but it is correct per the documentation and allows us to forge ahead with roundtrip testing.

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

12 years agoBind libObject API for obtaining the section containing a Symbol.
Owen Anderson [Fri, 21 Oct 2011 18:21:22 +0000 (18:21 +0000)]
Bind libObject API for obtaining the section containing a Symbol.

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

12 years agoExpand the coverage of the libObject C bindings to include more SectionRef accessors...
Owen Anderson [Fri, 21 Oct 2011 17:50:59 +0000 (17:50 +0000)]
Expand the coverage of the libObject C bindings to include more SectionRef accessors as well as Symbol iterators.

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

12 years agoFix pr11194. When promoting and splitting integers we need to use
Nadav Rotem [Fri, 21 Oct 2011 17:35:19 +0000 (17:35 +0000)]
Fix pr11194. When promoting and splitting integers we need to use
ZExtPromotedInteger and SExtPromotedInteger based on the operation we legalize.

SetCC return type needs to be legalized via PromoteTargetBoolean.

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

12 years agoNuke an #if0 that got accidentally left in.
Jim Grosbach [Fri, 21 Oct 2011 16:59:08 +0000 (16:59 +0000)]
Nuke an #if0 that got accidentally left in.

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

12 years agowhitespace.
Jim Grosbach [Fri, 21 Oct 2011 16:56:40 +0000 (16:56 +0000)]
whitespace.

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

12 years agoDon't hard code the desired alignment for loops -- it isn't 16-bytes on
Chandler Carruth [Fri, 21 Oct 2011 16:41:39 +0000 (16:41 +0000)]
Don't hard code the desired alignment for loops -- it isn't 16-bytes on
all x86 systems. Sorry for the breakage.

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

12 years agoRemove some outdated comments.
Jim Grosbach [Fri, 21 Oct 2011 16:14:12 +0000 (16:14 +0000)]
Remove some outdated comments.

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

12 years ago1. Fix the widening of SETCC in WidenVecOp_SETCC. Use the correct return CC type.
Nadav Rotem [Fri, 21 Oct 2011 11:42:07 +0000 (11:42 +0000)]
1. Fix the widening of SETCC in WidenVecOp_SETCC. Use the correct return CC type.
2. Fix a typo in CONCAT_VECTORS which exposed the bug in #1.

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

12 years agoEnsure timestamps are not embedded into files when doing a release build.
Duncan Sands [Fri, 21 Oct 2011 09:47:14 +0000 (09:47 +0000)]
Ensure timestamps are not embedded into files when doing a release build.

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

12 years agoFix build on mingw-w64.
Anton Korobeynikov [Fri, 21 Oct 2011 09:38:50 +0000 (09:38 +0000)]
Fix build on mingw-w64.
Patch by Ruben Van Boxem!

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

12 years agoAdd loop aligning to MachineBlockPlacement based on review discussion so
Chandler Carruth [Fri, 21 Oct 2011 08:57:37 +0000 (08:57 +0000)]
Add loop aligning to MachineBlockPlacement based on review discussion so
it's a bit more plausible to use this instead of CodePlacementOpt. The
code for this was shamelessly stolen from CodePlacementOpt, and then
trimmed down a bit. There doesn't seem to be much utility in returning
true/false from this pass as we may or may not have rewritten all of the
blocks. Also, the statistic of counting how many loops were aligned
doesn't seem terribly important so I removed it. If folks would like it
to be included, I'm happy to add it back.

This was probably the most egregious of the missing features, and now
I'm going to start gathering some performance numbers and looking at
specific loop structures that have different layout between the two.

Test is updated to include both basic loop alignment and nested loop
alignment.

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

12 years agoAdd a very basic test for MachineBlockPlacement. This is essentially the
Chandler Carruth [Fri, 21 Oct 2011 08:01:56 +0000 (08:01 +0000)]
Add a very basic test for MachineBlockPlacement. This is essentially the
canonical example I used when developing it, and is one of the primary
motivating real-world use cases for __builtin_expect (when burried under
a macro).

I'm working on more test cases here, but I'm trying to make sure both
that the pass is doing the right thing with the test cases and that they
aren't too brittle to changes elsewhere in the code generation pipeline.

Feedback and/or suggestions on how to test this are very welcome.
Especially feedback on whether testing the block comments is a good
strategy; I couldn't find any good examples to steal from but all the
other ideas I had were a lot uglier or more fragile.

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

12 years agoModify the script to output the regressions and passes into categories. My Python...
Bill Wendling [Fri, 21 Oct 2011 06:58:01 +0000 (06:58 +0000)]
Modify the script to output the regressions and passes into categories. My Python-fu could use some improving...

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

12 years agoRemove intrinsics for X86 BLSI, BLSMSK, and BLSR intrinsics and replace with custom...
Craig Topper [Fri, 21 Oct 2011 06:55:01 +0000 (06:55 +0000)]
Remove intrinsics for X86 BLSI, BLSMSK, and BLSR intrinsics and replace with custom isel lowering code.

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

12 years agoImplement a block placement pass based on the branch probability and
Chandler Carruth [Fri, 21 Oct 2011 06:46:38 +0000 (06:46 +0000)]
Implement a block placement pass based on the branch probability and
block frequency analyses. This differs substantially from the existing
block-placement pass in LLVM:

1) It operates on the Machine-IR in the CodeGen layer. This exposes much
   more (and more precise) information and opportunities. Also, the
   results are more stable due to fewer transforms ocurring after the
   pass runs.
2) It uses the generalized probability and frequency analyses. These can
   model static heuristics, code annotation derived heuristics as well
   as eventual profile loading. By basing the optimization on the
   analysis interface it can work from any (or a combination) of these
   inputs.
3) It uses a more aggressive algorithm, both building chains from tho
   bottom up to maximize benefit, and using an SCC-based walk to layout
   chains of blocks in a profitable ordering without O(N^2) iterations
   which the old pass involves.

The pass is currently gated behind a flag, and not enabled by default
because it still needs to grow some important features. Most notably, it
needs to support loop aligning and careful layout of loop structures
much as done by hand currently in CodePlacementOpt. Once it supports
these, and has sufficient testing and quality tuning, it should replace
both of these passes.

Thanks to Nick Lewycky and Richard Smith for help authoring & debugging
this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm
forgetting for reviewing and answering all my questions. Writing
a backend pass is *sooo* much better now than it used to be. =D

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

12 years agoCheck for divide by zero.
Bill Wendling [Fri, 21 Oct 2011 06:26:01 +0000 (06:26 +0000)]
Check for divide by zero.

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

12 years agoRemove a now dead function, fixing -Wunused-function warnings from
Chandler Carruth [Fri, 21 Oct 2011 01:23:41 +0000 (01:23 +0000)]
Remove a now dead function, fixing -Wunused-function warnings from
Clang.

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

12 years agoFix unused variable warning.
Richard Smith [Fri, 21 Oct 2011 01:22:04 +0000 (01:22 +0000)]
Fix unused variable warning.

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

12 years agoRevert r142618, r142622, and r142624, which were based on an incorrect reading of...
Owen Anderson [Thu, 20 Oct 2011 22:23:58 +0000 (22:23 +0000)]
Revert r142618, r142622, and r142624, which were based on an incorrect reading of the ARMv7 docs.

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

12 years agoFix decoding tests for fixed MSR encodings.
Owen Anderson [Thu, 20 Oct 2011 22:01:48 +0000 (22:01 +0000)]
Fix decoding tests for fixed MSR encodings.

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

12 years agoRemove unused include of sys/uio.h in MemoryBuffer.cpp. It was not correctly protecte...
David Meyer [Thu, 20 Oct 2011 21:57:46 +0000 (21:57 +0000)]
Remove unused include of sys/uio.h in MemoryBuffer.cpp. It was not correctly protected by ifdef either.

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

12 years agoFix tests for corrected MSR encodings.
Owen Anderson [Thu, 20 Oct 2011 21:53:19 +0000 (21:53 +0000)]
Fix tests for corrected MSR encodings.

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

12 years agoDisable the PPC hazard recognizer. It currently only supports
Dan Gohman [Thu, 20 Oct 2011 21:45:36 +0000 (21:45 +0000)]
Disable the PPC hazard recognizer. It currently only supports
top-down scheduling and top-down scheduling is going away.

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

12 years agoDelete the list-tdrr scheduler. Top-down schedulers are going away
Dan Gohman [Thu, 20 Oct 2011 21:44:34 +0000 (21:44 +0000)]
Delete the list-tdrr scheduler. Top-down schedulers are going away
because they don't support physical register dependencies.

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

12 years agoSeparate out ARM MSR instructions into M-class versions and AR-class versions. This...
Owen Anderson [Thu, 20 Oct 2011 21:24:38 +0000 (21:24 +0000)]
Separate out ARM MSR instructions into M-class versions and AR-class versions.  This fixes some roundtripping failures.

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

12 years agoAdd missing operand. <rdar://problem/10313323>
Bill Wendling [Thu, 20 Oct 2011 20:37:11 +0000 (20:37 +0000)]
Add missing operand. <rdar://problem/10313323>

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

12 years agoAlso compare the built dragonegg objects between phases 2 and 3.
Duncan Sands [Thu, 20 Oct 2011 20:14:18 +0000 (20:14 +0000)]
Also compare the built dragonegg objects between phases 2 and 3.

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

12 years agoReset the system compiler each time we start a new flavour. Otherwise
Duncan Sands [Thu, 20 Oct 2011 20:10:58 +0000 (20:10 +0000)]
Reset the system compiler each time we start a new flavour.  Otherwise
the last compiler built for the previous flavour is used for the next,
for example the Debug clang compiler was being used for the initial build
of the Release LLVM.  Flavors should be independent of each other.  This
especially matters if the compiler built for the previous flavour doesn't
actually work!

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

12 years agoHaven't yet found a nice way to handle TargetData verification in the
Lang Hames [Thu, 20 Oct 2011 19:24:44 +0000 (19:24 +0000)]
Haven't yet found a nice way to handle TargetData verification in the
AsmParser. This patch adds validation for target data layout strings upon
construction of TargetData objects. An attempt to construct a TargetData object
from a malformed string will trigger an assertion.

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

12 years agoRevert r142579, "Fix a type in the legalization of CONCAT_VECTORS". This is
Chad Rosier [Thu, 20 Oct 2011 19:19:10 +0000 (19:19 +0000)]
Revert r142579, "Fix a type in the legalization of CONCAT_VECTORS". This is
causing one of the unit tests to infinitely loop, which resulted in the
buildbots stalling.

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

12 years agoAs Evan suggested, loads from constant pool are safe to speculate.
Devang Patel [Thu, 20 Oct 2011 17:42:23 +0000 (17:42 +0000)]
As Evan suggested, loads from constant pool are safe to speculate.

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

12 years agoAdd a comment.
Devang Patel [Thu, 20 Oct 2011 17:31:18 +0000 (17:31 +0000)]
Add a comment.

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

12 years agoTidy up. Trailing whitespace.
Jim Grosbach [Thu, 20 Oct 2011 17:28:20 +0000 (17:28 +0000)]
Tidy up. Trailing whitespace.

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

12 years agoARM VLD1/VST1 (one register, no writeback) assembly parsing and encoding.
Jim Grosbach [Thu, 20 Oct 2011 15:04:25 +0000 (15:04 +0000)]
ARM VLD1/VST1 (one register, no writeback) assembly parsing and encoding.

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

12 years agoTidy up formatting.
Jim Grosbach [Thu, 20 Oct 2011 14:57:47 +0000 (14:57 +0000)]
Tidy up formatting.

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

12 years agoARM VTBX (one register) assembly parsing and encoding.
Jim Grosbach [Thu, 20 Oct 2011 14:48:50 +0000 (14:48 +0000)]
ARM VTBX (one register) assembly parsing and encoding.

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

12 years agoFix a type in the legalization of CONCAT_VECTORS.
Nadav Rotem [Thu, 20 Oct 2011 13:38:16 +0000 (13:38 +0000)]
Fix a type in the legalization of CONCAT_VECTORS.

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

12 years agoAdd support for testing dragonegg. This is disabled by default.
Duncan Sands [Thu, 20 Oct 2011 11:13:04 +0000 (11:13 +0000)]
Add support for testing dragonegg.  This is disabled by default.
In fact this commit is not intended to change anything unless you
use one of the new command line flags.

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

12 years agoComment out or remove unused parameter names so as to avoid a slew of
Duncan Sands [Thu, 20 Oct 2011 08:57:54 +0000 (08:57 +0000)]
Comment out or remove unused parameter names so as to avoid a slew of
compiler warnings.

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

12 years agoAvoid warnings about the parameter G being unused.
Duncan Sands [Thu, 20 Oct 2011 08:56:41 +0000 (08:56 +0000)]
Avoid warnings about the parameter G being unused.

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

12 years agoRefactor code from inlining and globalopt that checks whether a function definition...
Eli Friedman [Thu, 20 Oct 2011 05:23:42 +0000 (05:23 +0000)]
Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead.  This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress.  (GlobalDCE can also handle the given tescase, but we only run that at -O3.)  Found while looking at PR11180.

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

12 years agoRemove useless code.
Eli Friedman [Thu, 20 Oct 2011 04:33:44 +0000 (04:33 +0000)]
Remove useless code.

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

12 years agoA FIXME about block addresses and indirectbr.
Eli Friedman [Thu, 20 Oct 2011 04:05:33 +0000 (04:05 +0000)]
A FIXME about block addresses and indirectbr.

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

12 years agoSimplify; no intended functional change.
Eli Friedman [Thu, 20 Oct 2011 03:23:14 +0000 (03:23 +0000)]
Simplify; no intended functional change.

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

12 years agoRevamp the script to handle the 'TEST=simple' output.
Bill Wendling [Thu, 20 Oct 2011 00:45:46 +0000 (00:45 +0000)]
Revamp the script to handle the 'TEST=simple' output.

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

12 years ago"@string = constant i8 0" is a value i8* string of length zero. Analyze that
Nick Lewycky [Thu, 20 Oct 2011 00:34:35 +0000 (00:34 +0000)]
"@string = constant i8 0" is a value i8* string of length zero. Analyze that
correctly in GetStringLength, fixing PR11181!

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

12 years agoRevert 142337. Thumb1 still doesn't support dynamic stack realignment. :(
Chad Rosier [Thu, 20 Oct 2011 00:07:12 +0000 (00:07 +0000)]
Revert 142337.  Thumb1 still doesn't support dynamic stack realignment. :(

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

12 years agoInitialze ScalarEvalution dependency.
Devang Patel [Wed, 19 Oct 2011 23:56:07 +0000 (23:56 +0000)]
Initialze ScalarEvalution dependency.
Patch by Pranav Bhandarkar!

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

12 years agoFix TLS lowering bug. The CopyFromReg must be glued to the TLSCALL. rdar://10291355
Evan Cheng [Wed, 19 Oct 2011 22:22:54 +0000 (22:22 +0000)]
Fix TLS lowering bug. The CopyFromReg must be glued to the TLSCALL. rdar://10291355

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

12 years agoImprove code generation for vselect on SSE2:
Nadav Rotem [Wed, 19 Oct 2011 20:43:16 +0000 (20:43 +0000)]
Improve code generation for vselect on SSE2:
When checking the availability of instructions using the TLI, a 'promoted'
instruction IS available. It means that the value is bitcasted to another type
for which there is an operation. The correct check for the availablity of an
instruction is to check if it should be expanded.

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

12 years agoFix parsing of a line with only a # in it.
Rafael Espindola [Wed, 19 Oct 2011 18:48:52 +0000 (18:48 +0000)]
Fix parsing of a line with only a # in it.

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

12 years agoUpdating 'update' target to handle svn 1.7 'info' output. Patch by Jean-Danial Dupas!
David Blaikie [Wed, 19 Oct 2011 18:35:30 +0000 (18:35 +0000)]
Updating 'update' target to handle svn 1.7 'info' output. Patch by Jean-Danial Dupas!

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

12 years agoUse literal pool loads instead of MOVW/MOVT for materializing global addresses when...
James Molloy [Wed, 19 Oct 2011 14:11:07 +0000 (14:11 +0000)]
Use literal pool loads instead of MOVW/MOVT for materializing global addresses when optimizing for size.

On spec/gcc, this caused a codesize improvement of ~1.9% for ARM mode and ~4.9% for Thumb(2) mode. This is
codesize including literal pools.

The pools themselves doubled in size for ARM mode and quintupled for Thumb mode, leaving suggestion that there
is still perhaps redundancy in LLVM's use of constant pools that could be decreased by sharing entries.

Fixes PR11087.

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

12 years agoDocument Paste
David Greene [Wed, 19 Oct 2011 13:04:59 +0000 (13:04 +0000)]
Document Paste

Document paste as a shorthand for !strconcat.

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

12 years agoDocument NAME
David Greene [Wed, 19 Oct 2011 13:04:56 +0000 (13:04 +0000)]
Document NAME

Document NAME as a special member of def records that should
not be defined anywhere else.

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

12 years agoAdd Paste Test
David Greene [Wed, 19 Oct 2011 13:04:50 +0000 (13:04 +0000)]
Add Paste Test

This tests TableGen's paste functionality.

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

12 years agoImplement Paste
David Greene [Wed, 19 Oct 2011 13:04:43 +0000 (13:04 +0000)]
Implement Paste

Add a paste operator '#' to take two identifier-like strings and joint
them.  Internally paste gets represented as a !strconcat() with any
necessary casts to string added.

This will be used to implement basic for loop functionality as in:

for i = [0, 1, 2, 3, 4, 5, 6, 7] {
  def R#i : Register<...>
}

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

12 years agoProcess NAME
David Greene [Wed, 19 Oct 2011 13:04:35 +0000 (13:04 +0000)]
Process NAME

During multiclass def instantiation, replace NAME in any expressions
with the value of the def or defm ID.

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

12 years agoProcess Defm Prefix as Init
David Greene [Wed, 19 Oct 2011 13:04:31 +0000 (13:04 +0000)]
Process Defm Prefix as Init

Parse and process a defm prefix as an Init expression.  This allows
paste operations to create defm prefixes.

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

12 years agoParse Def ID as Value
David Greene [Wed, 19 Oct 2011 13:04:29 +0000 (13:04 +0000)]
Parse Def ID as Value

Allow def and defm IDs to be general values.  We need this for paste
functionality.

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

12 years agoDon't Parse Object Body as a Name
David Greene [Wed, 19 Oct 2011 13:04:26 +0000 (13:04 +0000)]
Don't Parse Object Body as a Name

Stop parsing a value if we are in name parsing mode and we see a left
brace.  A left brace indicates the start of an object body when we are
parsing a name.

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