mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user