summaryrefslogtreecommitdiff
path: root/hadrian/ci.project
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-04-04 02:52:12 +0200
committerAndreas Klebinger <klebinger.andreas@gmx.at>2020-05-20 19:26:12 +0200
commit2533c8f61bdf4049b4d7505d9bc7cc6343900cf2 (patch)
tree456f5b62ef4e1c5d24fa7c42145fca0bb7ac9ea5 /hadrian/ci.project
parentb352d63cbbfbee69358c198edd876fe7ef9d63ef (diff)
downloadhaskell-wip/andreask/refactor_cmm_weights.tar.gz
Refactor linear reg alloc to remember past assignments.wip/andreask/refactor_cmm_weights
When assigning registers we now first try registers we assigned to in the past, instead of picking the "first" one. This is in extremely helpful when dealing with loops for which variables are dead for part of the loop. This is important for patterns like this: foo = arg1 loop: use(foo) ... foo = getVal() goto loop; There we: * assign foo to the register of arg1. * use foo, it's dead after this use as it's overwritten after. * do other things. * look for a register to put foo in. If we pick an arbitrary one it might differ from the register the start of the loop expect's foo to be in. To fix this we simply look for past register assignments for the given variable. If we find one and the register is free we use that register. This reduces the need for fixup blocks which match the register assignment between blocks. In the example above between the end and the head of the loop. This patch also moves branch weight estimation ahead of register allocation and adds a flag to control it (cmm-static-pred). * It means the linear allocator is more likely to assign the hotter code paths first. * If it assign these first we are: + Less likely to spill on the hot path. + Less likely to introduce fixup blocks on the hot path. These two measure combined are surprisingly effective. Based on nofib we get in the mean: * -0.9% instructions executed * -0.1% reads/writes * -0.2% code size. * -0.1% compiler allocations. * -0.9% compile time. * -0.8% runtime. Most of the benefits are simply a result of removing redundant moves and spills. Reduced compiler allocations likely are the result of less code being generated. (The added lookup is mostly non-allocating).
Diffstat (limited to 'hadrian/ci.project')
0 files changed, 0 insertions, 0 deletions