mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILOptimizer: fix a compile time problem in the inliner
When inlining many functions in a very large basic block, the splitting of the block at the call sites is quadratic, when traversing in forward order. Traversing backwards, fixes the problem. rdar://problem/56268570
This commit is contained in:
@@ -915,7 +915,9 @@ bool SILPerformanceInliner::inlineCallsIntoFunction(SILFunction *Caller) {
|
||||
return false;
|
||||
|
||||
// Second step: do the actual inlining.
|
||||
for (auto AI : AppliesToInline) {
|
||||
// We inline in reverse order, because for very large blocks with many applies
|
||||
// to inline, splitting the block at every apply would be quadratic.
|
||||
for (auto AI : llvm::reverse(AppliesToInline)) {
|
||||
SILFunction *Callee = AI.getReferencedFunctionOrNull();
|
||||
assert(Callee && "apply_inst does not have a direct callee anymore");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user