Skip to content

Commit fa966ce

Browse files
authored
Merge pull request #35049 from meg-gupta/addtestformandatoryinline
2 parents 5149ff0 + 24c4fb0 commit fa966ce

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/SILOptimizer/mandatory_inlining.sil

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-objc-interop -module-name mandatory_inlining -enable-sil-verify-all %s -mandatory-inlining | %FileCheck %s
1+
// 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
22

33
import Builtin
44
import Swift
@@ -1463,3 +1463,23 @@ bb0(%0 : $*Mystruct, %1 : $Bool):
14631463
return %19 : $()
14641464
}
14651465

1466+
sil [transparent] [ossa] @callee : $@convention(thin) () -> () {
1467+
bb0:
1468+
%r = tuple ()
1469+
return %r : $()
1470+
}
1471+
1472+
// This test needs the guard malloc to crash without the fix in #35037
1473+
// Tests there is no use-after-free in ClosureCleanup::recordDeadFunction when deleting debug instructions
1474+
// CHECK-LABEL : sil [ossa] @$test_no_use_after_free :
1475+
// CHECK-LABEL : } // end sil function '$test_no_use_after_free'
1476+
sil [ossa] @$test_no_use_after_free : $@convention(thin) () -> () {
1477+
bb0:
1478+
%12 = function_ref @callee : $@convention(thin) () -> ()
1479+
%13 = thin_to_thick_function %12 : $@convention(thin) () -> () to $@callee_guaranteed () -> ()
1480+
debug_value %13 : $@callee_guaranteed () -> ()
1481+
%28 = apply %13() : $@callee_guaranteed () -> ()
1482+
%r = tuple ()
1483+
return %r : $()
1484+
}
1485+

0 commit comments

Comments
 (0)