[BranchFolding] Use isSuccessor to confirm fall through (#77923)
commitfb2c6bbf42b09c0d3d31df7cac3f5a6cc2ee929e
authorHaohai Wen <haohai.wen@intel.com>
Thu, 18 Jan 2024 15:26:22 +0000 (18 23:26 +0800)
committerGitHub <noreply@github.com>
Thu, 18 Jan 2024 15:26:22 +0000 (18 23:26 +0800)
tree9ae1e72d0fccecf0c12a490004bca59d9cefd81c
parent819bd9e39b8c255600b7ec13ac195f726aa9a082
[BranchFolding] Use isSuccessor to confirm fall through (#77923)

When merging blocks, if the previous block has no any branch instruction
and has one successor, the successor may be SEH landing pad and the
block will always raise exception and nerver fall through to next block.
We can not merge them in such case. isSuccessor should be used to
confirm it can fall through to next block.
llvm/lib/CodeGen/BranchFolding.cpp
llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir