Variadic functions can be treated in the same way as normal functions
with respect to the number and types of parameters.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Could you have a look at this patch? I see no reason to restrict the tail call optimizations to variadic functions: the AAPCS restrictions seem to be already checked for non-variadic functions. The LLVM regression tests passed, and I have also tested with a few benchmarks and they all seem to work fine.
Please shout if I overlooked something. New test suggestions will be also very welcome.
Thanks,
Pablo
This was added by Jim in 2010, so I'm assuming it's something related to Darwin.
Adding Tim and Jim as reviewers.
Jim's change seems to have been a whitespace tidy-up. It actually seems to hail from the very first tailcall commit in r105413 so it was probably just paranoia.
I can't think of any reason why it should be banned either so I say go for it.
The change itself looks fine, I have a few suggestions for testing:
The test is checking the APCS ABI, could you add some extra RUN lines to check the newer AAPCS ABI? In particular, v_caller_ints2 will not be tail-callable in AAPCS because i64s must be in an even-odd register pair, so the last argument will go on the stack.
I'd also suggest adding some tests using doubles, and using the arm_aapcs_vfpcc calling convention, as doubles get treated differently for variadic and non-variadic calls.
More testing: add tests for AAPCS and for floating-point arguments to variadic/non-variadic functions.
Small comment on the tests, otherwise, LGTM. Thanks!
test/CodeGen/ARM/tail-call.ll | ||
---|---|---|
43 ↗ | (On Diff #78243) | You can make all of them use --check-prefix=CHECK and then have only one CHECK-LABEL. |
LGTM, thanks!
test/CodeGen/ARM/tail-call.ll | ||
---|---|---|
30 ↗ | (On Diff #78339) | Heh, this was being completely ignored before. :) |