@@ -545,7 +545,8 @@ static SILFunction *getReferencedFunction(ApplySite Apply) {
545
545
bool SILPerformanceInliner::applyTargetsOriginFunction (FullApplySite Apply,
546
546
SILFunction *Callee) {
547
547
assert (Apply && " Expected non-null apply!" );
548
- assert (!RemovedApplies.count (Apply) && " Apply cannot have been removed!" );
548
+ if (RemovedApplies.count (Apply))
549
+ return true ;
549
550
550
551
while (Apply.getFunction () != Callee) {
551
552
auto Found = OriginMap.find (Apply);
@@ -868,7 +869,8 @@ FullApplySite SILPerformanceInliner::devirtualizeUpdatingCallGraph(
868
869
// from devirtualizing.
869
870
assert (NewAI && " Expected to find an apply!" );
870
871
871
- assert (!OriginMap.count (NewAI) && " Unexpected apply in map!" );
872
+ assert ((!OriginMap.count (NewAI) || RemovedApplies.count (NewAI)) &&
873
+ " Unexpected apply in map!" );
872
874
if (OriginMap.count (Apply))
873
875
OriginMap[NewAI] = OriginMap[Apply];
874
876
RemovedApplies.insert (Apply);
@@ -934,12 +936,14 @@ ApplySite SILPerformanceInliner::specializeGenericUpdatingCallGraph(
934
936
935
937
for (auto NewApply : Collector.getInstructionPairs ()) {
936
938
if (auto Apply = FullApplySite::isa (NewApply.first )) {
937
- assert (!OriginMap.count (Apply) && " Unexpected apply in map!" );
939
+ assert ((!OriginMap.count (Apply) || RemovedApplies.count (Apply)) &&
940
+ " Unexpected apply in map!" );
938
941
OriginMap[Apply] = FullApplySite (NewApply.second );
939
942
}
940
943
}
941
944
942
- assert (!OriginMap.count (SpecializedFullApply) &&
945
+ assert ((!OriginMap.count (SpecializedFullApply) ||
946
+ RemovedApplies.count (SpecializedFullApply)) &&
943
947
" Unexpected apply in map!" );
944
948
if (OriginMap.count (FullApply))
945
949
OriginMap[SpecializedFullApply] = OriginMap[FullApply];
@@ -1170,7 +1174,8 @@ bool SILPerformanceInliner::inlineCallsIntoFunction(SILFunction *Caller,
1170
1174
1171
1175
// Maintain a mapping for all new applies back to the apply they
1172
1176
// originated from.
1173
- assert (!OriginMap.count (FullApply) &&
1177
+ assert ((!OriginMap.count (FullApply) ||
1178
+ RemovedApplies.count (FullApply)) &&
1174
1179
" Did not expect apply to be in map!" );
1175
1180
assert (P.second && " Expected non-null apply site!" );
1176
1181
OriginMap[FullApply] = FullApplySite (P.second );
0 commit comments