[GlobalISel] Clear unreachable blocks' contents after selection.
authorAmara Emerson <amara@apple.com>
Wed, 6 Oct 2021 00:41:21 +0000 (17:41 -0700)
committerAmara Emerson <amara@apple.com>
Wed, 6 Oct 2021 06:06:22 +0000 (23:06 -0700)
commit6bc64e24c38a42f2797ee64c78cb2d42b245b59e
tree760bda91147aa25ccf7ac7f59833fec71dd22ec2
parentcb89d3739db746ea50eb50b7208e689126394391
[GlobalISel] Clear unreachable blocks' contents after selection.

If these blocks are unreachable, then we can discard all of the instructions.
However, keep the block around because it may have an address taken or the
block may have a stale reference from a PHI somewhere. Instead of finding
those PHIs and fixing them up, just leave the block empty.

Differential Revision: https://reviews.llvm.org/D111201
llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-blockaddress.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-unreachable-blocks.mir [new file with mode: 0644]