10
10
blackHole ( ptr)
11
11
ptr. deallocate ( )
12
12
}
13
- // CHECK: ptrtoint ptr {{.*}} to [[WORD:i[0-9]+]]
14
13
15
14
// MARK: Trivial Cases
16
15
16
+ // CHECK: [[ONE_BYTE_PTR_RAW:%temp_alloc[0-9]*]] = alloca i8, align 1
17
+ // CHECK: [[FIVE_BYTE_PTR_RAW:%temp_alloc[0-9]*]] = alloca [5 x i8], align 1
18
+ // CHECK: [[ONE_KB_PTR_RAW:%temp_alloc[0-9]*]] = alloca [1024 x i8], align 8
19
+ // CHECK: [[ONE_KB_RAND_PTR_RAW:%temp_alloc[0-9]*]] = alloca [1024 x i8], align 16
20
+ // CHECK: [[INT_PTR_RAW:%temp_alloc[0-9]*]] = alloca [16 x i8], align 4
21
+ // CHECK: [[INT_PTR_RAW2:%temp_alloc[0-9]*]] = alloca [16 x i8], align 4
22
+ // CHECK: [[VOID_PTR_RAW:%temp_alloc[0-9]*]] = alloca [2 x i8], align 1
23
+
24
+ // CHECK: ptrtoint ptr {{.*}} to [[WORD:i[0-9]+]]
25
+
26
+
17
27
withUnsafeTemporaryAllocation ( byteCount: 0 , alignment: 1 ) { buffer in
18
28
blackHole ( buffer. baseAddress)
19
29
}
@@ -24,21 +34,18 @@ withUnsafeTemporaryAllocation(byteCount: 0, alignment: 1) { buffer in
24
34
withUnsafeTemporaryAllocation ( byteCount: 1 , alignment: 1 ) { buffer in
25
35
blackHole ( buffer. baseAddress)
26
36
}
27
- // CHECK: [[ONE_BYTE_PTR_RAW:%temp_alloc[0-9]*]] = alloca i8, align 1
28
37
// CHECK: [[ONE_BYTE_PTR:%[0-9]+]] = ptrtoint ptr [[ONE_BYTE_PTR_RAW]] to [[WORD]]
29
38
// CHECK: call swiftcc void @blackHole([[WORD]] [[ONE_BYTE_PTR]])
30
39
31
40
withUnsafeTemporaryAllocation ( byteCount: 5 , alignment: 1 ) { buffer in
32
41
blackHole ( buffer. baseAddress)
33
42
}
34
- // CHECK: [[FIVE_BYTE_PTR_RAW:%temp_alloc[0-9]*]] = alloca [5 x i8], align 1
35
43
// CHECK: [[FIVE_BYTE_PTR:%[0-9]+]] = ptrtoint ptr [[FIVE_BYTE_PTR_RAW]] to [[WORD]]
36
44
// CHECK: call swiftcc void @blackHole([[WORD]] [[FIVE_BYTE_PTR]])
37
45
38
46
withUnsafeTemporaryAllocation ( byteCount: 1024 , alignment: 8 ) { buffer in
39
47
blackHole ( buffer. baseAddress)
40
48
}
41
- // CHECK: [[ONE_KB_PTR_RAW:%temp_alloc[0-9]*]] = alloca [1024 x i8], align 8
42
49
// CHECK: [[ONE_KB_PTR:%[0-9]+]] = ptrtoint ptr [[ONE_KB_PTR_RAW]] to [[WORD]]
43
50
// CHECK: call swiftcc void @blackHole([[WORD]] [[ONE_KB_PTR]])
44
51
@@ -47,7 +54,6 @@ withUnsafeTemporaryAllocation(byteCount: 1024, alignment: 8) { buffer in
47
54
withUnsafeTemporaryAllocation ( byteCount: 1024 , alignment: Int . random ( in: 0 ..< 16 ) ) { buffer in
48
55
blackHole ( buffer. baseAddress)
49
56
}
50
- // CHECK: [[ONE_KB_RAND_PTR_RAW:%temp_alloc[0-9]*]] = alloca [1024 x i8], align 16
51
57
// CHECK: [[ONE_KB_RAND_PTR:%[0-9]+]] = ptrtoint ptr [[ONE_KB_RAND_PTR_RAW]] to [[WORD]]
52
58
// CHECK: call swiftcc void @blackHole([[WORD]] [[ONE_KB_RAND_PTR]])
53
59
@@ -56,21 +62,18 @@ withUnsafeTemporaryAllocation(byteCount: 1024, alignment: Int.random(in: 0 ..< 1
56
62
withUnsafeTemporaryAllocation ( of: Int32 . self, capacity: 4 ) { buffer in
57
63
blackHole ( buffer. baseAddress)
58
64
}
59
- // CHECK: [[INT_PTR_RAW:%temp_alloc[0-9]*]] = alloca [16 x i8], align 4
60
65
// CHECK: [[INT_PTR:%[0-9]+]] = ptrtoint ptr [[INT_PTR_RAW]] to [[WORD]]
61
66
// CHECK: call swiftcc void @blackHole([[WORD]] [[INT_PTR]])
62
67
63
68
_withUnprotectedUnsafeTemporaryAllocation ( of: Int32 . self, capacity: 4 ) { buffer in
64
69
blackHole ( buffer. baseAddress)
65
70
}
66
- // CHECK: [[INT_PTR_RAW:%temp_alloc[0-9]*]] = alloca [16 x i8], align 4
67
- // CHECK: [[INT_PTR:%[0-9]+]] = ptrtoint ptr [[INT_PTR_RAW]] to [[WORD]]
71
+ // CHECK: [[INT_PTR:%[0-9]+]] = ptrtoint ptr [[INT_PTR_RAW2]] to [[WORD]]
68
72
// CHECK: call swiftcc void @blackHole([[WORD]] [[INT_PTR]])
69
73
70
74
withUnsafeTemporaryAllocation ( of: Void . self, capacity: 2 ) { buffer in
71
75
blackHole ( buffer. baseAddress)
72
76
}
73
- // CHECK: [[VOID_PTR_RAW:%temp_alloc[0-9]*]] = alloca [2 x i8], align 1
74
77
// CHECK: [[VOID_PTR:%[0-9]+]] = ptrtoint ptr [[VOID_PTR_RAW]] to [[WORD]]
75
78
// CHECK: call swiftcc void @blackHole([[WORD]] [[VOID_PTR]])
76
79
0 commit comments