Skip to content

Commit ec237da

Browse files
Merge pull request #65124 from nate-chandler/cherrypick/release/5.9/rdar107963619
5.9: [AccessSummaryAnalysis] Look through moves in hasExpectedUsesOfNoEscapePartialApply.
2 parents b28bc8f + c619d49 commit ec237da

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/SILOptimizer/Analysis/AccessSummaryAnalysis.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ static bool hasExpectedUsesOfNoEscapePartialApply(Operand *partialApplyUse) {
215215
return llvm::all_of(cast<CopyValueInst>(user)->getUses(),
216216
hasExpectedUsesOfNoEscapePartialApply);
217217

218+
case SILInstructionKind::MoveValueInst:
219+
return llvm::all_of(cast<MoveValueInst>(user)->getUses(),
220+
hasExpectedUsesOfNoEscapePartialApply);
221+
218222
case SILInstructionKind::IsEscapingClosureInst:
219223
case SILInstructionKind::StoreInst:
220224
case SILInstructionKind::DestroyValueInst:

test/SILOptimizer/access_summary_analysis.sil

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,22 @@ bb0(%0 : $*Int, %1 : $*Int, %2 : $*Int):
485485
return %9999 : $()
486486
}
487487

488+
// Look through moves.
489+
// CHECK-LABEL: @partialApplyFollowedByConvertFunctionWithMove
490+
// CHECK-NEXT: ([modify], [], [read])
491+
sil private [ossa] @partialApplyFollowedByConvertFunctionWithMove : $@convention(thin) (@inout_aliasable Int, @inout_aliasable Int, @inout_aliasable Int) -> () {
492+
bb0(%0 : $*Int, %1 : $*Int, %2 : $*Int):
493+
%3 = function_ref @hasThreeCapturesAndTakesArgument : $@convention(thin) (Int, @inout_aliasable Int, @inout_aliasable Int, @inout_aliasable Int) -> ()
494+
%4 = partial_apply %3(%0, %1, %2) : $@convention(thin) (Int, @inout_aliasable Int, @inout_aliasable Int, @inout_aliasable Int) -> ()
495+
%5 = convert_function %4 : $@callee_owned (Int) -> () to $@callee_owned (Int) -> @error Error
496+
%6 = move_value %5 : $@callee_owned (Int) -> @error Error
497+
%7 = function_ref @takesGuaranteedNoEscapeClosureTakingArgumentThrowing : $@convention(thin) (@guaranteed @callee_owned (Int) -> @error Error) -> ()
498+
%8 = apply %7(%6) : $@convention(thin) (@guaranteed @callee_owned (Int) -> @error Error) -> ()
499+
destroy_value %6 : $@callee_owned (Int) -> @error Error
500+
%9999 = tuple ()
501+
return %9999 : $()
502+
}
503+
488504
sil @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
489505
sil @subject : $@convention(thin) (Builtin.Int64) -> ()
490506

0 commit comments

Comments
 (0)