This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: allow a `musttail` call to be followed by `unreachable`
Needs ReviewPublic

Authored by t.p.northover on Jun 27 2022, 2:34 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

If the function being called is noreturn it's functionally correct to have a tail call followed by unreachable. It appears to be avoided for normal tail calls for performance reasons, but it's allowed in other guaranteed TCO cases, so I don't think there's any reason to restrict musttail.

Diff Detail

Unit TestsFailed

Event Timeline

t.p.northover created this revision.Jun 27 2022, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2022, 2:34 AM
t.p.northover requested review of this revision.Jun 27 2022, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2022, 2:34 AM

Missing LangRef update.

It's hard for me to imagine this significantly helps optimizations, but I don't think it will cause any problems.