Hi All,
We are encountering an issue where “bool llvm::isInTailCallPosition()” returns true for a callee not in a tail call position.
The function “bool llvm::isInTailCallPosition()” (https://pastebin.com/fMxAsh95) only checks whether a call is in a tail call position if the call has side effects, accesses memory or is not safe to speculatively execute. Therefore, a “speculatable” function will always be considered in a tail-call position - regardless of whether it actually is. A small example as below:
IR reproducer https://pastebin.com/eZwVxr2K produces a tail call in caller without storing the result, which can be seen in the initial SDAG shared below:
https://pastebin.com/SnyKHeZT
Any ideas or suggestions?
Thanks,
Victor