Skip to content

Commit e3df3da

Browse files
committed
AliasAnalysis: fix the complexity limit for ARCSequenceOpts
The comment already says that we need a lower complexity limit for ARCSequenceOpts, but the actual budget was not set correctly to a lower limit.
1 parent aa274a2 commit e3df3da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

SwiftCompilerSources/Sources/Optimizer/Analysis/AliasAnalysis.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct AliasAnalysis {
134134
if let apply = inst as? FullApplySite {
135135
// Workaround for quadratic complexity in ARCSequenceOpts.
136136
// We need to use an ever lower budget to not get into noticeable compile time troubles.
137-
let effect = aa.getOwnershipEffect(of: apply, for: obj, path: path)
137+
let effect = aa.getOwnershipEffect(of: apply, for: obj, path: path, complexityBudget: budget / 10)
138138
return effect.destroy
139139
}
140140
return obj.at(path).isEscaping(using: EscapesToInstructionVisitor(target: inst, isAddress: false),
@@ -421,10 +421,10 @@ struct AliasAnalysis {
421421
}
422422

423423
private func getOwnershipEffect(of apply: FullApplySite, for value: Value,
424-
path: SmallProjectionPath) -> SideEffects.Ownership {
424+
path: SmallProjectionPath,
425+
complexityBudget: Int) -> SideEffects.Ownership {
425426
let visitor = FullApplyEffectsVisitor(apply: apply, calleeAnalysis: context.calleeAnalysis, isAddress: false)
426-
let budget = getComplexityBudget(for: apply.parentFunction)
427-
if let result = value.at(path).visit(using: visitor, complexityBudget: budget, context) {
427+
if let result = value.at(path).visit(using: visitor, complexityBudget: complexityBudget, context) {
428428
// The resulting effects are the argument effects to which `value` escapes to.
429429
return result.ownership
430430
} else {

0 commit comments

Comments
 (0)