[InstCombine] Don't combine PHI before catchswitch
authorHeejin Ahn <aheejin@gmail.com>
Thu, 1 Jul 2021 19:22:41 +0000 (12:22 -0700)
committerHeejin Ahn <aheejin@gmail.com>
Fri, 2 Jul 2021 19:10:24 +0000 (12:10 -0700)
commit51fecd17bbe04ccf1551132b5fffac43139c7af8
tree4e6f09da7cfa6a287b1800e96274d18636b9de1c
parent35d4593e6b555f852088211f5561c0e360c98c91
[InstCombine] Don't combine PHI before catchswitch

This tries to bail out if the PHI is in a `catchswitch` BB in
InstCombine. A PHI cannot be combined into a non-PHI instruction if it
is in a `catchswitch` BB, because `catchswitch` BB cannot have any
non-PHI instruction other than `catchswitch` itself.

The given test case started crashing after D98058.

Reviewed By: lebedev.ri, rnk

Differential Revision: https://reviews.llvm.org/D105309
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/test/Transforms/InstCombine/catchswitch-phi.ll [new file with mode: 0644]