[PATCH] D79978: Call Frame Information (CFI) Handling for Basic Block Sections

Sriraman Tallam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 08:46:22 PDT 2020


tmsriram added a comment.

In D79978#2141768 <https://reviews.llvm.org/D79978#2141768>, @wmi wrote:

> In D79978#2140849 <https://reviews.llvm.org/D79978#2140849>, @MaskRay wrote:
>
> > I haven't looked into the details, but the test suggests that the patch is wrong:
> >
> >   # basic-block-sections-cfi-1.ll
> >           .section        .text,"ax", at progbits,unique,2
> >   _Z2f3b.2:                               # %if.end
> >           .cfi_startproc
> >           .cfi_def_cfa %rbp, 16    # this should be inserted after addq $16, %rsp
> >           .cfi_offset %rbp, -16    # this should be after .cfi_def_cfa %rbp, 16
> >           addq    $16, %rsp
> >           popq    %rbp
> >           .cfi_def_cfa %rsp, 8
> >           retq
> >
>
>
> I think the position where the cfi directives are currently inserted is correct. Those directives at the beginning of BB are not to maintain call frame information for instructions inside of BB like "addq    $16, %rsp" and "popq %rbp", but to setup the call frame information correctly at the beginning of BB because the BB could be moved around.


Right.  If you also compile the code without fbasicblock-sections, then you will see that there is no cfi directive for addq $16, %rsp at that point where you are referring to.  I use that myself to understand when bugs happen.  I will double-check.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79978/new/

https://reviews.llvm.org/D79978





More information about the llvm-commits mailing list