Open JohanEngelen opened 6 years ago
Clang just seems to duplicate the function body for variadic functions.
(instead of forwarding to the derived-class implementation)
It's working (at least compiling fine) for ARM and AArch64, so I suspect an issue with the PPC LLVM target.
It might compile fine, but is musttail
actually guaranteed to behave in that fashion?
AFAICT forwarding variadics is exactly one of its purposes; I found it when looking for how to properly forward in a variadic thunk. I also see no reason why the tail call shouldn't work; the signatures are identical, only difference is that the actual implementation has a EH personality. After the call, there's immediately a ret
(should be returning void or the call result). I also quickly looked at the tail-call optimization docs, but they are hopelessly outdated (supposedly only supporting x86 and PowerPC, only for 3 calling conventions excl. the default C one - i.e., stuff which has already been proven wrong by CI and manual ARM tests).
Ah I think that's what I found back then: Perfectly forwarding thunks can now be expressed in LLVM IR with musttail and varargs
Ah, good to know – thanks!
Failing testcase with
-mtriple=powerpc64-unknown-linux-gnu
(see Litcodegen/variadic_thunk_gh2613.d
):Error: