@@ -86,7 +86,6 @@ class CheckedCastBrJumpThreading {
86
86
SuccessArg (SuccessArg), InvertSuccess(InvertSuccess),
87
87
hasUnknownPreds (hasUnknownPreds) { }
88
88
89
- void modifyCFGForUnknownPreds ();
90
89
void modifyCFGForFailurePreds (BasicBlockCloner &Cloner);
91
90
void modifyCFGForSuccessPreds (BasicBlockCloner &Cloner);
92
91
};
@@ -223,24 +222,6 @@ SILValue CheckedCastBrJumpThreading::isArgValueEquivalentToCondition(
223
222
}
224
223
}
225
224
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
-
244
225
// / Create a copy of the BB as a landing BB
245
226
// / for all FailurePreds.
246
227
void CheckedCastBrJumpThreading::Edit::modifyCFGForFailurePreds (
@@ -687,8 +668,6 @@ void CheckedCastBrJumpThreading::optimizeFunction() {
687
668
// Create a copy of the BB or reuse BB as
688
669
// a landing basic block for all SuccessPreds.
689
670
edit->modifyCFGForSuccessPreds (Cloner);
690
- // Handle unknown preds.
691
- edit->modifyCFGForUnknownPreds ();
692
671
693
672
if (Cloner.wasCloned ()) {
694
673
Cloner.updateSSAAfterCloning ();
0 commit comments