oota-llvm.git
13 years agoFix the API usage in loop probability heuristics. It was incorrectly
Chandler Carruth [Tue, 25 Oct 2011 09:47:41 +0000 (09:47 +0000)]
Fix the API usage in loop probability heuristics. It was incorrectly
classifying many edges as exiting which were in fact not. These mainly
formed edges into sub-loops. It was also not correctly classifying all
returning edges out of loops as leaving the loop. With this match most
of the loop heuristics are more rational.

Several serious regressions on loop-intesive benchmarks like perlbench's
loop tests when built with -enable-block-placement are fixed by these
updated heuristics. Unfortunately they in turn uncover some other
regressions. There are still several improvemenst that should be made to
loop heuristics including trip-count, and early back-edge management.

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

13 years agoSpeculatively revert commits 142790 and 142843 to see if it fixes
Duncan Sands [Tue, 25 Oct 2011 09:26:43 +0000 (09:26 +0000)]
Speculatively revert commits 142790 and 142843 to see if it fixes
the dragonegg and llvm-gcc self-host buildbots.  Original commit
messages:
- Reapply r142781 with fix. Original message:

  Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
  loop header when computing the trip count.

  With this, we now constant evaluate:
    struct ListNode { const struct ListNode *next; int i; };
    static const struct ListNode node1 = {0, 1};
    static const struct ListNode node2 = {&node1, 2};
    static const struct ListNode node3 = {&node2, 3};
    int test() {
      int sum = 0;
      for (const struct ListNode *n = &node3; n != 0; n = n->next)
        sum += n->i;
      return sum;
    }

- Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!

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

13 years agoRemove dead enum value. There is no DIESectionOffset.
Nick Lewycky [Tue, 25 Oct 2011 07:05:26 +0000 (07:05 +0000)]
Remove dead enum value. There is no DIESectionOffset.

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

13 years agoFix these test cases to not use .bc files. Otherwise, we run into issues with
Chad Rosier [Tue, 25 Oct 2011 01:22:20 +0000 (01:22 +0000)]
Fix these test cases to not use .bc files.  Otherwise, we run into issues with
bitcode reader/writer backward compatibility.

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

13 years agoComment out external projects so that they can be refreshed for 3.0.
Bill Wendling [Tue, 25 Oct 2011 01:01:42 +0000 (01:01 +0000)]
Comment out external projects so that they can be refreshed for 3.0.

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

13 years agoRemove unused forward decl.
Eric Christopher [Tue, 25 Oct 2011 00:55:35 +0000 (00:55 +0000)]
Remove unused forward decl.

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

13 years agoAn MBB which branches to an EH landing pad shouldn't be considered for tail merging.
Bill Wendling [Tue, 25 Oct 2011 00:54:05 +0000 (00:54 +0000)]
An MBB which branches to an EH landing pad shouldn't be considered for tail merging.

In SjLj EH, the jump to the landing pad is not done explicitly through a branch
statement. The EH landing pad is added as a successor to the throwing
BB. Because of that however, the branch folding pass could mistakenly think that
it could merge the throwing BB with another BB. This isn't safe to do.
<rdar://problem/10334833>

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

13 years agoReally remove Blackfin from the configure script.
Dan Gohman [Tue, 25 Oct 2011 00:36:31 +0000 (00:36 +0000)]
Really remove Blackfin from the configure script.

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

13 years agoARM assembly parsing and encoding for VLD1 with writeback.
Jim Grosbach [Tue, 25 Oct 2011 00:14:01 +0000 (00:14 +0000)]
ARM assembly parsing and encoding for VLD1 with writeback.

Four entry register lists.

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

13 years agoRemove the Blackfin backend.
Dan Gohman [Tue, 25 Oct 2011 00:05:42 +0000 (00:05 +0000)]
Remove the Blackfin backend.

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

13 years agoRemove the SystemZ backend.
Dan Gohman [Mon, 24 Oct 2011 23:48:32 +0000 (23:48 +0000)]
Remove the SystemZ backend.

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

13 years agoNuke dead code. Nothing generates the VLD1d64QPseudo_UPD instruction.
Jim Grosbach [Mon, 24 Oct 2011 23:40:46 +0000 (23:40 +0000)]
Nuke dead code. Nothing generates the VLD1d64QPseudo_UPD instruction.

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

13 years agoARM assembly parsing and encoding for VLD1 w/ writeback.
Jim Grosbach [Mon, 24 Oct 2011 23:26:05 +0000 (23:26 +0000)]
ARM assembly parsing and encoding for VLD1 w/ writeback.

Three entry register list variation.

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

13 years agoMore fixes and improvements to MachO relocation pretty-printing, particular for x86...
Owen Anderson [Mon, 24 Oct 2011 23:20:07 +0000 (23:20 +0000)]
More fixes and improvements to MachO relocation pretty-printing, particular for x86 and x86_64 relocations with addends.

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

13 years agoDon't crash on variable insertelement on ARM. PR10258.
Eli Friedman [Mon, 24 Oct 2011 23:08:52 +0000 (23:08 +0000)]
Don't crash on variable insertelement on ARM.  PR10258.

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

13 years agoCheck the visibility of the global variable before placing it into the stubs
Bill Wendling [Mon, 24 Oct 2011 23:05:43 +0000 (23:05 +0000)]
Check the visibility of the global variable before placing it into the stubs
table. A hidden variable could potentially end up in both lists.
<rdar://problem/10336715>

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

13 years agoARMConstantPoolMBB::print should print BB number.
Evan Cheng [Mon, 24 Oct 2011 23:01:03 +0000 (23:01 +0000)]
ARMConstantPoolMBB::print should print BB number.

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

13 years agoARM assembly parsing and encoding for VLD1 w/ writeback.
Jim Grosbach [Mon, 24 Oct 2011 22:16:58 +0000 (22:16 +0000)]
ARM assembly parsing and encoding for VLD1 w/ writeback.

One and two length register list variants.

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

13 years agoAdd options to enable each individual level for the show-diagnostics tool.
Chad Rosier [Mon, 24 Oct 2011 21:56:50 +0000 (21:56 +0000)]
Add options to enable each individual level for the show-diagnostics tool.
rdar://9683410

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

13 years agoARM refactor am6offset usage for VLD1.
Jim Grosbach [Mon, 24 Oct 2011 21:45:13 +0000 (21:45 +0000)]
ARM refactor am6offset usage for VLD1.

Split am6offset into fixed and register offset variants so the instruction
encodings are explicit rather than relying an a magic reg0 marker.
Needed to being able to parse these.

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

13 years agoGet relocation parsing/dumping to a mostly-working state for MachO files.
Owen Anderson [Mon, 24 Oct 2011 21:44:00 +0000 (21:44 +0000)]
Get relocation parsing/dumping to a mostly-working state for MachO files.

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

13 years agoNow that we look at all the header PHIs, we need to consider all the header PHIs
Nick Lewycky [Mon, 24 Oct 2011 21:02:38 +0000 (21:02 +0000)]
Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!

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

13 years agoAdd support to the old JIT for acquire/release loads and stores on x86. PR11207.
Eli Friedman [Mon, 24 Oct 2011 20:24:21 +0000 (20:24 +0000)]
Add support to the old JIT for acquire/release loads and stores on x86.  PR11207.

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

13 years agoStub out some of the MachO relocation decoding hooks.
Owen Anderson [Mon, 24 Oct 2011 20:19:18 +0000 (20:19 +0000)]
Stub out some of the MachO relocation decoding hooks.

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

13 years agoReally unbreak CMake build
Douglas Gregor [Mon, 24 Oct 2011 18:10:52 +0000 (18:10 +0000)]
Really unbreak CMake build

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

13 years agoUnbreak CMake build
Douglas Gregor [Mon, 24 Oct 2011 18:09:23 +0000 (18:09 +0000)]
Unbreak CMake build

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

13 years agoFix a NEON disassembly case that was broken in the recent refactorings. As more...
Owen Anderson [Mon, 24 Oct 2011 18:04:29 +0000 (18:04 +0000)]
Fix a NEON disassembly case that was broken in the recent refactorings.  As more of this code gets refactored, a lot of these manual decoding hooks should get smaller and/or go away entirely.

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

13 years agoDelete the top-down "Latency" scheduler. Top-down scheduling doesn't handle
Dan Gohman [Mon, 24 Oct 2011 18:01:06 +0000 (18:01 +0000)]
Delete the top-down "Latency" scheduler. Top-down scheduling doesn't handle
physreg dependencies, and upcoming codegen changes will require proper
physreg dependence handling.

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

13 years agoDelete the Latency scheduling preference.
Dan Gohman [Mon, 24 Oct 2011 17:56:48 +0000 (17:56 +0000)]
Delete the Latency scheduling preference.

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

13 years agoChange this overloaded use of Sched::Latency to be an overloaded
Dan Gohman [Mon, 24 Oct 2011 17:55:11 +0000 (17:55 +0000)]
Change this overloaded use of Sched::Latency to be an overloaded
use of Sched::ILP instead, as Sched::Latency is going away.

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

13 years agoRemove the explicit request for "Latency" scheduling from MSP430,
Dan Gohman [Mon, 24 Oct 2011 17:53:16 +0000 (17:53 +0000)]
Remove the explicit request for "Latency" scheduling from MSP430,
as the Latency scheduler is going away.

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

13 years agoChange the default scheduler from Latency to ILP, since Latency
Dan Gohman [Mon, 24 Oct 2011 17:45:02 +0000 (17:45 +0000)]
Change the default scheduler from Latency to ILP, since Latency
is going away.

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

13 years agoUpdate test for r142801.
Jim Grosbach [Mon, 24 Oct 2011 17:26:26 +0000 (17:26 +0000)]
Update test for r142801.

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

13 years agoXFAIL test on leak checkers.
Benjamin Kramer [Mon, 24 Oct 2011 17:24:05 +0000 (17:24 +0000)]
XFAIL test on leak checkers.

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

13 years agoThumb2 LDM instructions can target PC. Make sure to encode it.
Jim Grosbach [Mon, 24 Oct 2011 17:16:24 +0000 (17:16 +0000)]
Thumb2 LDM instructions can target PC. Make sure to encode it.

PR11220

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

13 years agoCleanup. Get rid of the old SjLj EH lowering code. No functionality change.
Bill Wendling [Mon, 24 Oct 2011 17:12:36 +0000 (17:12 +0000)]
Cleanup. Get rid of the old SjLj EH lowering code. No functionality change.

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

13 years agoSink an otherwise unused variable's initializer into the asserts that
Chandler Carruth [Mon, 24 Oct 2011 16:51:55 +0000 (16:51 +0000)]
Sink an otherwise unused variable's initializer into the asserts that
used it. Fixes an unused variable warning from GCC on release builds.

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

13 years agoImplement comparison operators for BranchProbability in a way that can't overflow...
Benjamin Kramer [Mon, 24 Oct 2011 13:50:56 +0000 (13:50 +0000)]
Implement comparison operators for BranchProbability in a way that can't overflow INT64_MAX.

Add a test case for the edge case that triggers this. Thanks to Chandler for bringing this to my attention.

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

13 years agoRemove return heuristics from the static branch probabilities, and
Chandler Carruth [Mon, 24 Oct 2011 12:01:08 +0000 (12:01 +0000)]
Remove return heuristics from the static branch probabilities, and
introduce no-return or unreachable heuristics.

The return heuristics from the Ball and Larus paper don't work well in
practice as they pessimize early return paths. The only good hitrate
return heuristics are those for:
 - NULL return
 - Constant return
 - negative integer return

Only the last of these three can possibly require significant code for
the returning block, and even the last is fairly rare and usually also
a constant. As a consequence, even for the cold return paths, there is
little code on that return path, and so little code density to be gained
by sinking it. The places where sinking these blocks is valuable (inner
loops) will already be weighted appropriately as the edge is a loop-exit
branch.

All of this aside, early returns are nearly as common as all three of
these return categories, and should actually be predicted as taken!
Rather than muddy the waters of the static predictions, just remain
silent on returns and let the CFG itself dictate any layout or other
issues.

However, the return heuristic was flagging one very important case:
unreachable. Unfortunately it still gave a 1/4 chance of the
branch-to-unreachable occuring. It also didn't do a rigorous job of
finding those blocks which post-dominate an unreachable block.

This patch builds a more powerful analysis that should flag all branches
to blocks known to then reach unreachable. It also has better worst-case
runtime complexity by not looping through successors for each block. The
previous code would perform an N^2 walk in the event of a single entry
block branching to N successors with a switch where each successor falls
through to the next and they finally fall through to a return.

Test case added for noreturn heuristics. Also doxygen comments improved
along the way.

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

13 years agoRevert "Test commit"
NAKAMURA Takumi [Mon, 24 Oct 2011 10:03:25 +0000 (10:03 +0000)]
Revert "Test commit"

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

13 years agoTest commit
NAKAMURA Takumi [Mon, 24 Oct 2011 10:02:59 +0000 (10:02 +0000)]
Test commit

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

13 years agoReapply r142781 with fix. Original message:
Nick Lewycky [Mon, 24 Oct 2011 06:57:05 +0000 (06:57 +0000)]
Reapply r142781 with fix. Original message:

  Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
  loop header when computing the trip count.

  With this, we now constant evaluate:
    struct ListNode { const struct ListNode *next; int i; };
    static const struct ListNode node1 = {0, 1};
    static const struct ListNode node2 = {&node1, 2};
    static const struct ListNode node3 = {&node2, 3};
    int test() {
      int sum = 0;
      for (const struct ListNode *n = &node3; n != 0; n = n->next)
        sum += n->i;
      return sum;
    }

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

13 years agoDoxygen-ify the comments on the public interface for BPI. Also, move the
Chandler Carruth [Mon, 24 Oct 2011 05:55:58 +0000 (05:55 +0000)]
Doxygen-ify the comments on the public interface for BPI. Also, move the
two more subtle routines to the bottom and expand on their cautionary
comments a bit. No functionality or actual interface change here.

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

13 years agoPHI nodes not in the loop header aren't part of the loop iteration initial
Nick Lewycky [Mon, 24 Oct 2011 05:51:01 +0000 (05:51 +0000)]
PHI nodes not in the loop header aren't part of the loop iteration initial
state. Furthermore, they might not have two operands. This fixes the underlying
issue behind the crashes introduced in r142781.

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

13 years agoA dead malloc, a free(NULL) and a free(undef) are all trivially dead
Nick Lewycky [Mon, 24 Oct 2011 04:35:36 +0000 (04:35 +0000)]
A dead malloc, a free(NULL) and a free(undef) are all trivially dead
instructions.

This doesn't introduce any optimizations we weren't doing before (except
potentially due to pass ordering issues), now passes will eliminate them sooner
as part of their own cleanups.

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

13 years agoSpeculatively revert r142781. Bots are showing
Nick Lewycky [Mon, 24 Oct 2011 04:00:25 +0000 (04:00 +0000)]
Speculatively revert r142781. Bots are showing
  Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed.
coming out of indvars.

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

13 years agoWindows/Path.inc: [PR8460] Get rid of ScopedNullTerminator. Thanks to Zvi Rackover!
NAKAMURA Takumi [Mon, 24 Oct 2011 03:27:19 +0000 (03:27 +0000)]
Windows/Path.inc: [PR8460] Get rid of ScopedNullTerminator. Thanks to Zvi Rackover!

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

13 years agoSimplify the design of BranchProbabilityInfo by collapsing it into
Chandler Carruth [Mon, 24 Oct 2011 01:40:45 +0000 (01:40 +0000)]
Simplify the design of BranchProbabilityInfo by collapsing it into
a single class. Previously it was split between two classes, one
internal and one external. The concern seemed to center around exposing
the weights used, but those can remain confined to the implementation
file.

Having a single class to maintain the state and analyses in use will
also simplify several of the enhancements I want to make to our static
heuristics.

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

13 years agoEnhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
Nick Lewycky [Sun, 23 Oct 2011 23:43:14 +0000 (23:43 +0000)]
Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
  struct ListNode { const struct ListNode *next; int i; };
  static const struct ListNode node1 = {0, 1};
  static const struct ListNode node2 = {&node1, 2};
  static const struct ListNode node3 = {&node2, 3};
  int test() {
    int sum = 0;
    for (const struct ListNode *n = &node3; n != 0; n = n->next)
      sum += n->i;
    return sum;
  }

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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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