Skip to content

Add test for #35037 #35049

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
Dec 11, 2020
Merged
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
22 changes: 21 additions & 1 deletion test/SILOptimizer/mandatory_inlining.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-sil-opt -enable-objc-interop -module-name mandatory_inlining -enable-sil-verify-all %s -mandatory-inlining | %FileCheck %s
// RUN: env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib %target-sil-opt -enable-objc-interop -module-name mandatory_inlining -enable-sil-verify-all %s -mandatory-inlining | %FileCheck %s

import Builtin
import Swift
Expand Down Expand Up @@ -1463,3 +1463,23 @@ bb0(%0 : $*Mystruct, %1 : $Bool):
return %19 : $()
}

sil [transparent] [ossa] @callee : $@convention(thin) () -> () {
bb0:
%r = tuple ()
return %r : $()
}

// This test needs the guard malloc to crash without the fix in #35037
// Tests there is no use-after-free in ClosureCleanup::recordDeadFunction when deleting debug instructions
// CHECK-LABEL : sil [ossa] @$test_no_use_after_free :
// CHECK-LABEL : } // end sil function '$test_no_use_after_free'
sil [ossa] @$test_no_use_after_free : $@convention(thin) () -> () {
bb0:
%12 = function_ref @callee : $@convention(thin) () -> ()
%13 = thin_to_thick_function %12 : $@convention(thin) () -> () to $@callee_guaranteed () -> ()
debug_value %13 : $@callee_guaranteed () -> ()
%28 = apply %13() : $@callee_guaranteed () -> ()
%r = tuple ()
return %r : $()
}