[PATCH] D61665: [TailCall] Disable tail call if the callee function contain __builtin_frame_address or __builtin_return_address

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 14:11:15 PDT 2019


hfinkel added a comment.

In D61665#1495701 <https://reviews.llvm.org/D61665#1495701>, @efriedma wrote:

> I have a few concerns here:
>
> 1. Looping over every instruction in a function is expensive, and makes any pass which checks this for every call in a function take quadratic time overall.
> 2. You can't inspect the body of a function pointer, or a function in a different translation unit, so we can't make this work consistently.
> 3. Even in the same translation unit, how do we "preserve" the behavior for values greater than 1?
>
>   ------
>
>   I'd prefer to just leave the current behavior if it isn't causing any practical problems.  The user can always use -fno-optimize-sibling-calls if their codebase needs it for some reason.


If we do wish to make our "best effort" contain more effort, I think that we'd want to do this during function-attribute inference - there we can iterate over the call graph and add some inhibiting attributes. That having been said, if the only use case we have for this is matching some portion of GCC's heuristic for the purpose of making their test case pass, I'm not sure that this is worthwhile.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61665/new/

https://reviews.llvm.org/D61665





More information about the llvm-commits mailing list