1
1
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2
- // REQUIRES: apple-disclosure-ios
3
2
// RUN: %clang_cc1 -O0 -triple arm64-apple-iphoneos -fbounds-safety -emit-llvm %s -o - | FileCheck %s
4
3
5
4
#include <ptrcheck.h>
@@ -14,17 +13,17 @@ struct S {
14
13
// CHECK-NEXT: [[ENTRY:.*:]]
15
14
// CHECK-NEXT: [[START_ADDR:%.*]] = alloca ptr, align 8
16
15
// CHECK-NEXT: [[END_ADDR:%.*]] = alloca ptr, align 8
17
- // CHECK-NEXT: [[LOCAL:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
16
+ // CHECK-NEXT: [[LOCAL:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
18
17
// CHECK-NEXT: store ptr [[START]], ptr [[START_ADDR]], align 8
19
18
// CHECK-NEXT: store ptr [[END]], ptr [[END_ADDR]], align 8
20
19
// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[END_ADDR]], align 8
21
20
// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[START_ADDR]], align 8
22
21
// CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[END_ADDR]], align 8
23
- // CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 0
22
+ // CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 0
24
23
// CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP3]], align 8
25
- // CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 1
24
+ // CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 1
26
25
// CHECK-NEXT: store ptr [[TMP2]], ptr [[TMP4]], align 8
27
- // CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 2
26
+ // CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[LOCAL]], i32 0, i32 2
28
27
// CHECK-NEXT: store ptr [[TMP1]], ptr [[TMP5]], align 8
29
28
// CHECK-NEXT: ret void
30
29
//
@@ -36,55 +35,55 @@ void foo(int * const __ended_by(end) start, int* const end) {
36
35
// CHECK-SAME: ) #[[ATTR0]] {
37
36
// CHECK-NEXT: [[ENTRY:.*:]]
38
37
// CHECK-NEXT: [[ARR:%.*]] = alloca [40 x i32], align 4
39
- // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
40
- // CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
41
- // CHECK-NEXT: [[TMP:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
42
- // CHECK-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
43
- // CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
44
- // CHECK-NEXT: [[AGG_TEMP12:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
45
- // CHECK-NEXT: [[AGG_TEMP19:%.*]] = alloca %"__firebloom ::wide_ptr.bidi_indexable", align 8
38
+ // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
39
+ // CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
40
+ // CHECK-NEXT: [[TMP:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
41
+ // CHECK-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
42
+ // CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
43
+ // CHECK-NEXT: [[AGG_TEMP12:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
44
+ // CHECK-NEXT: [[AGG_TEMP19:%.*]] = alloca %"__bounds_safety ::wide_ptr.bidi_indexable", align 8
46
45
// CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [40 x i32], ptr [[ARR]], i64 0, i64 0
47
46
// CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY]], i64 40
48
- // CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0
47
+ // CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0
49
48
// CHECK-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP0]], align 8
50
- // CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1
49
+ // CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1
51
50
// CHECK-NEXT: store ptr [[UPPER]], ptr [[TMP1]], align 8
52
- // CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2
51
+ // CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2
53
52
// CHECK-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP2]], align 8
54
53
// CHECK-NEXT: [[ARRAYDECAY2:%.*]] = getelementptr inbounds [40 x i32], ptr [[ARR]], i64 0, i64 0
55
54
// CHECK-NEXT: [[UPPER3:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY2]], i64 40
56
- // CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0
55
+ // CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0
57
56
// CHECK-NEXT: store ptr [[ARRAYDECAY2]], ptr [[TMP3]], align 8
58
- // CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 1
57
+ // CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 1
59
58
// CHECK-NEXT: store ptr [[UPPER3]], ptr [[TMP4]], align 8
60
- // CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 2
59
+ // CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 2
61
60
// CHECK-NEXT: store ptr [[ARRAYDECAY2]], ptr [[TMP5]], align 8
62
- // CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0
61
+ // CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0
63
62
// CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
64
63
// CHECK-NEXT: [[BOUND_PTR_ARITH:%.*]] = getelementptr i32, ptr [[TMP7]], i64 40
65
- // CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 0
64
+ // CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 0
66
65
// CHECK-NEXT: store ptr [[BOUND_PTR_ARITH]], ptr [[TMP8]], align 8
67
- // CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 1
66
+ // CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 1
68
67
// CHECK-NEXT: [[TMP10:%.*]] = load ptr, ptr [[TMP9]], align 8
69
- // CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 1
68
+ // CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 1
70
69
// CHECK-NEXT: store ptr [[TMP10]], ptr [[TMP11]], align 8
71
- // CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 2
70
+ // CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 2
72
71
// CHECK-NEXT: [[TMP13:%.*]] = load ptr, ptr [[TMP12]], align 8
73
- // CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 2
72
+ // CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP1]], i32 0, i32 2
74
73
// CHECK-NEXT: store ptr [[TMP13]], ptr [[TMP14]], align 8
75
74
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META2:![0-9]+]]
76
- // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 0, !annotation [[META2]]
75
+ // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 0, !annotation [[META2]]
77
76
// CHECK-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8, !annotation [[META2]]
78
- // CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 1, !annotation [[META2]]
77
+ // CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 1, !annotation [[META2]]
79
78
// CHECK-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8, !annotation [[META2]]
80
- // CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 2, !annotation [[META2]]
79
+ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP4]], i32 0, i32 2, !annotation [[META2]]
81
80
// CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8, !annotation [[META2]]
82
81
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP5]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false), !annotation [[META2]]
83
- // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR6:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 0, !annotation [[META2]]
82
+ // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR6:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 0, !annotation [[META2]]
84
83
// CHECK-NEXT: [[WIDE_PTR_PTR7:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR6]], align 8, !annotation [[META2]]
85
- // CHECK-NEXT: [[WIDE_PTR_UB_ADDR8:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 1, !annotation [[META2]]
84
+ // CHECK-NEXT: [[WIDE_PTR_UB_ADDR8:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 1, !annotation [[META2]]
86
85
// CHECK-NEXT: [[WIDE_PTR_UB9:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR8]], align 8, !annotation [[META2]]
87
- // CHECK-NEXT: [[WIDE_PTR_LB_ADDR10:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 2, !annotation [[META2]]
86
+ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR10:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 2, !annotation [[META2]]
88
87
// CHECK-NEXT: [[WIDE_PTR_LB11:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR10]], align 8, !annotation [[META2]]
89
88
// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_PTR7]], !annotation [[META2]]
90
89
// CHECK-NEXT: br i1 [[CMP]], label %[[CONT:.*]], label %[[TRAP:.*]], !annotation [[META2]]
@@ -93,18 +92,18 @@ void foo(int * const __ended_by(end) start, int* const end) {
93
92
// CHECK-NEXT: unreachable, !annotation [[META2]]
94
93
// CHECK: [[CONT]]:
95
94
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP12]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false)
96
- // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR13:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 0
95
+ // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR13:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 0
97
96
// CHECK-NEXT: [[WIDE_PTR_PTR14:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR13]], align 8
98
- // CHECK-NEXT: [[WIDE_PTR_UB_ADDR15:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 1
97
+ // CHECK-NEXT: [[WIDE_PTR_UB_ADDR15:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 1
99
98
// CHECK-NEXT: [[WIDE_PTR_UB16:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR15]], align 8
100
- // CHECK-NEXT: [[WIDE_PTR_LB_ADDR17:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 2
99
+ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR17:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP12]], i32 0, i32 2
101
100
// CHECK-NEXT: [[WIDE_PTR_LB18:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR17]], align 8
102
101
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP19]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false)
103
- // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR20:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 0
102
+ // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR20:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 0
104
103
// CHECK-NEXT: [[WIDE_PTR_PTR21:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR20]], align 8
105
- // CHECK-NEXT: [[WIDE_PTR_UB_ADDR22:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 1
104
+ // CHECK-NEXT: [[WIDE_PTR_UB_ADDR22:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 1
106
105
// CHECK-NEXT: [[WIDE_PTR_UB23:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR22]], align 8
107
- // CHECK-NEXT: [[WIDE_PTR_LB_ADDR24:%.*]] = getelementptr inbounds nuw %"__firebloom ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 2
106
+ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR24:%.*]] = getelementptr inbounds %"__bounds_safety ::wide_ptr.bidi_indexable", ptr [[AGG_TEMP19]], i32 0, i32 2
108
107
// CHECK-NEXT: [[WIDE_PTR_LB25:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR24]], align 8
109
108
// CHECK-NEXT: call void @foo(ptr noundef [[WIDE_PTR_PTR14]], ptr noundef [[WIDE_PTR_PTR21]])
110
109
// CHECK-NEXT: ret void
@@ -114,5 +113,5 @@ void bar(void) {
114
113
foo (arr , arr + 40 );
115
114
}
116
115
//.
117
- // CHECK: [[META2]] = !{!"firebloom -generic"}
116
+ // CHECK: [[META2]] = !{!"bounds-safety -generic"}
118
117
//.
0 commit comments