|
| 1 | +// First parse this and then emit a *.sib. Then read in the *.sib, then recreate |
| 2 | +// RUN: %empty-directory(%t) |
| 3 | +// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name effects |
| 4 | +// RUN: %target-sil-opt %t/tmp.sib -emit-sib -o %t/tmp.2.sib -module-name effects |
| 5 | +// RUN: %target-sil-opt %t/tmp.2.sib -module-name effects -emit-sorted-sil | %FileCheck %s |
| 6 | + |
| 7 | +// REQUIRES: swift_in_compiler |
| 8 | + |
| 9 | +import Builtin |
| 10 | +import Swift |
| 11 | + |
| 12 | +final class X { |
| 13 | + @_hasStorage var a: Int32 |
| 14 | + @_hasStorage var x: X |
| 15 | +} |
| 16 | + |
| 17 | +// CHECK-LABEL: sil @test_global_effects1 |
| 18 | +// CHECK-NEXT: [%0: escape => %r, escape c*.c*.v** => %r.c*.c*.v**, copy v**, destroy v**] |
| 19 | +// CHECK-NEXT: [%1: noescape **, read c*.v**, write c0.s0] |
| 20 | +// CHECK-NEXT: [global: read,write,copy,destroy,allocate] |
| 21 | +// CHECK-NEXT: {{^[^[]}} |
| 22 | +sil @test_global_effects1 : $@convention(thin) (@guaranteed X, @guaranteed X) -> () { |
| 23 | +[%0: escape => %r, escape c*.c*.v** => %r.c*.c*.v**, copy v**, destroy v**] |
| 24 | +[%1: noescape **, read c*.v**, write c0.s0] |
| 25 | +[global: read, write, copy, destroy, allocate] |
| 26 | +bb0(%0 : $X, %1 : $X): |
| 27 | + %r = tuple () |
| 28 | + return %r : $() |
| 29 | +} |
| 30 | + |
| 31 | +// CHECK-LABEL: sil @test_global_effects2 |
| 32 | +// CHECK-NEXT: [%0: copy v**] |
| 33 | +// CHECK-NEXT: [global: ] |
| 34 | +// CHECK-NEXT: {{^[^[]}} |
| 35 | +sil @test_global_effects2 : $@convention(thin) (@guaranteed X, @guaranteed X) -> () { |
| 36 | +[%0: copy v**] |
| 37 | +bb0(%0 : $X, %1 : $X): |
| 38 | + %r = tuple () |
| 39 | + return %r : $() |
| 40 | +} |
| 41 | + |
0 commit comments