[PATCH] D27231: [PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 06:08:46 PST 2017


hfinkel added a comment.

In https://reviews.llvm.org/D27231#628498, @iteratee wrote:

> I should clarify the problem.
>
> LLVM / Clang may not support ELF interposition. But the linker just doesn't care. If we emit a symbol that is ExternallyAvailable and not local linkage, the linker will emit a trampoline that saves r2, even for a tail call.
>
> This is a problem for a tail call as before the jump, it removes its own stack frame (or it lived in the red zone in the case I debugged), so the r2 being saved by the trampoline is not correct.
>
> a -- calls -> b -- tail calls -> c
>
> if a is in a different module from b, then a's saved copy of r2 will be clobbered by the b->c trampoline that the linker generates.


Thanks for tracking this down! I'll update the patch accordingly.


Repository:
  rL LLVM

https://reviews.llvm.org/D27231





More information about the llvm-commits mailing list