@@ -514,9 +514,8 @@ runFunctionPasses(unsigned FromTransIdx, unsigned ToTransIdx) {
514
514
return ;
515
515
516
516
BasicCalleeAnalysis *BCA = getAnalysis<BasicCalleeAnalysis>();
517
- BottomUpFunctionOrder BottomUpOrder (BCA);
518
- BottomUpOrder.computeBottomUpOrder (Mod);
519
- auto BottomUpFunctions = BottomUpOrder.getBottomUpOrder ();
517
+ BottomUpFunctionOrder BottomUpOrder (*Mod, BCA);
518
+ auto BottomUpFunctions = BottomUpOrder.getFunctions ();
520
519
521
520
assert (FunctionWorklist.empty () && " Expected empty function worklist!" );
522
521
@@ -569,47 +568,6 @@ runFunctionPasses(unsigned FromTransIdx, unsigned ToTransIdx) {
569
568
++Entry.PipelineIdx ;
570
569
}
571
570
clearRestartPipeline ();
572
-
573
- if (TailIdx == (FunctionWorklist.size () - 1 )) {
574
- // No new functions to process
575
- continue ;
576
- }
577
-
578
- // Compute the bottom up order of the new functions and the callees in it
579
- BottomUpFunctionOrder SubBottomUpOrder (BCA);
580
- // Initialize BottomUpFunctionOrder with new functions
581
- for (auto It = FunctionWorklist.begin () + TailIdx + 1 ;
582
- It != FunctionWorklist.end (); It++) {
583
- SubBottomUpOrder.computeBottomUpOrder (It->F );
584
- }
585
- auto NewFunctionsBottomUp = SubBottomUpOrder.getBottomUpOrder ();
586
- SmallPtrSet<SILFunction *, 8 > NewBottomUpSet (NewFunctionsBottomUp.begin (),
587
- NewFunctionsBottomUp.end ());
588
-
589
- // Remove all the functions in the new bottom up order from FunctionWorklist
590
- llvm::DenseMap<SILFunction *, WorklistEntry> FunctionsToReorder;
591
- auto RemoveFn = [&FunctionsToReorder,
592
- &NewBottomUpSet](WorklistEntry Entry) {
593
- if (NewBottomUpSet.find (Entry.F ) == NewBottomUpSet.end ()) {
594
- return false ;
595
- }
596
- FunctionsToReorder.insert (std::make_pair (Entry.F , Entry));
597
- return true ;
598
- };
599
- std::remove_if (FunctionWorklist.begin (), FunctionWorklist.end (), RemoveFn);
600
- FunctionWorklist.erase ((FunctionWorklist.begin () + FunctionWorklist.size () -
601
- FunctionsToReorder.size ()),
602
- FunctionWorklist.end ());
603
-
604
- // Add back the functions in the new bottom up order to the FunctionWorklist
605
- for (auto it = NewFunctionsBottomUp.rbegin ();
606
- it != NewFunctionsBottomUp.rend (); it++) {
607
- auto Entry = FunctionsToReorder.find (*it);
608
- if (Entry == FunctionsToReorder.end ()) {
609
- continue ;
610
- }
611
- FunctionWorklist.push_back ((*Entry).second );
612
- }
613
571
}
614
572
}
615
573
0 commit comments