@@ -12,16 +12,32 @@ sil @XXX_ctor : $@convention(method) (@owned XXX) -> @owned XXX
12
12
13
13
// CHECK: target datalayout
14
14
15
- // No @owned or @out parameters -- function is read only at LLVM level
15
+ // No @owned or @out parameters -- function is not read only at LLVM level,
16
+ // because Swift level read only attribute is not automatically mapped
17
+ // to the LLVM read only attribute, unless IRGen can prove by analyzing
18
+ // the function body that this function is really read only.
16
19
17
- // CHECK: ; Function Attrs: readonly
18
- // CHECK-NEXT : define{{( protected)?}} swiftcc void @function_foo(
20
+ // CHECK-NOT : ; Function Attrs: readonly
21
+ // CHECK: define{{( protected)?}} swiftcc void @function_foo(
19
22
sil [readonly] @function_foo : $@convention(thin) (Int) -> () {
20
23
bb0(%0 : $Int):
21
24
%1 = tuple ()
22
25
return %1 : $()
23
26
}
24
27
28
+ // No @owned or @out parameters -- function is not read only at LLVM level,
29
+ // because Swift level read none attribute is not automatically mapped
30
+ // to the LLVM read only attribute, unless IRGen can prove by analyzing
31
+ // the function body that this function is really read only or read none.
32
+
33
+ // CHECK-NOT: ; Function Attrs: readonly
34
+ // CHECK: define{{( protected)?}} swiftcc void @function_foo2(
35
+ sil [readnone] @function_foo2 : $@convention(thin) (Int) -> () {
36
+ bb0(%0 : $Int):
37
+ %1 = tuple ()
38
+ return %1 : $()
39
+ }
40
+
25
41
// There's an @owned parameter, and destructors can call arbitrary code
26
42
// -- function is not read only at LLVM level
27
43
0 commit comments