|
61 | 61 | #include "swift/SIL/SILFunction.h"
|
62 | 62 | #include "swift/SIL/SILInstruction.h"
|
63 | 63 | #include "swift/SIL/SILModule.h"
|
64 |
| -#include "swift/SILAnalysis/CallGraphAnalysis.h" |
65 |
| -#include "swift/SILAnalysis/ValueTracking.h" |
| 64 | +#include "swift/SILAnalysis/BasicCalleeAnalysis.h" |
66 | 65 | #include "swift/SILAnalysis/CFG.h"
|
| 66 | +#include "swift/SILAnalysis/FunctionOrder.h" |
| 67 | +#include "swift/SILAnalysis/ValueTracking.h" |
67 | 68 | #include "swift/SILPasses/Transforms.h"
|
68 | 69 | #include "swift/SILPasses/Utils/SILInliner.h"
|
69 | 70 | #include "llvm/ADT/Statistic.h"
|
@@ -841,16 +842,17 @@ class SILClosureSpecializerTransform : public SILModuleTransform {
|
841 | 842 | SILClosureSpecializerTransform() {}
|
842 | 843 |
|
843 | 844 | void run() override {
|
844 |
| - auto *CGA = getAnalysis<CallGraphAnalysis>(); |
| 845 | + auto *BCA = getAnalysis<BasicCalleeAnalysis>(); |
845 | 846 |
|
846 | 847 | bool Changed = false;
|
847 | 848 | ClosureSpecializer C;
|
848 | 849 |
|
849 |
| - // Specialize going bottom-up in the call graph. |
850 |
| - auto &CG = CGA->getOrBuildCallGraph(); |
851 |
| - for (auto *F : CG.getBottomUpFunctionOrder()) { |
| 850 | + BottomUpFunctionOrder Ordering(*getModule(), BCA); |
852 | 851 |
|
853 |
| - // Don't optimize functions that are marked with the opt.never attribute. |
| 852 | + // Specialize going bottom-up. |
| 853 | + for (auto *F : Ordering.getFunctionsBottomUp()) { |
| 854 | + // Don't optimize functions that are marked with the opt.never |
| 855 | + // attribute. |
854 | 856 | if (!F->shouldOptimize())
|
855 | 857 | return;
|
856 | 858 |
|
|
0 commit comments