File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
SwiftCompilerSources/Sources/Optimizer/Utilities Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -1053,10 +1053,32 @@ extension LifetimeDependenceDefUseWalker {
10531053 if let conv = apply. convention ( of: operand) , conv. isIndirectOut {
10541054 return leafUse ( of: operand)
10551055 }
1056-
10571056 if apply. isCallee ( operand: operand) {
10581057 return leafUse ( of: operand)
10591058 }
1059+ if let dep = apply. resultDependence ( on: operand) ,
1060+ dep == . inherit {
1061+ // Operand is nonescapable and passed as a call argument. If the
1062+ // result inherits its lifetime, then consider any nonescapable
1063+ // result value to be a dependent use.
1064+ //
1065+ // If the lifetime dependence is scoped, then we can ignore it
1066+ // because a mark_dependence [nonescaping] represents the
1067+ // dependence.
1068+ if let result = apply. singleDirectResult, !result. type. isEscapable {
1069+ if dependentUse ( of: operand, into: result) == . abortWalk {
1070+ return . abortWalk
1071+ }
1072+ }
1073+ for resultAddr in apply. indirectResultOperands
1074+ where !resultAddr. value. type. isEscapable {
1075+ if visitStoredUses ( of: operand, into: resultAddr. value) == . abortWalk {
1076+ return . abortWalk
1077+ }
1078+ }
1079+ }
1080+ // Regardless of lifetime dependencies, consider the operand to be
1081+ // use for the duration of the call.
10601082 if apply is BeginApplyInst {
10611083 return scopedAddressUse ( of: operand)
10621084 }
You can’t perform that action at this time.
0 commit comments