Skip to content

[BasicBlockUtils] Remove broken support for eh pads in SplitEdge() #137816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,6 @@ BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, DominatorTree *DT,
CriticalEdgeSplittingOptions(DT, LI, MSSAU).setPreserveLCSSA();

if ((isCriticalEdge(LatchTerm, SuccNum, Options.MergeIdenticalEdges))) {
// If it is a critical edge, and the succesor is an exception block, handle
// the split edge logic in this specific function
if (Succ->isEHPad())
return ehAwareSplitEdge(BB, Succ, nullptr, nullptr, Options, BBName);

// If this is a critical edge, let SplitKnownCriticalEdge do it.
return SplitKnownCriticalEdge(LatchTerm, SuccNum, Options, BBName);
}
Expand Down
18 changes: 2 additions & 16 deletions llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,8 @@ declare void @sink_alt() cold
EXPECT_TRUE(Ehpad);

BasicBlock *NewBB = SplitEdge(SrcBlock, DestBlock, &DT, &LI, &MSSAU, "");

MSSA.verifyMemorySSA();
EXPECT_TRUE(DT.verify());
EXPECT_NE(NewBB, nullptr);
EXPECT_EQ(NewBB->getSinglePredecessor(), SrcBlock);
EXPECT_EQ(NewBB, SrcBlock->getTerminator()->getSuccessor(SuccNum));
EXPECT_EQ(NewBB->getParent(), F);

bool BBFlag = false;
for (BasicBlock &BB : *F) {
if (BB.getName() == NewBB->getName()) {
BBFlag = true;
break;
}
}
EXPECT_TRUE(BBFlag);
// SplitEdge cannot split an eh pad edge.
EXPECT_EQ(NewBB, nullptr);
}

TEST(BasicBlockUtils, splitBasicBlockBefore_ex1) {
Expand Down