Skip to content

Commit 11097c4

Browse files
committed
Avoid inserting lexical scope for arguments of borrow accessors while inlining
1 parent 58957c3 commit 11097c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,12 @@ Scope scopeForArgument(Scope nonlexicalScope, SILValue callArg, unsigned index,
767767
// the argument. Just do an ownership conversion if needed.
768768
return nonlexicalScope;
769769
}
770+
771+
// Use non-lexical scope for functions returning @guaranteed results.
772+
if (callee->getConventions().hasGuaranteedResult()) {
773+
return nonlexicalScope;
774+
}
775+
770776
// Lexical lifetimes are enabled, the function argument's lifetime is
771777
// lexical, but the caller's value is not lexical. Extra care is required to
772778
// maintain the function argument's lifetime. We need to add a lexical

0 commit comments

Comments
 (0)