[PATCH] D12923: Add support for function attribute "notail"

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 19:35:32 PDT 2015


sanjoy added a subscriber: sanjoy.
sanjoy added a comment.

Does this mean LLVM will not longer be able to generate indirect tail calls (tail calls when the target function is not known statically); because the target function /could/ have been marked `notail`?

For instance, clang 3.7.0 optimizes

  typedef int (g)(void *, int);
  
  int f(g* ptr, int x) {
    return ptr(ptr, x);
  }

into

  	.section	__TEXT,__text,regular,pure_instructions
  	.macosx_version_min 10, 10
  	.globl	_f
  	.align	4, 0x90
  _f:                                     ## @f
  	.cfi_startproc
  ## BB#0:
  	pushq	%rbp
  Ltmp0:
  	.cfi_def_cfa_offset 16
  Ltmp1:
  	.cfi_offset %rbp, -16
  	movq	%rsp, %rbp
  Ltmp2:
  	.cfi_def_cfa_register %rbp
  	popq	%rbp
  	jmpq	*%rdi                   ## TAILCALL
  	.cfi_endproc
  
  
  .subsections_via_symbols


http://reviews.llvm.org/D12923





More information about the llvm-commits mailing list