[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:49:00 PST 2018


MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.

Ok the subtle detail I missed before is that noreturn calls may still throw an exception/cause stack unwinding apparently. In that case we indeed need to prepare for CSR restoration.

So LGTM, thanks!

We could go back to the previous code in case the noreturn call is marked `nothrows` and safe a few spill instructions. But let's leave that for later and get it correct first.

In https://reviews.llvm.org/D42509#987240, @efriedma wrote:

> Without this patch, LLVM trunk generates the following code:
>
>   no_stm:
>           .fnstart
>   @ %bb.0:                                @ %entry
>           .save   {r7, lr}
>           push    {r7, lr}
>           .setfp  r7, sp
>           add     r7, sp, #0
>           mov     r4, r3
>           adds    r4, #8
>           stm     r4!, {r0, r1, r2}
>           bl      throws_2
>
>
> How do you expect the unwinder to restore r4 after we've overwritten it?



Repository:
  rL LLVM

https://reviews.llvm.org/D42509





More information about the llvm-commits mailing list