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

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 10:41:08 PST 2018


thegameg added a comment.

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?

  $ cat foo.c
  void foo(int *);
  
  int main(int argc, char const *argv[])
  {
    if (argc > 109) {
      int j = 30;
      foo(&j);
      return j;
    }
    return 0;
  }
  
  $ 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
  	[...]
  	jl	LBB0_2
  ## %bb.1:                               ## %if.then
          [...]
  	pushq	%rbp
  	[...]
  	popq	%rbp
  LBB0_2:                                 ## %return
  	[...]
  	retq
  
  $ clang -O1 -S -g -o - foo.c -mllvm -enable-shrink-wrap=false
  _main:                                  ## @main
  	[...]
  ## %bb.0:                               ## %entry
  	pushq	%rbp
          [.cfi...]
  	movq	%rsp, %rbp
  	subq	$16, %rsp
  	[...]
  	xorl	%eax, %eax
  Ltmp0:
  	.loc	1 5 12 prologue_end     ## foo.c:5:12
  	cmpl	$110, %edi
  	[...]
  	jl	LBB0_2
  Ltmp2:
  ## %bb.1:                               ## %if.then
  	[...]
  LBB0_2:                                 ## %return
  	[...]
  	popq	%rbp
  	retq


https://reviews.llvm.org/D41762





More information about the llvm-commits mailing list