[CallSiteSplitting] properly split musttail calls
authorFedor Indutny <fedor@indutny.com>
Sat, 3 Mar 2018 21:40:14 +0000 (21:40 +0000)
committerFedor Indutny <fedor@indutny.com>
Sat, 3 Mar 2018 21:40:14 +0000 (21:40 +0000)
commitf9e09c1dd06c3d277b16ce9e3e06c6882bc26efd
tree716ac15c418e9faa39be264daae0cb5eb11e3878
parent1a3901c69fdd34ad979e6c1e65dfd05fe3c34826
[CallSiteSplitting] properly split musttail calls

Summary:
`musttail` calls can't be naively splitted. The split blocks must
include not only the call instruction itself, but also (optional)
`bitcast` and `return` instructions that follow it.

Clone `bitcast` and `ret`, place them into the split blocks, and
remove the tail block when done.

Reviewers: junbuml, mcrosier, davidxl, davide, fhahn

Reviewed By: fhahn

Subscribers: JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D43729

llvm-svn: 326666
llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
llvm/test/Transforms/CallSiteSplitting/musttail.ll [new file with mode: 0644]