Re-instate: "SILPassManager: After a new function is pushed on the stack don't restart the pipeline on the old function."

This re-instates commit de9622654d

The problem of the infinite loop should be fixed by the previous fix in FunctionSignatureOpts.
In addition this new commit implements a safety check to void such cases, even if buggy optimizations try to keep pushing new functions onto the work list.
This commit is contained in:
Erik Eckstein
2016-08-19 11:29:04 -07:00
parent 759a05ee25
commit a75a7f25f9
9 changed files with 178 additions and 184 deletions

View File

@@ -82,6 +82,8 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) {
auto *I = Applies.pop_back_val();
auto Apply = ApplySite::isa(I);
assert(Apply && "Expected an apply!");
SILFunction *Callee = Apply.getReferencedFunction();
assert(Callee && "Expected to have a known callee");
// We have a call that can potentially be specialized, so
// attempt to do so.
@@ -106,7 +108,7 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) {
// (as opposed to returning a previous specialization), we need to notify
// the pass manager so that the new functions get optimized.
for (SILFunction *NewF : reverse(NewFunctions)) {
notifyPassManagerOfFunction(NewF);
notifyPassManagerOfFunction(NewF, Callee);
}
}
}