[Pipeliner] Fix calculation when reusing phis
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 26 Mar 2018 16:10:48 +0000 (16:10 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 26 Mar 2018 16:10:48 +0000 (16:10 +0000)
commit55cb4986a47acd7296c0a026bd53a507baeb03a7
tree41242c71b72076473a4c85583fb186a116ae7265
parentaa40148cae6611fb8b30e5f51492d5f73ed3660b
[Pipeliner] Fix calculation when reusing phis

A schedule may require that a phi from the original loop is used in
multiple iterations in the scheduled loop. When this occurs, we generate
multiple phis in the pipelined loop to save the value across iterations.

When we generate the new phis and update the register names in the
pipelined loop, the pipeliner attempts to reuse a previously generated
phi, when possible. The calculation for the name of the new phi needs
to account for the version/iteration of the original phi. Also, in the
epilog, the code only needs to check backwards for a previous iteration
until reaching the first prolog block.

Patch by Brendon Cahoon.

llvm-svn: 328537
llvm/lib/CodeGen/MachinePipeliner.cpp