[IPSCCP] do not break musttail invariant (PR36485)
authorReid Kleckner <rnk@google.com>
Thu, 1 Mar 2018 01:19:18 +0000 (01:19 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 1 Mar 2018 01:19:18 +0000 (01:19 +0000)
commit3762a089d7411665bbc619466d20f5d25e40b02c
treede008788bca1994a8d8ea28763817f2dafb0d03e
parentdc32dc1770d0cc3efec93dac1a9695acde02699e
[IPSCCP] do not break musttail invariant (PR36485)

Do not replace results of `musttail` calls with a constant if the
call itself can't be removed.

Do not zap returns of `musttail` callees, if the call site can't be
removed and replaced with a constant.

Do not zap returns of `musttail`-calling blocks, this breaks
invariant too.

Patch by Fedor Indutny

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

llvm-svn: 326404
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/test/Transforms/IPConstantProp/musttail-call.ll [new file with mode: 0644]