[LoopSimplifyCFG] Don't delete LCSSA Phis
authorMax Kazantsev <max.kazantsev@azul.com>
Fri, 23 Nov 2018 07:56:47 +0000 (07:56 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Fri, 23 Nov 2018 07:56:47 +0000 (07:56 +0000)
commitcb8e24033472088c401721b77c9542ce55e533a2
treeaa1fa4ad5f5f59d25d975f614aec3ca6d2550a21
parenta10c1c7412af9b40c984d4960a07d4190526bea0
[LoopSimplifyCFG] Don't delete LCSSA Phis

When removing edges, we also update Phi inputs and may end up removing
a Phi if it has only one input. We should not do it for edges that leave the current
loop because these Phis are LCSSA Phis and need to be preserved.

Thanks @dmgreen for finding this!

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

llvm-svn: 347484
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/test/Transforms/LoopSimplifyCFG/lcssa.ll [new file with mode: 0644]