[InstCombine] Don't rewrite phi-of-bitcast when the phi has other users
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 31 Dec 2019 11:11:35 +0000 (12:11 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 31 Dec 2019 11:15:02 +0000 (12:15 +0100)
commitfb114694e939c0204ac356fc0e830332175cd008
tree94c8bb7755282c3abd561f85fe3c776d409db19f
parentd04e64a25a58f63af862df9fa305723560d5fded
[InstCombine] Don't rewrite phi-of-bitcast when the phi has other users

Judging by the existing comments, this was the intention, but the
transform never actually checked if the existing phi's would be removed.
See https://bugs.llvm.org/show_bug.cgi?id=44242 for an example where
this causes much worse code generation on AMDGPU.

Differential Revision: https://reviews.llvm.org/D71209
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/pr44242.ll