|
12 | 12 |
|
13 | 13 | #define DEBUG_TYPE "sil-escape"
|
14 | 14 | #include "swift/SILAnalysis/EscapeAnalysis.h"
|
| 15 | +#include "swift/SILAnalysis/BasicCalleeAnalysis.h" |
15 | 16 | #include "swift/SILAnalysis/CallGraphAnalysis.h"
|
16 | 17 | #include "swift/SILAnalysis/ArraySemantic.h"
|
17 | 18 | #include "swift/SILPasses/PassManager.h"
|
@@ -834,6 +835,7 @@ EscapeAnalysis::EscapeAnalysis(SILModule *M) :
|
834 | 835 |
|
835 | 836 |
|
836 | 837 | void EscapeAnalysis::initialize(SILPassManager *PM) {
|
| 838 | + BCA = PM->getAnalysis<BasicCalleeAnalysis>(); |
837 | 839 | CGA = PM->getAnalysis<CallGraphAnalysis>();
|
838 | 840 | }
|
839 | 841 |
|
@@ -975,13 +977,11 @@ void EscapeAnalysis::buildConnectionGraphs(FunctionInfo *FInfo) {
|
975 | 977 | FInfo->Valid = true;
|
976 | 978 | }
|
977 | 979 |
|
978 |
| -/// Returns true if all called functions from an apply site are known and not |
979 |
| -/// external. |
980 |
| -static bool allCalleeFunctionsVisible(FullApplySite FAS, CallGraph &CG) { |
981 |
| - if (CG.canCallUnknownFunction(FAS.getInstruction())) |
| 980 | +bool EscapeAnalysis::allCalleeFunctionsVisible(FullApplySite FAS) { |
| 981 | + auto Callees = BCA->getCalleeList(FAS); |
| 982 | + if (Callees.isIncomplete()) |
982 | 983 | return false;
|
983 | 984 |
|
984 |
| - auto Callees = CG.getCallees(FAS.getInstruction()); |
985 | 985 | for (SILFunction *Callee : Callees) {
|
986 | 986 | if (Callee->isExternalDeclaration())
|
987 | 987 | return false;
|
@@ -1047,7 +1047,7 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I,
|
1047 | 1047 | break;
|
1048 | 1048 | }
|
1049 | 1049 |
|
1050 |
| - if (allCalleeFunctionsVisible(FAS, CGA->getCallGraph())) { |
| 1050 | + if (allCalleeFunctionsVisible(FAS)) { |
1051 | 1051 | // We handle this apply site afterwards by merging the callee graph(s)
|
1052 | 1052 | // into the caller graph.
|
1053 | 1053 | FInfo->KnownCallees.push_back(FAS);
|
|
0 commit comments