File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 1
- // RUN: %target-sil-opt -sil-print-types -update-borrowed-from -copy-propagation -canonical-ossa-rewrite-borrows -enable-sil-verify-all %s | %FileCheck %s --check-prefixes=CHECK,CHECK-OPT
2
- // RUN: %target-sil-opt -sil-print-types -update-borrowed-from -mandatory-copy-propagation -canonical-ossa-rewrite-borrows -enable-sil-verify-all %s | %FileCheck %s --check-prefixes=CHECK,CHECK-ONONE
1
+ // RUN: %target-sil-opt -sil-print-types -update-borrowed-from -copy-propagation -canonical-ossa-rewrite-borrows -enable-sil-verify-all %s | %FileCheck %s --check-prefixes=CHECK
2
+ // RUN: %target-sil-opt -sil-print-types -update-borrowed-from -mandatory-copy-propagation -canonical-ossa-rewrite-borrows -enable-sil-verify-all %s | %FileCheck %s --check-prefixes=CHECK
3
3
4
4
// REQUIRES: asserts
5
5
@@ -836,14 +836,16 @@ bb4:
836
836
return %v : $()
837
837
}
838
838
839
- // Test a dead begin_borrow (with no scope ending uses). Make sure
840
- // copy-propagation doesn't end the lifetime before the dead borrow.
839
+ // Test a dead begin_borrow (with no scope ending uses).
840
+ //
841
+ // TODO: with lifetime completion, both copies should be deleted.
841
842
//
842
843
// CHECK-LABEL: sil hidden [ossa] @testDeadBorrow : {{.*}} {
843
844
// CHECK: bb0:
844
- // CHECK-NOT: copy_value
845
- // CHECK: begin_borrow
845
+ // CHECK: copy_value
846
846
// CHECK: destroy_value
847
+ // CHECK: copy_value
848
+ // CHECK: begin_borrow
847
849
// CHECK: unreachable
848
850
// CHECK-LABEL: } // end sil function 'testDeadBorrow'
849
851
sil hidden [ossa] @testDeadBorrow : $@convention(thin) () -> () {
Original file line number Diff line number Diff line change @@ -258,9 +258,9 @@ bb3(%phi : @guaranteed $D):
258
258
// CHECK-NEXT: Incomplete liveness: Reborrowed inner scope
259
259
// CHECK-NEXT: bb0: LiveOut
260
260
// CHECK-NEXT: bb1: LiveWithin
261
- // CHECK-NEXT: regular user: %7 = borrowed %4 : $C from (%0 : $C)
262
- // CHECK-NEXT: regular user: br bb1(%1 : $C, %2 : $PairC)
263
- // CHECK-NEXT: last user: %7 = borrowed %4 : $C from (%0 : $C)
261
+ // CHECK-NEXT: regular user: end_borrow %{{.*}} : $C
262
+ // CHECK-NEXT: regular user: br bb1(%{{.*}} : $C, %{{.*}} : $PairC)
263
+ // CHECK-NEXT: last user: end_borrow %{{.*}} : $C
264
264
// CHECK-NEXT: end running
265
265
sil [ossa] @testSSAInnerReborrowedPhi : $@convention(thin) (@guaranteed C) -> () {
266
266
bb0(%0 : @guaranteed $C):
Original file line number Diff line number Diff line change @@ -4932,16 +4932,14 @@ bb0(%0 : @guaranteed $_ContiguousArrayBuffer<Element>):
4932
4932
}
4933
4933
4934
4934
// CHECK-LABEL: sil [ossa] @cowbuffer_reading_no_lookthrough_reborrow : $@convention(method) <Element> (@guaranteed _ContiguousArrayBuffer<Element>) -> MyInt {
4935
- // CHECK-NOT: ref_element_addr [immutable]
4936
- // CHECK-NOT: ref_tail_addr [immutable]
4935
+ //
4936
+ // After updating with borrowed-from instructions, the ref_element_addr's can all be promoted without looking through
4937
+ // reborrows because they are reachable from the borrowed-from.
4938
+ //
4937
4939
// CHECK-NOT: builtin "COWBufferForReading"
4938
- // CHECK: ref_element_addr %
4939
- // CHECK-NOT: ref_element_addr [immutable]
4940
- // CHECK-NOT: ref_tail_addr [immutable]
4940
+ // CHECK: ref_element_addr [immutable]
4941
4941
// CHECK-NOT: builtin "COWBufferForReading"
4942
- // CHECK: ref_tail_addr %
4943
- // CHECK-NOT: ref_element_addr [immutable]
4944
- // CHECK-NOT: ref_tail_addr [immutable]
4942
+ // CHECK: ref_tail_addr [immutable] %
4945
4943
// CHECK-NOT: builtin "COWBufferForReading"
4946
4944
// CHECK: } // end sil function 'cowbuffer_reading_no_lookthrough_reborrow'
4947
4945
sil [ossa] @cowbuffer_reading_no_lookthrough_reborrow : $@convention(method) <Element> (@guaranteed _ContiguousArrayBuffer<Element>) -> MyInt {
You can’t perform that action at this time.
0 commit comments