llvm-6502/test
Chandler Carruth 70daea90af Rewrite how machine block placement handles loop rotation.
This is a complex change that resulted from a great deal of
experimentation with several different benchmarks. The one which proved
the most useful is included as a test case, but I don't know that it
captures all of the relevant changes, as I didn't have specific
regression tests for each, they were more the result of reasoning about
what the old algorithm would possibly do wrong. I'm also failing at the
moment to craft more targeted regression tests for these changes, if
anyone has ideas, it would be welcome.

The first big thing broken with the old algorithm is the idea that we
can take a basic block which has a loop-exiting successor and a looping
successor and use the looping successor as the layout top in order to
get that particular block to be the bottom of the loop after layout.
This happens to work in many cases, but not in all.

The second big thing broken was that we didn't try to select the exit
which fell into the nearest enclosing loop (to which we exit at all). As
a consequence, even if the rotation worked perfectly, it would result in
one of two bad layouts. Either the bottom of the loop would get
fallthrough, skipping across a nearer enclosing loop and thereby making
it discontiguous, or it would be forced to take an explicit jump over
the nearest enclosing loop to earch its successor. The point of the
rotation is to get fallthrough, so we need it to fallthrough to the
nearest loop it can.

The fix to the first issue is to actually layout the loop from the loop
header, and then rotate the loop such that the correct exiting edge can
be a fallthrough edge. This is actually much easier than I anticipated
because we can handle all the hard parts of finding a viable rotation
before we do the layout. We just store that, and then rotate after
layout is finished. No inner loops get split across the post-rotation
backedge because we check for them when selecting the rotation.

That fix exposed a latent problem with our exitting block selection --
we should allow the backedge to point into the middle of some inner-loop
chain as there is no real penalty to it, the whole point is that it
*won't* be a fallthrough edge. This may have blocked the rotation at all
in some cases, I have no idea and no test case as I've never seen it in
practice, it was just noticed by inspection.

Finally, all of these fixes, and studying the loops they produce,
highlighted another problem: in rotating loops like this, we sometimes
fail to align the destination of these backwards jumping edges. Fix this
by actually walking the backwards edges rather than relying on loopinfo.

This fixes regressions on heapsort if block placement is enabled as well
as lots of other cases where the previous logic would introduce an
abundance of unnecessary branches into the execution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 01:12:56 +00:00
..
Analysis SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW. 2012-04-07 17:19:26 +00:00
Archive Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed. 2012-02-16 06:28:33 +00:00
Assembler Remove old 'grep' lines. 2012-04-08 11:53:54 +00:00
Bindings/Ocaml Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu 2012-03-25 09:02:19 +00:00
Bitcode FileCheckize these testcases. 2012-04-08 11:00:38 +00:00
BugPoint Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed. 2012-02-16 06:28:33 +00:00
CodeGen Rewrite how machine block placement handles loop rotation. 2012-04-16 01:12:56 +00:00
DebugInfo Patch to set is_stmt a little better for prologue lines in a function. 2012-04-05 20:39:05 +00:00
ExecutionEngine This patch improves the MCJIT runtime dynamic loader by adding new handling 2012-04-12 20:13:57 +00:00
Feature This file is no longer needed (DejaGNU-isms removed from code) 2012-03-25 12:43:54 +00:00
Instrumentation [tsan] two more compile-time optimizations: 2012-04-10 22:29:17 +00:00
Integer Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed. 2012-02-16 06:28:33 +00:00
Linker Add back removed code. It still causes LLVM to miscompile. But not having it breaks other things. 2012-02-27 23:48:30 +00:00
MC Fixed a case of ARM disassembly getting an assert on a bad encoding 2012-04-11 22:40:17 +00:00
Object Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu 2012-03-25 09:02:19 +00:00
Other Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu 2012-03-25 09:02:19 +00:00
Scripts
TableGen Fix infinite loop in nested multiclasses. 2012-03-07 16:39:35 +00:00
Transforms Fix an error in BBVectorize important for vectorizing pointer types. 2012-04-14 07:32:50 +00:00
Unit
Verifier Rename "fpaccuracy" metadata to the more generic "fpmath". That's because I'm 2012-04-14 12:36:06 +00:00
YAMLParser Add YAML parser to Support. 2012-04-03 23:09:22 +00:00
CMakeLists.txt Revert r153694. It was causing failures in the buildbots. 2012-03-29 23:23:59 +00:00
lit.cfg Catch the Python exception when subprocess.Popen is failing. 2012-04-13 11:22:18 +00:00
lit.site.cfg.in Revert r153694. It was causing failures in the buildbots. 2012-03-29 23:23:59 +00:00
Makefile Revert r153694. It was causing failures in the buildbots. 2012-03-29 23:23:59 +00:00
Makefile.tests
site.exp.in
TestRunner.sh