[PATCH] D22900: Revert r244207 - Mark calls in thunk functions as tail-call optimization

Nick Lewycky via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 11:27:24 PDT 2016

nlewycky added a comment.

For the IR level, I think this has got to be valid:

  declare void @bar(i32* byval %p)
  define void @foo(i32* byval %p) {
    tail call void @bar(i32* byval %p.tmp)
    ret void

The `tail` is an aliasing property which indicates that the callee doesn't touch any of the alloca's in the caller, a rough proxy for "stack" since there is no other stack in LLVM IR. That doesn't mean that we're going to actually lower it to a tail call in the final assembly, but if we don't put `tail` on a call, we won't even consider it for becoming a tail call. I think the backend can sort out whether the byval is going to lead to a stack allocation in @foo and emit a non-tail call if so.


More information about the cfe-commits mailing list