File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,8 @@ bool SimplifyCFG::threadEdge(const ThreadInfo &ti) {
302
302
return false ;
303
303
304
304
Cloner.cloneBranchTarget (SrcTerm);
305
+ JumpThreadingCost[Cloner.getNewBB ()] = JumpThreadingCost[SrcTerm->getDestBB ()];
306
+
305
307
306
308
// We have copied the threaded block into the edge.
307
309
auto *clonedSrc = Cloner.getNewBB ();
@@ -1112,6 +1114,10 @@ bool SimplifyCFG::tryJumpThreading(BranchInst *BI) {
1112
1114
Cloner.cloneBranchTarget (BI);
1113
1115
Cloner.updateSSAAfterCloning ();
1114
1116
1117
+ // Also account the costs to the cloned DestBB, so the jump threading cannot
1118
+ // loop by cloning the cloned block again.
1119
+ JumpThreadingCost[Cloner.getNewBB ()] += copyCosts;
1120
+
1115
1121
// Once all the instructions are copied, we can nuke BI itself. We also add
1116
1122
// the threaded and edge block to the worklist now that they (likely) can be
1117
1123
// simplified.
@@ -2852,6 +2858,8 @@ bool SimplifyCFG::tailDuplicateObjCMethodCallSuccessorBlocks() {
2852
2858
Cloner.cloneBranchTarget (Branch);
2853
2859
Cloner.updateSSAAfterCloning ();
2854
2860
2861
+ JumpThreadingCost[Cloner.getNewBB ()] = JumpThreadingCost[DestBB];
2862
+
2855
2863
Changed = true ;
2856
2864
// Simplify the cloned block and continue tail duplicating through its new
2857
2865
// successors edges.
You can’t perform that action at this time.
0 commit comments