@@ -52,11 +52,15 @@ static bool hasRecursiveCallInPath(SILBasicBlock &Block,
52
52
53
53
if (FullApplySite FAI = FullApplySite::isa (&I)) {
54
54
// Don't touch dynamic dispatch.
55
- if (isa<ObjCMethodInst>(FAI.getCallee ()))
55
+ const auto callee = FAI.getCallee ();
56
+ if (isa<SuperMethodInst>(callee) ||
57
+ isa<ObjCSuperMethodInst>(callee) ||
58
+ isa<ObjCMethodInst>(callee)) {
56
59
continue ;
60
+ }
57
61
58
62
auto &M = FAI.getModule ();
59
- if (auto *CMI = dyn_cast<ClassMethodInst>(FAI. getCallee () )) {
63
+ if (auto *CMI = dyn_cast<ClassMethodInst>(callee )) {
60
64
auto ClassType = CMI->getOperand ()->getType ().getASTType ();
61
65
62
66
// FIXME: If we're not inside the module context of the method,
@@ -71,14 +75,26 @@ static bool hasRecursiveCallInPath(SILBasicBlock &Block,
71
75
continue ;
72
76
}
73
77
78
+ if (!calleesAreStaticallyKnowable (FAI.getModule (), CMI->getMember ())) {
79
+ continue ;
80
+ }
81
+
82
+ // The "statically knowable" check just means that we have all the
83
+ // callee candidates available for analysis. We still need to check
84
+ // if the current function has a known override point.
85
+ auto *method = CMI->getMember ().getAbstractFunctionDecl ();
86
+ if (method->isOverridden ()) {
87
+ continue ;
88
+ }
89
+
74
90
auto *F = getTargetClassMethod (M, CD, CMI);
75
91
if (F == Target)
76
92
return true ;
77
93
78
94
continue ;
79
95
}
80
96
81
- if (auto *WMI = dyn_cast<WitnessMethodInst>(FAI. getCallee () )) {
97
+ if (auto *WMI = dyn_cast<WitnessMethodInst>(callee )) {
82
98
SILFunction *F;
83
99
SILWitnessTable *WT;
84
100
0 commit comments