[PATCH] D36160: Liveness issues in tail merging, and the ARM::LR saved-but-not-restored

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 12:25:13 PDT 2017


kparzysz added a comment.

In https://reviews.llvm.org/D36160#827859, @efriedma wrote:

> Long-term, it might be more straightforward to add implicit uses to return instructions, similar to the way we add implicit defs to calls, so we don't have to make return blocks a special case in LivePhysRegs.  Not sure how hard that would be.


There is a review for that as well (https://reviews.llvm.org/D33003), and it ran into the same problem.  It adds all registers that are live-out from the function to the return instructions (except those which are defined by the return instruction itself).  The problem is that it again uses CSI to determine for which registers such implicit uses need to be created, and again LR causes trouble: since the return instruction (pop) doesn't restore it, the code will assume that it must have been restored prior to the return and add an implicit use of LR to the return.  That, in turn, is a problem since LR remains undefined (clobbered).


Repository:
  rL LLVM

https://reviews.llvm.org/D36160





More information about the llvm-commits mailing list