[PATCH] D41762: [DWARF] Incorrect prologue end line record.

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 02:26:06 PST 2018


CarlosAlbertoEnciso added a comment.

In https://reviews.llvm.org/D41762#1006539, @thegameg wrote:

> In https://reviews.llvm.org/D41762#1006344, @aprantl wrote:
>
> > IIUC, enabling/disabling shrink-wrapping does not move the prologue_end, so this LGTM.
>
>
> If I understand the code <https://github.com/llvm-mirror/llvm/blob/7947e7211b5dd0cc9fc75359da8c73a2e913fe1a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp#L1256> correctly, in case of shrink-wrapping kicking in, `prologue_end` will be at the beginning of the function, while without shrink-wrapping, it will be at the end of the prologue. I believe that's correct, right?


Hi,

I tried your given test case with the same command line options and this is the assembler generated for both cases:

clang -O1 -S -g -o - foo.c

  main:                           # @main
    [...]
  # %bb.0:                        # %entry
    xorl	%eax, %eax
  .Ltmp0:
    .loc	1 5 12 prologue_end     # foo.c:5:12
    cmpl	$110, %edi
  .Ltmp1:
    .loc	1 5 7 is_stmt 0         # foo.c:5:7
    jl	.LBB0_2
  .Ltmp2:
  # %bb.1:                        # %if.then
    pushq	%rax
    .cfi_def_cfa_offset 16
  .Ltmp3:
    .loc	1 6 9 is_stmt 1         # foo.c:6:9
    movl	$30, 4(%rsp)
    leaq	4(%rsp), %rdi
  .Ltmp4:
    .loc	1 7 5                   # foo.c:7:5
    callq	foo
  .Ltmp5:
    .loc	1 8 12                  # foo.c:8:12
    movl	4(%rsp), %eax
  .Ltmp6:
    .loc	1 0 12 is_stmt 0        # foo.c:0:12
    addq	$8, %rsp
  .Ltmp7:
  .LBB0_2:                        # %return
    .loc	1 11 1 is_stmt 1        # foo.c:11:1
    retq

clang -O1 -S -g -o - foo.c -mllvm -enable-shrink-wrap=false

  main:                           # @main
    [...]
  # %bb.0:                        # %entry
    pushq	%rax
    .cfi_def_cfa_offset 16
    xorl	%eax, %eax
  .Ltmp0:
    .loc	1 5 12 prologue_end     # foo.c:5:12
    cmpl	$110, %edi
  .Ltmp1:
    .loc	1 5 7 is_stmt 0         # foo.c:5:7
    jl	.LBB0_2
  .Ltmp2:
  # %bb.1:                        # %if.then
    .loc	1 6 9 is_stmt 1         # foo.c:6:9
    movl	$30, 4(%rsp)
    leaq	4(%rsp), %rdi
  .Ltmp3:
    .loc	1 7 5                   # foo.c:7:5
    callq	foo
  .Ltmp4:
    .loc	1 8 12                  # foo.c:8:12
    movl	4(%rsp), %eax
  .Ltmp5:
  .LBB0_2:                        # %return
    .loc	1 11 1                  # foo.c:11:1
    popq	%rcx
    retq

I noticed that the code generation does not look similar to your posting specially for the case when -enable-shrink-wrap=false.

May be we are using different compilers. My version is revision 325102 plus the submitted changes for the review.

Thanks,
Carlos


https://reviews.llvm.org/D41762





More information about the llvm-commits mailing list