Skip to content

Commit 1f1123f

Browse files
authored
Merge pull request #35553 from atrick/fix-jumpthread-classmethod
Remove CheckedCastBrJumpThreading::Edit::modifyCFGForUnknownPreds
2 parents a72fcef + 6eb574b commit 1f1123f

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

lib/SILOptimizer/Utils/CheckedCastBrJumpThreading.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class CheckedCastBrJumpThreading {
8686
SuccessArg(SuccessArg), InvertSuccess(InvertSuccess),
8787
hasUnknownPreds(hasUnknownPreds) { }
8888

89-
void modifyCFGForUnknownPreds();
9089
void modifyCFGForFailurePreds(BasicBlockCloner &Cloner);
9190
void modifyCFGForSuccessPreds(BasicBlockCloner &Cloner);
9291
};
@@ -223,24 +222,6 @@ SILValue CheckedCastBrJumpThreading::isArgValueEquivalentToCondition(
223222
}
224223
}
225224

226-
void CheckedCastBrJumpThreading::Edit::modifyCFGForUnknownPreds() {
227-
if (!hasUnknownPreds)
228-
return;
229-
// Check the FailureBB if it is a BB that contains a class_method
230-
// referring to the same value as a condition. This pattern is typical
231-
// for method chaining code like obj.method1().method2().etc()
232-
auto *CCBI = cast<CheckedCastBranchInst>(CCBBlock->getTerminator());
233-
SILInstruction *Inst = &*CCBI->getFailureBB()->begin();
234-
if (auto *CMI = dyn_cast<ClassMethodInst>(Inst)) {
235-
if (CMI->getOperand() == stripClassCasts(CCBI->getOperand())) {
236-
// Replace checked_cast_br by branch to FailureBB.
237-
SILBuilderWithScope(CCBI).createBranch(CCBI->getLoc(),
238-
CCBI->getFailureBB());
239-
CCBI->eraseFromParent();
240-
}
241-
}
242-
}
243-
244225
/// Create a copy of the BB as a landing BB
245226
/// for all FailurePreds.
246227
void CheckedCastBrJumpThreading::Edit::modifyCFGForFailurePreds(
@@ -687,8 +668,6 @@ void CheckedCastBrJumpThreading::optimizeFunction() {
687668
// Create a copy of the BB or reuse BB as
688669
// a landing basic block for all SuccessPreds.
689670
edit->modifyCFGForSuccessPreds(Cloner);
690-
// Handle unknown preds.
691-
edit->modifyCFGForUnknownPreds();
692671

693672
if (Cloner.wasCloned()) {
694673
Cloner.updateSSAAfterCloning();

0 commit comments

Comments
 (0)