File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
lib/SILOptimizer/Analysis Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,26 @@ void BottomUpFunctionOrder::DFS(SILFunction *Start) {
39
39
// Visit all the instructions, looking for apply sites.
40
40
for (auto &B : *Start) {
41
41
for (auto &I : B) {
42
- auto FAS = FullApplySite::isa (&I);
43
- if (!FAS && !isa<StrongReleaseInst>(&I) && !isa<ReleaseValueInst>(&I) &&
44
- !isa<DestroyValueInst>(&I))
42
+ CalleeList callees;
43
+ if (auto FAS = FullApplySite::isa (&I)) {
44
+ callees = BCA->getCalleeList (FAS);
45
+ } else if (isa<StrongReleaseInst>(&I) || isa<ReleaseValueInst>(&I) ||
46
+ isa<DestroyValueInst>(&I)) {
47
+ callees = BCA->getDestructors (I.getOperand (0 )->getType (), /* isExactType*/ false );
48
+ } else if (auto *bi = dyn_cast<BuiltinInst>(&I)) {
49
+ switch (bi->getBuiltinInfo ().ID ) {
50
+ case BuiltinValueKind::Once:
51
+ case BuiltinValueKind::OnceWithContext:
52
+ callees = BCA->getCalleeListOfValue (bi->getArguments ()[1 ]);
53
+ break ;
54
+ default :
55
+ continue ;
56
+ }
57
+ } else {
45
58
continue ;
59
+ }
46
60
47
- auto Callees = FAS ? BCA->getCalleeList (FAS)
48
- : BCA->getDestructors (I.getOperand (0 )->getType (),
49
- /* isExactType*/ false );
50
- for (auto *CalleeFn : Callees) {
61
+ for (auto *CalleeFn : callees) {
51
62
// If not yet visited, visit the callee.
52
63
if (DFSNum.find (CalleeFn) == DFSNum.end ()) {
53
64
DFS (CalleeFn);
You can’t perform that action at this time.
0 commit comments