@@ -1121,15 +1121,28 @@ extension LifetimeDependenceDefUseWalker {
11211121 if apply. isCallee ( operand: operand) {
11221122 return leafUse ( of: operand)
11231123 }
1124+ // Find any copied dependence on this source operand, either targeting the result or an inout parameter. If the
1125+ // lifetime dependence is scoped, then we can ignore it because a mark_dependence [nonescaping] represents the
1126+ // dependence.
1127+ for targetOperand in apply. argumentOperands {
1128+ guard !targetOperand. value. isEscapable else {
1129+ continue
1130+ }
1131+ if let dep = apply. parameterDependence ( target: targetOperand, source: operand) ,
1132+ !dep. isScoped {
1133+ let targetAddress = targetOperand. value
1134+ assert ( targetAddress. type. isAddress, " a parameter dependence target must be 'inout' " )
1135+ if dependentUse ( of: operand, dependentAddress: targetAddress) == . abortWalk {
1136+ return . abortWalk
1137+ }
1138+ }
1139+ }
11241140 if let dep = apply. resultDependence ( on: operand) ,
11251141 !dep. isScoped {
11261142 // Operand is nonescapable and passed as a call argument. If the
11271143 // result inherits its lifetime, then consider any nonescapable
11281144 // result value to be a dependent use.
11291145 //
1130- // If the lifetime dependence is scoped, then we can ignore it
1131- // because a mark_dependence [nonescaping] represents the
1132- // dependence.
11331146 if let result = apply. singleDirectResult, !result. isEscapable {
11341147 if dependentUse ( of: operand, dependentValue: result) == . abortWalk {
11351148 return . abortWalk
0 commit comments