Skip to content

Commit e1e5d47

Browse files
[BoundsSafety] Fix CodeGen tests after c021cac (NFC)
c021cac makes ubsantrap `inaccessiblemem: write`. This change adjusts our CodeGen tests. rdar://160342101
1 parent 7d7bc29 commit e1e5d47

11 files changed

+775
-775
lines changed

clang/test/BoundsSafety-legacy-checks/CodeGen/nested-struct-member-count-O2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Outer {
3030
// CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[TMP2]], [[TMP1]], !annotation {{![0-9]+}}
3131
// CHECK-NEXT: br i1 [[OR_COND]], label [[CONT8:%.*]], label [[TRAP:%.*]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
3232
// CHECK: trap:
33-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2:[0-9]+]], !annotation {{![0-9]+}}
33+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation {{![0-9]+}}
3434
// CHECK-NEXT: unreachable, !annotation {{![0-9]+}}
3535
// CHECK: cont8:
3636
// CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[ARRAYIDX]], align 1, !tbaa {{![0-9]+}}
@@ -43,7 +43,7 @@ char access(struct Outer *bar, int index) {
4343

4444

4545
// CHECK-LABEL: define dso_local ptr @assign(
46-
// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
46+
// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
4747
// CHECK-NEXT: entry:
4848
// CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8
4949
// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 8
@@ -57,7 +57,7 @@ char access(struct Outer *bar, int index) {
5757
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[TMP0]], !annotation {{![0-9]+}}
5858
// CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
5959
// CHECK: trap:
60-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation {{![0-9]+}}
60+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation {{![0-9]+}}
6161
// CHECK-NEXT: unreachable, !annotation {{![0-9]+}}
6262
// CHECK: cont:
6363
// CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[AGG_TEMP1_SROA_2_0_COPYLOAD]], !annotation {{![0-9]+}}

clang/test/BoundsSafety/CodeGen/bounds-attributed-return-O2.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP28]], [[CMP25]]
3131
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10:![0-9]+]], !annotation [[META2]]
3232
// CHECK: [[TRAP]]:
33-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2:[0-9]+]], !annotation [[META2]]
33+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META2]]
3434
// CHECK-NEXT: unreachable, !annotation [[META2]]
3535
// CHECK: [[CONT]]:
3636
// CHECK-NEXT: ret ptr [[AGG_TEMP_SROA_0_0_COPYLOAD]]
@@ -40,7 +40,7 @@ int *__counted_by(count) cb_in_from_bidi(int count, int *__bidi_indexable p) {
4040
}
4141

4242
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_indexable(
43-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], [2 x i64] noundef [[P_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
43+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], [2 x i64] noundef [[P_COERCE:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
4444
// CHECK-NEXT: [[ENTRY:.*:]]
4545
// CHECK-NEXT: [[P_COERCE_FCA_0_EXTRACT:%.*]] = extractvalue [2 x i64] [[P_COERCE]], 0
4646
// CHECK-NEXT: [[P_COERCE_FCA_1_EXTRACT:%.*]] = extractvalue [2 x i64] [[P_COERCE]], 1
@@ -55,7 +55,7 @@ int *__counted_by(count) cb_in_from_bidi(int count, int *__bidi_indexable p) {
5555
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP37]], [[CMP34]]
5656
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
5757
// CHECK: [[TRAP]]:
58-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
58+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
5959
// CHECK-NEXT: unreachable, !annotation [[META2]]
6060
// CHECK: [[CONT]]:
6161
// CHECK-NEXT: [[TMP0:%.*]] = inttoptr i64 [[P_COERCE_FCA_0_EXTRACT]] to ptr
@@ -66,12 +66,12 @@ int *__counted_by(count) cb_in_from_indexable(int count, int *__indexable p) {
6666
}
6767

6868
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_single(
69-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
69+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
7070
// CHECK-NEXT: [[ENTRY:.*:]]
7171
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = icmp ult i32 [[COUNT]], 2
7272
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF10]], !annotation [[META2]]
7373
// CHECK: [[TRAP]]:
74-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
74+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
7575
// CHECK-NEXT: unreachable, !annotation [[META2]]
7676
// CHECK: [[CONT]]:
7777
// CHECK-NEXT: ret ptr [[P]]
@@ -81,12 +81,12 @@ int *__counted_by(count) cb_in_from_single(int count, int *__single p) {
8181
}
8282

8383
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_cb(
84-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
84+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
8585
// CHECK-NEXT: [[ENTRY:.*:]]
8686
// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp slt i32 [[COUNT]], 0, !annotation [[META2]]
8787
// CHECK-NEXT: br i1 [[CMP_NOT]], label %[[TRAP:.*]], label %[[CONT:.*]], !annotation [[META2]]
8888
// CHECK: [[TRAP]]:
89-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
89+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
9090
// CHECK-NEXT: unreachable, !annotation [[META2]]
9191
// CHECK: [[CONT]]:
9292
// CHECK-NEXT: ret ptr [[P]]
@@ -96,14 +96,14 @@ int *__counted_by(count) cb_in_from_cb(int count, int *__counted_by(count) p) {
9696
}
9797

9898
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_cb2(
99-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
99+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR2]] {
100100
// CHECK-NEXT: [[ENTRY:.*:]]
101101
// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp slt i32 [[LEN]], 0, !annotation [[META2]]
102102
// CHECK-NEXT: [[SPEC_SELECT_NOT:%.*]] = icmp ugt i32 [[COUNT]], [[LEN]]
103103
// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[SPEC_SELECT_NOT]], !annotation [[META2]]
104104
// CHECK-NEXT: br i1 [[OR_COND]], label %[[TRAP:.*]], label %[[CONT:.*]], !prof [[PROF11:![0-9]+]], !annotation [[META2]]
105105
// CHECK: [[TRAP]]:
106-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
106+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
107107
// CHECK-NEXT: unreachable, !annotation [[META2]]
108108
// CHECK: [[CONT]]:
109109
// CHECK-NEXT: ret ptr [[P]]
@@ -113,7 +113,7 @@ int *__counted_by(count) cb_in_from_cb2(int count, int *__counted_by(len) p, int
113113
}
114114

115115
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_cbn(
116-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
116+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
117117
// CHECK-NEXT: [[ENTRY:.*:]]
118118
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[P]], null, !annotation [[META12:![0-9]+]]
119119
// CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[COUNT]] to i64
@@ -131,7 +131,7 @@ int *__counted_by(count) cb_in_from_cb2(int count, int *__counted_by(len) p, int
131131
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP28]], [[CMP25]]
132132
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
133133
// CHECK: [[TRAP]]:
134-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
134+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
135135
// CHECK-NEXT: unreachable, !annotation [[META2]]
136136
// CHECK: [[CONT]]:
137137
// CHECK-NEXT: ret ptr [[P]]
@@ -141,7 +141,7 @@ int *__counted_by(count) cb_in_from_cbn(int count, int *__counted_by_or_null(cou
141141
}
142142

143143
// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_cbn2(
144-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
144+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR2]] {
145145
// CHECK-NEXT: [[ENTRY:.*:]]
146146
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[P]], null, !annotation [[META12]]
147147
// CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[LEN]] to i64
@@ -160,7 +160,7 @@ int *__counted_by(count) cb_in_from_cbn(int count, int *__counted_by_or_null(cou
160160
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP28]], [[CMP25]]
161161
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
162162
// CHECK: [[TRAP]]:
163-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
163+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
164164
// CHECK-NEXT: unreachable, !annotation [[META2]]
165165
// CHECK: [[CONT]]:
166166
// CHECK-NEXT: ret ptr [[P]]
@@ -176,7 +176,7 @@ int *__counted_by(count) cb_in_from_cbn2(int count, int *__counted_by_or_null(le
176176
// CHECK-NEXT: [[OR_COND:%.*]] = icmp ult i32 [[TMP0]], 2, !annotation [[META2]]
177177
// CHECK-NEXT: br i1 [[OR_COND]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF15:![0-9]+]], !annotation [[META2]]
178178
// CHECK: [[TRAP]]:
179-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
179+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
180180
// CHECK-NEXT: unreachable, !annotation [[META2]]
181181
// CHECK: [[CONT]]:
182182
// CHECK-NEXT: ret ptr [[P]]
@@ -186,14 +186,14 @@ int *__counted_by(*count) cb_out_from_single(int *__single count, int *__single
186186
}
187187

188188
// CHECK-LABEL: define dso_local noundef ptr @cbn_in_from_single(
189-
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(address_is_null, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
189+
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(address_is_null, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
190190
// CHECK-NEXT: [[ENTRY:.*:]]
191191
// CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq ptr [[P]], null, !annotation [[META2]]
192192
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = icmp ult i32 [[COUNT]], 2
193193
// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[SPEC_SELECT]], [[TOBOOL_NOT]], !annotation [[META2]]
194194
// CHECK-NEXT: br i1 [[OR_COND]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF16:![0-9]+]], !annotation [[META2]]
195195
// CHECK: [[TRAP]]:
196-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
196+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
197197
// CHECK-NEXT: unreachable, !annotation [[META2]]
198198
// CHECK: [[CONT]]:
199199
// CHECK-NEXT: ret ptr [[P]]
@@ -225,7 +225,7 @@ int *__counted_by_or_null(count) cbn_in_from_single(int count, int *__single p)
225225
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP35]], [[CMP32]]
226226
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
227227
// CHECK: [[TRAP]]:
228-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
228+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
229229
// CHECK-NEXT: unreachable, !annotation [[META2]]
230230
// CHECK: [[CONT]]:
231231
// CHECK-NEXT: ret ptr [[AGG_TEMP_SROA_0_0_COPYLOAD]]
@@ -235,12 +235,12 @@ void *__sized_by(size) sb_in_from_bidi(int size, void *__bidi_indexable p) {
235235
}
236236

237237
// CHECK-LABEL: define dso_local noundef ptr @sb_in_from_single(
238-
// CHECK-SAME: i32 noundef [[SIZE:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
238+
// CHECK-SAME: i32 noundef [[SIZE:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
239239
// CHECK-NEXT: [[ENTRY:.*:]]
240240
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = icmp ult i32 [[SIZE]], 5
241241
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF10]], !annotation [[META2]]
242242
// CHECK: [[TRAP]]:
243-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
243+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
244244
// CHECK-NEXT: unreachable, !annotation [[META2]]
245245
// CHECK: [[CONT]]:
246246
// CHECK-NEXT: ret ptr [[P]]
@@ -266,7 +266,7 @@ void *__sized_by(size) sb_in_from_single(int size, int *__single p) {
266266
// CHECK-NEXT: [[CMP15_NOT:%.*]] = icmp ugt ptr [[AGG_TEMP5_SROA_1_0_COPYLOAD]], [[AGG_TEMP1_SROA_0_0_COPYLOAD]], !annotation [[META2]]
267267
// CHECK-NEXT: br i1 [[CMP15_NOT]], label %[[TRAP]], label %[[CONT:.*]], !prof [[PROF18:![0-9]+]], !annotation [[META2]]
268268
// CHECK: [[TRAP]]:
269-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
269+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
270270
// CHECK-NEXT: unreachable, !annotation [[META2]]
271271
// CHECK: [[CONT]]:
272272
// CHECK-NEXT: ret ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]]
@@ -276,15 +276,15 @@ void *__ended_by(end) eb_in_from_bidi(void *__single end, void *__bidi_indexable
276276
}
277277

278278
// CHECK-LABEL: define dso_local noundef ptr @eb_in_from_single(
279-
// CHECK-SAME: ptr noundef readnone captures(address) [[END:%.*]], ptr noundef readnone returned captures(address, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
279+
// CHECK-SAME: ptr noundef readnone captures(address) [[END:%.*]], ptr noundef readnone returned captures(address, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
280280
// CHECK-NEXT: [[ENTRY:.*:]]
281281
// CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 4, !annotation [[META2]]
282282
// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[END]], [[UPPER]], !annotation [[META2]]
283283
// CHECK-NEXT: [[CMP1:%.*]] = icmp ule ptr [[P]], [[END]], !annotation [[META2]]
284284
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP1]], [[CMP]]
285285
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF10]], !annotation [[META2]]
286286
// CHECK: [[TRAP]]:
287-
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
287+
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
288288
// CHECK-NEXT: unreachable, !annotation [[META2]]
289289
// CHECK: [[CONT]]:
290290
// CHECK-NEXT: ret ptr [[P]]

0 commit comments

Comments
 (0)