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 {
1053
1053
if let conv = apply. convention ( of: operand) , conv. isIndirectOut {
1054
1054
return leafUse ( of: operand)
1055
1055
}
1056
-
1057
1056
if apply. isCallee ( operand: operand) {
1058
1057
return leafUse ( of: operand)
1059
1058
}
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.
1060
1082
if apply is BeginApplyInst {
1061
1083
return scopedAddressUse ( of: operand)
1062
1084
}
You can’t perform that action at this time.
0 commit comments