llvm/lib
Andrew Trick 6ea2b9608a Allocate local registers in order for optimal coloring.
Also avoid locals evicting locals just because they want a cheaper register.

Problem: MI Sched knows exactly how many registers we have and assumes
they can be colored. In cases where we have large blocks, usually from
unrolled loops, greedy coloring fails. This is a source of
"regressions" from the MI Scheduler on x86. I noticed this issue on
x86 where we have long chains of two-address defs in the same live
range. It's easy to see this in matrix multiplication benchmarks like
IRSmk and even the unit test misched-matmul.ll.

A fundamental difference between the LLVM register allocator and
conventional graph coloring is that in our model a live range can't
discover its neighbors, it can only verify its neighbors. That's why
we initially went for greedy coloring and added eviction to deal with
the hard cases. However, for singly defined and two-address live
ranges, we can optimally color without visiting neighbors simply by
processing the live ranges in instruction order.

Other beneficial side effects:

It is much easier to understand and debug regalloc for large blocks
when the live ranges are allocated in order. Yes, global allocation is
still very confusing, but it's nice to be able to comprehend what
happened locally.

Heuristics could be added to bias register assignment based on
instruction locality (think late register pairing, banks...).

Intuituvely this will make some test cases that are on the threshold
of register pressure more stable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187139 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-25 18:35:14 +00:00
..
Analysis Treat nothrow forms of ::operator delete and ::operator delete[] as 2013-07-21 23:11:42 +00:00
AsmParser Target/X86: Add explicit Win64 and System V/x86-64 calling conventions. 2013-07-12 06:02:35 +00:00
Bitcode Add a wrapper for open. 2013-07-16 19:44:17 +00:00
CodeGen Allocate local registers in order for optimal coloring. 2013-07-25 18:35:14 +00:00
DebugInfo DebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code style and comments. 2013-07-15 08:43:35 +00:00
ExecutionEngine AArch64: don't mask off shift bits when processing JIT relocations. 2013-07-25 12:42:52 +00:00
IR Add a way to add a kind-value string pair to an attribute. 2013-07-25 18:34:24 +00:00
IRReader Add 'const' qualifiers to static const char* variables. 2013-07-16 01:17:10 +00:00
Linker Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer. 2013-05-28 15:17:05 +00:00
MC Revert "Remove use of asymmetric std::lower_bound comparator." 2013-07-23 17:44:11 +00:00
Object Delete the buffer in createObjectFile if it fails. 2013-07-24 14:00:26 +00:00
Option Silence gcc warning. 2013-07-22 21:29:28 +00:00
Support Don't end a file name with a dot. It looks odd. 2013-07-25 15:00:17 +00:00
TableGen keep only the StringRef version of getFileOrSTDIN. 2013-06-25 05:28:34 +00:00
Target AArch64: fix even more JIT failures 2013-07-25 16:03:54 +00:00
Transforms Respect llvm.used in Internalize. 2013-07-25 03:23:25 +00:00
CMakeLists.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
LLVMBuild.txt Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00
Makefile Move lib/Archive to tools/llvm-ar. 2013-06-17 15:47:20 +00:00