[PATCH] D11243: [ARM] Force LR spill in thumb2 noreturn functions
Quentin Colombet
qcolombet at apple.com
Wed Jul 15 15:17:29 PDT 2015
Hi Bruno,
I guess that it is general goodness to have the right stack trace when you debug something, but I thought noreturn + nounwind allow the compiler to trash the information for optimization purposes?
I am not saying that your patch is wrong, I am pointing out that it seems we regress some pattern to improve the debug experience, and I am not sure this is something we should do.
My 2c.
Cheers,
-Quentin
> On Jul 15, 2015, at 2:59 PM, Bruno Cardoso Lopes <bruno.cardoso at gmail.com> wrote:
>
> bruno created this revision.
> bruno added reviewers: t.p.northover, MatzeB.
> bruno added a subscriber: llvm-commits.
> bruno set the repository for this revision to rL LLVM.
> Herald added subscribers: rengolin, aemerson.
>
> In ARM mode we do an opt in noreturn functions that uses branch
> instead of calls and explicitly save the pc (r151645):
>
> mov lr, pc
> b _bar
>
> This isn't possible in thumb2 mode because the mode bit doesnt get set
> (r167657). However, we currently emit a branch and link but do not save
> the LR, which leads to bad backtraces coming from noreturn functions.
>
> Example:
>
> define void @a() noreturn nounwind ssp {
> tail call void @b()
> unreachable
> }
> define void @b() noreturn nounwind ssp {
> tail call void @abort() noreturn nounwind
> unreachable
> }
> declare void @abort() noreturn
>
> Currently generates:
>
> _a:
> bl _b
> _b:
> push {r7, lr}
> mov r7, sp
> blx _abort
>
> Leading to bad backtraces. This patch generates instead:
>
> _a:
> push {r7, lr}
> mov r7, sp
> bl _b
> _b:
> push {r7, lr}
> mov r7, sp
> blx _abort
>
> Repository:
> rL LLVM
>
> http://reviews.llvm.org/D11243
>
> Files:
> lib/Target/ARM/ARMFrameLowering.cpp
> lib/Target/ARM/ARMISelLowering.cpp
> lib/Target/ARM/ARMMachineFunctionInfo.h
> test/CodeGen/Thumb2/call-noret-direct.ll
>
> <D11243.29837.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list