musttail functions and those with swifttailcc and tailcc calling conventions have to be handled specially when being outlined. This adds support of musttail function in the cases of these two calling conventions in particular.
Details
Diff Detail
Unit Tests
Event Timeline
Do you think you could add a statistic which counts the number of tail calls emitted? And maybe some debug output that says that something will be handled as a tail call?
I'm not sure how often musttail/tailcc appears in the LLVM test suite, but this didn't introduce any asserts there, and all of the tests pass.
@aschwaighofer Can you think of any (open source) Swift programs we can test this on? :)
Yeah, it looks like there's a clang attribute, but it isn't used anywhere in the LLVM test suite.
https://clang.llvm.org/docs/AttributeReference.html#musttail
llvm/lib/Transforms/IPO/IROutliner.cpp | ||
---|---|---|
2438 | ||
2729 | Nit: You could just return this rather than explicitly returning true/false | |
2738 |
| |
2744 | Could pull CandidateVec[0] out into a variable? | |
2749 | Nit | |
2809 | I think this needs a testcase? |