[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 14:02:16 PDT 2017


kparzysz added a comment.

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

> Wait, that's not right; we don't need to include lr in the list of live-outs either way.  If we generate "pop {pc}", lr isn't used; if we generate "bx lr", the explicit use of lr should allow us to generate correct liveness.


The problem is that currently the return instructions don't carry any live-out information that is associated with callee-saved registers.  LivePhysRegs needs to know that information, because CS registers need to be treated as live between the restore point and the exit from the function.  It uses CalleeSavedInfo to get that data, which leads it to believe that LR is live at the return.  If the return instruction uses LR explicitly (bx lr), this will have been already expressed in liveness, but if it's a "pop", it won't be.  Still, LivePhysRegs will think that LR is live at the return and we end up with a problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D36160





More information about the llvm-commits mailing list