Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable"""
authorAmara Emerson <amara@apple.com>
Mon, 4 Oct 2021 23:59:47 +0000 (16:59 -0700)
committerAmara Emerson <amara@apple.com>
Tue, 5 Oct 2021 01:10:28 +0000 (18:10 -0700)
commitc93bc508ee446d17f9d5d59b48d98aef15f22d52
treec4d0d4161165dd7d2e549baaf0e02158f0e8411e
parentc0039de2953d15815448b4b3c3bafb45607781e0
Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable"""

This reverts commit d95cd81141a4e398e0d3337cb2e6617281d06278.

The selector sometimes leaves unreachable blocks unselected because it uses a
postorder traversal for the block ordering.

With the trap intrinsics now being emitted, these blocks are no longer empty and
the unselected G_INTRINSIC instructions survive past selection. To fix this,
keep track of which blocks are selected and later delete any blocks that weren't
selected.
llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-unreachable.ll [new file with mode: 0644]