[PATCH] D42509: [LivePhysRegs] Preserve pristine registers in blocks with no successors.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 15:30:35 PST 2018


MatzeB added a comment.

In https://reviews.llvm.org/D42509#988208, @kparzysz wrote:

> In https://reviews.llvm.org/D42509#987226, @MatzeB wrote:
>
> > A noreturn call doesn't need to have the callers callee saved registers restored.
>
>
> Why not?  The non-returning call doesn't come back to its call site, but it goes somewhere. From the point of view of some function foo, all of that activity may happen inside the call to bar (which would have further calls in it). Not preserving non-volatile registers could cause them to end up being clobbered across the call to bar.


I think there's two concepts here:
a) A tailcall (i.e. instead of a "call X; return" combination you use "jmp X"). We use special tailcall instructions for this that have the isReturn flag set and mostly look like a normal return to regalloc.
b) A noreturn call (i.e. exit(), abort()). Those are normals calls that just happen to never return. This case looks like a normal case we just somehow have no terminator instruction in a block without any successor blocks.

We need to restore callee saves for case a) but should that anyway as it looks like a return. We could restore callee saves in case after the call in case b), but why bother: we will never get there anyway.


Repository:
  rL LLVM

https://reviews.llvm.org/D42509





More information about the llvm-commits mailing list