Skip to content

Commit 3e34d78

Browse files
committedNov 11, 2015
Fix a few assertions that were too tight.
Mark is working on a more principal fix.
1 parent 4b847ab commit 3e34d78

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

‎lib/SILPasses/PerformanceInliner.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ static SILFunction *getReferencedFunction(ApplySite Apply) {
545545
bool SILPerformanceInliner::applyTargetsOriginFunction(FullApplySite Apply,
546546
SILFunction *Callee) {
547547
assert(Apply && "Expected non-null apply!");
548-
assert(!RemovedApplies.count(Apply) && "Apply cannot have been removed!");
548+
if (RemovedApplies.count(Apply))
549+
return true;
549550

550551
while (Apply.getFunction() != Callee) {
551552
auto Found = OriginMap.find(Apply);
@@ -868,7 +869,8 @@ FullApplySite SILPerformanceInliner::devirtualizeUpdatingCallGraph(
868869
// from devirtualizing.
869870
assert(NewAI && "Expected to find an apply!");
870871

871-
assert(!OriginMap.count(NewAI) && "Unexpected apply in map!");
872+
assert((!OriginMap.count(NewAI) || RemovedApplies.count(NewAI)) &&
873+
"Unexpected apply in map!");
872874
if (OriginMap.count(Apply))
873875
OriginMap[NewAI] = OriginMap[Apply];
874876
RemovedApplies.insert(Apply);
@@ -934,12 +936,14 @@ ApplySite SILPerformanceInliner::specializeGenericUpdatingCallGraph(
934936

935937
for (auto NewApply : Collector.getInstructionPairs()) {
936938
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!");
938941
OriginMap[Apply] = FullApplySite(NewApply.second);
939942
}
940943
}
941944

942-
assert(!OriginMap.count(SpecializedFullApply) &&
945+
assert((!OriginMap.count(SpecializedFullApply) ||
946+
RemovedApplies.count(SpecializedFullApply)) &&
943947
"Unexpected apply in map!");
944948
if (OriginMap.count(FullApply))
945949
OriginMap[SpecializedFullApply] = OriginMap[FullApply];
@@ -1170,7 +1174,8 @@ bool SILPerformanceInliner::inlineCallsIntoFunction(SILFunction *Caller,
11701174

11711175
// Maintain a mapping for all new applies back to the apply they
11721176
// originated from.
1173-
assert(!OriginMap.count(FullApply) &&
1177+
assert((!OriginMap.count(FullApply) ||
1178+
RemovedApplies.count(FullApply)) &&
11741179
"Did not expect apply to be in map!");
11751180
assert(P.second && "Expected non-null apply site!");
11761181
OriginMap[FullApply] = FullApplySite(P.second);

0 commit comments

Comments
 (0)