File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,9 @@ void SILInlineCloner::cloneInline(ArrayRef<SILValue> AppliedArgs) {
500500 if (!enableLexicalLifetimes)
501501 continue ;
502502
503+ if (!Original.isDeinitBarrier ())
504+ continue ;
505+
503506 // Exclusive mutating accesses don't entail a lexical scope.
504507 if (paramInfo.getConvention () == ParameterConvention::Indirect_Inout)
505508 continue ;
Original file line number Diff line number Diff line change @@ -619,6 +619,41 @@ bb3:
619619 return %9999 : $()
620620}
621621
622+ sil [transparent] [ossa] @deinit_barrier : $@convention(thin) (@in_guaranteed Int) -> () {
623+ [global: deinit_barrier]
624+ bb0(%0 : $*Int):
625+ %1 = tuple ()
626+ return %1
627+ }
628+
629+ sil [transparent] [ossa] @no_deinit_barrier : $@convention(thin) (@in_guaranteed Int) -> () {
630+ [global: ]
631+ bb0(%0 : $*Int):
632+ %1 = tuple ()
633+ return %1
634+ }
635+
636+ // CHECK-LABEL: sil [ossa] @inline_deinit_barrier :
637+ // CHECK: alloc_stack [lexical] $Int
638+ // CHECK: alloc_stack $Int
639+ // CHECK: } // end sil function 'inline_deinit_barrier'
640+ sil [ossa] @inline_deinit_barrier : $@convention(thin) (Int) -> () {
641+ bb0(%0 : $Int):
642+ %1 = alloc_stack $Int
643+ store %0 to [trivial] %1
644+ %2 = function_ref @deinit_barrier : $@convention(thin) (@in_guaranteed Int) -> ()
645+ apply %2(%1) : $@convention(thin) (@in_guaranteed Int) -> ()
646+ dealloc_stack %1
647+
648+ %10 = alloc_stack $Int
649+ store %0 to [trivial] %10
650+ %12 = function_ref @no_deinit_barrier : $@convention(thin) (@in_guaranteed Int) -> ()
651+ apply %12(%10) : $@convention(thin) (@in_guaranteed Int) -> ()
652+ dealloc_stack %10
653+
654+ %r = tuple ()
655+ return %r
656+ }
622657
623658sil_vtable C2 {
624659 #C2.i!modify: (C2) -> () -> () : @devirt_callee
You can’t perform that action at this time.
0 commit comments