Skip to content

Commit 4121b43

Browse files
committed
Move the closure specializer to using the new function orderer.
Replace the call graph bottom-up functionality with the new function orderer.
1 parent 3c7d802 commit 4121b43

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/SILPasses/IPO/ClosureSpecializer.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
#include "swift/SIL/SILFunction.h"
6262
#include "swift/SIL/SILInstruction.h"
6363
#include "swift/SIL/SILModule.h"
64-
#include "swift/SILAnalysis/CallGraphAnalysis.h"
65-
#include "swift/SILAnalysis/ValueTracking.h"
64+
#include "swift/SILAnalysis/BasicCalleeAnalysis.h"
6665
#include "swift/SILAnalysis/CFG.h"
66+
#include "swift/SILAnalysis/FunctionOrder.h"
67+
#include "swift/SILAnalysis/ValueTracking.h"
6768
#include "swift/SILPasses/Transforms.h"
6869
#include "swift/SILPasses/Utils/SILInliner.h"
6970
#include "llvm/ADT/Statistic.h"
@@ -841,16 +842,17 @@ class SILClosureSpecializerTransform : public SILModuleTransform {
841842
SILClosureSpecializerTransform() {}
842843

843844
void run() override {
844-
auto *CGA = getAnalysis<CallGraphAnalysis>();
845+
auto *BCA = getAnalysis<BasicCalleeAnalysis>();
845846

846847
bool Changed = false;
847848
ClosureSpecializer C;
848849

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);
852851

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.
854856
if (!F->shouldOptimize())
855857
return;
856858

0 commit comments

Comments
 (0)