Skip to content

Handle end_lifetime in SILInstruction::mayRelease #38841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/SIL/IR/SILInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ bool SILInstruction::mayRelease() const {
default:
llvm_unreachable("Unhandled releasing instruction!");

case SILInstructionKind::EndLifetimeInst:
case SILInstructionKind::GetAsyncContinuationInst:
case SILInstructionKind::GetAsyncContinuationAddrInst:
case SILInstructionKind::AwaitAsyncContinuationInst:
Expand Down
15 changes: 15 additions & 0 deletions test/SILOptimizer/access_enforcement_opts_ossa.sil
Original file line number Diff line number Diff line change
Expand Up @@ -1817,3 +1817,18 @@ bb0(%0 : @guaranteed $Klass, %1 : $*Int64):
return %14 : $Builtin.NativeObject
}

class Bar {
func foo()
}

sil [ossa] @$testEndLifetime : $@convention(method) (@owned Bar, @in Bar) -> () {
bb0(%0 : @owned $Bar, %1 : $*Bar):
%b = begin_access [modify] [dynamic] %1 : $*Bar
end_access %b : $*Bar
%f = objc_method %0 : $Bar, #Bar.foo!foreign : (Bar) -> () -> (), $@convention(objc_method) (Bar) -> ()
%c = apply %f(%0) : $@convention(objc_method) (Bar) -> ()
end_lifetime %0 : $Bar
destroy_addr %1 : $*Bar
%r = tuple ()
return %r : $()
}