Page MenuHomePhabricator

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

TimeTest
60,080 msx64 debian > MLIR.Examples/standalone::test.toy
Script: -- : 'RUN: at line 1'; /usr/bin/cmake /var/lib/buildkite-agent/builds/llvm-project/mlir/examples/standalone -G "Ninja" -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/var/lib/buildkite-agent/builds/llvm-project/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld

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.