[PATCH] D35816: [Greedy RegAlloc] Add logic to greedy reg alloc to avoid bad eviction chains

Marina Yatsina via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 17:27:15 PDT 2017


myatsina added a comment.

As far as I read (http://www.eecs.umich.edu/~mahlke/papers/1993/hwu_jsuper93.pdf), in order to create superblocks, we need to identify traces using execution profile information, and then do tail duplication to avoid multiple entrances.
According the authors of this technique, this transformation as itself takes significant amount of code and compile time.
I don’t think this transformation is something we should do only for the sake of machine copy propagation pass, as it adds significant complexity.
The decision of supporting this transformation and the possible optimizations that can benefit from it seems like an orthogonal discussion that is not directly related to this bad eviction chains I’m trying to solve.

Even if I do have some transformation to superblocks that have single entry and multiple exists, I will still need to do liveness tracking over all possible paths to maintain correctness:

bb1:
xmm0 = copy xmm1
xmm1 = copy xmm2
xmm2 = copy xmm3
...

test
je bb3

bb2:
xmm3 = copy xmm2
xmm2 = copy xmm1
xmm1 = copy xmm0
return

bb3:
return

The path bb1->bb2 can benefit from the change, but it is not legal for me to this change if a paths like bb1->bb3 exits – I need to scan all paths.

For each suspected copy chain I will need to track a whole subtree in this superblock CFG which begins with the first copy of the chain.
I will need to make sure all possible paths from that first copy contain the whole chain and that there is no path that clobbers one of the registers in the middle of that chain.
So I find myself doing some sort of liveness tracking here too.
I know my original solution added complexity to Greedy, but Greedy’s decisions are the source of this issue, and it doesn’t seem like we have an elegant way to clean up the consequences of those decisions when we’re talking about cross-BB chains.

Thanks,
Marina


Repository:
  rL LLVM

https://reviews.llvm.org/D35816





More information about the llvm-commits mailing list