11// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2- // REQUIRES: apple-disclosure-ios
32// RUN: %clang_cc1 -O0 -triple arm64-apple-iphoneos -fbounds-safety -emit-llvm %s -o - | FileCheck %s
43
54#include <ptrcheck.h>
@@ -14,17 +13,17 @@ struct S {
1413// CHECK-NEXT: [[ENTRY:.*:]]
1514// CHECK-NEXT: [[START_ADDR:%.*]] = alloca ptr, align 8
1615// 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
1817// CHECK-NEXT: store ptr [[START]], ptr [[START_ADDR]], align 8
1918// CHECK-NEXT: store ptr [[END]], ptr [[END_ADDR]], align 8
2019// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[END_ADDR]], align 8
2120// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[START_ADDR]], align 8
2221// 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
2423// 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
2625// 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
2827// CHECK-NEXT: store ptr [[TMP1]], ptr [[TMP5]], align 8
2928// CHECK-NEXT: ret void
3029//
@@ -36,55 +35,55 @@ void foo(int * const __ended_by(end) start, int* const end) {
3635// CHECK-SAME: ) #[[ATTR0]] {
3736// CHECK-NEXT: [[ENTRY:.*:]]
3837// 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
4645// CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [40 x i32], ptr [[ARR]], i64 0, i64 0
4746// 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
4948// 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
5150// 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
5352// CHECK-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP2]], align 8
5453// CHECK-NEXT: [[ARRAYDECAY2:%.*]] = getelementptr inbounds [40 x i32], ptr [[ARR]], i64 0, i64 0
5554// 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
5756// 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
5958// 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
6160// 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
6362// CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
6463// 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
6665// 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
6867// 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
7069// 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
7271// 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
7473// CHECK-NEXT: store ptr [[TMP13]], ptr [[TMP14]], align 8
7574// 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]]
7776// 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]]
7978// 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]]
8180// CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8, !annotation [[META2]]
8281// 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]]
8483// 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]]
8685// 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]]
8887// CHECK-NEXT: [[WIDE_PTR_LB11:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR10]], align 8, !annotation [[META2]]
8988// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_PTR7]], !annotation [[META2]]
9089// 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) {
9392// CHECK-NEXT: unreachable, !annotation [[META2]]
9493// CHECK: [[CONT]]:
9594// 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
9796// 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
9998// 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
101100// CHECK-NEXT: [[WIDE_PTR_LB18:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR17]], align 8
102101// 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
104103// 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
106105// 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
108107// CHECK-NEXT: [[WIDE_PTR_LB25:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR24]], align 8
109108// CHECK-NEXT: call void @foo(ptr noundef [[WIDE_PTR_PTR14]], ptr noundef [[WIDE_PTR_PTR21]])
110109// CHECK-NEXT: ret void
@@ -114,5 +113,5 @@ void bar(void) {
114113 foo (arr , arr + 40 );
115114}
116115//.
117- // CHECK: [[META2]] = !{!"firebloom -generic"}
116+ // CHECK: [[META2]] = !{!"bounds-safety -generic"}
118117//.
0 commit comments