Teach the inliner how to preserve musttail invariants
authorReid Kleckner <reid@kleckner.net>
Thu, 15 May 2014 20:11:28 +0000 (20:11 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 15 May 2014 20:11:28 +0000 (20:11 +0000)
commit998c1e0c20a0eb54a53889791efbabc2ee6cffb5
treebbfe938d9ffeb24b3d25d4036448be596b8f4825
parent675e527ab856409294cccc0641ffc7f981fdd5e1
Teach the inliner how to preserve musttail invariants

The interesting case is what happens when you inline a musttail call
through a musttail call site.  In this case, we can't break perfect
forwarding or allow any stack growth.

Instead of merging control flow from the inlined return instruction
after a musttail call into the body of the caller, leave the inlined
return instruction in the caller so that the musttail call stays in the
tail position.

More work is required in http://reviews.llvm.org/D3630 to handle the
case where the inlined function has dynamic allocas or byval arguments.

Reviewers: chandlerc

Differential Revision: http://reviews.llvm.org/D3491

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208910 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/InlineFunction.cpp
test/Transforms/Inline/inline-tail.ll