diff options
author | Haohai Wen <haohai.wen@intel.com> | 2024-01-18 23:26:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 23:26:22 +0800 |
commit | fb2c6bbf42b09c0d3d31df7cac3f5a6cc2ee929e (patch) | |
tree | 9ae1e72d0fccecf0c12a490004bca59d9cefd81c /llvm/lib/CodeGen/BranchFolding.cpp | |
parent | 819bd9e39b8c255600b7ec13ac195f726aa9a082 (diff) | |
download | llvm-fb2c6bbf42b09c0d3d31df7cac3f5a6cc2ee929e.zip llvm-fb2c6bbf42b09c0d3d31df7cac3f5a6cc2ee929e.tar.gz llvm-fb2c6bbf42b09c0d3d31df7cac3f5a6cc2ee929e.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 599b7c7..a9f7835 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1411,7 +1411,7 @@ ReoptimizeBlock: // This has to check PrevBB->succ_size() because EH edges are ignored by // analyzeBranch. if (PriorCond.empty() && !PriorTBB && MBB->pred_size() == 1 && - PrevBB.succ_size() == 1 && + PrevBB.succ_size() == 1 && PrevBB.isSuccessor(MBB) && !MBB->hasAddressTaken() && !MBB->isEHPad()) { LLVM_DEBUG(dbgs() << "\nMerging into block: " << PrevBB << "From MBB: " << *MBB); |