Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Outer {
// CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[TMP2]], [[TMP1]], !annotation {{![0-9]+}}
// CHECK-NEXT: br i1 [[OR_COND]], label [[CONT8:%.*]], label [[TRAP:%.*]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
// CHECK: trap:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2:[0-9]+]], !annotation {{![0-9]+}}
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation {{![0-9]+}}
// CHECK-NEXT: unreachable, !annotation {{![0-9]+}}
// CHECK: cont8:
// CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[ARRAYIDX]], align 1, !tbaa {{![0-9]+}}
Expand All @@ -43,7 +43,7 @@ char access(struct Outer *bar, int index) {


// CHECK-LABEL: define dso_local ptr @assign(
// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
// CHECK-NEXT: entry:
// CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8
// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 8
Expand All @@ -57,7 +57,7 @@ char access(struct Outer *bar, int index) {
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[TMP0]], !annotation {{![0-9]+}}
// CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !prof {{![0-9]+}}, !annotation {{![0-9]+}}
// CHECK: trap:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation {{![0-9]+}}
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation {{![0-9]+}}
// CHECK-NEXT: unreachable, !annotation {{![0-9]+}}
// CHECK: cont:
// CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[AGG_TEMP1_SROA_2_0_COPYLOAD]], !annotation {{![0-9]+}}
Expand Down
44 changes: 22 additions & 22 deletions clang/test/BoundsSafety/CodeGen/bounds-attributed-return-O2.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP28]], [[CMP25]]
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10:![0-9]+]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2:[0-9]+]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[AGG_TEMP_SROA_0_0_COPYLOAD]]
Expand All @@ -40,7 +40,7 @@ int *__counted_by(count) cb_in_from_bidi(int count, int *__bidi_indexable p) {
}

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

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

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

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

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

// CHECK-LABEL: define dso_local noundef ptr @cb_in_from_cbn2(
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef returned [[P:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[P]], null, !annotation [[META12]]
// CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[LEN]] to i64
Expand All @@ -160,7 +160,7 @@ int *__counted_by(count) cb_in_from_cbn(int count, int *__counted_by_or_null(cou
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP28]], [[CMP25]]
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[P]]
Expand All @@ -176,7 +176,7 @@ int *__counted_by(count) cb_in_from_cbn2(int count, int *__counted_by_or_null(le
// CHECK-NEXT: [[OR_COND:%.*]] = icmp ult i32 [[TMP0]], 2, !annotation [[META2]]
// CHECK-NEXT: br i1 [[OR_COND]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF15:![0-9]+]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[P]]
Expand All @@ -186,14 +186,14 @@ int *__counted_by(*count) cb_out_from_single(int *__single count, int *__single
}

// CHECK-LABEL: define dso_local noundef ptr @cbn_in_from_single(
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(address_is_null, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-SAME: i32 noundef [[COUNT:%.*]], ptr noundef readnone returned captures(address_is_null, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq ptr [[P]], null, !annotation [[META2]]
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = icmp ult i32 [[COUNT]], 2
// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[SPEC_SELECT]], [[TOBOOL_NOT]], !annotation [[META2]]
// CHECK-NEXT: br i1 [[OR_COND]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF16:![0-9]+]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[P]]
Expand Down Expand Up @@ -225,7 +225,7 @@ int *__counted_by_or_null(count) cbn_in_from_single(int count, int *__single p)
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP35]], [[CMP32]]
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP]], !prof [[PROF10]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[AGG_TEMP_SROA_0_0_COPYLOAD]]
Expand All @@ -235,12 +235,12 @@ void *__sized_by(size) sb_in_from_bidi(int size, void *__bidi_indexable p) {
}

// CHECK-LABEL: define dso_local noundef ptr @sb_in_from_single(
// CHECK-SAME: i32 noundef [[SIZE:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-SAME: i32 noundef [[SIZE:%.*]], ptr noundef readnone returned captures(ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = icmp ult i32 [[SIZE]], 5
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF10]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[P]]
Expand All @@ -266,7 +266,7 @@ void *__sized_by(size) sb_in_from_single(int size, int *__single p) {
// CHECK-NEXT: [[CMP15_NOT:%.*]] = icmp ugt ptr [[AGG_TEMP5_SROA_1_0_COPYLOAD]], [[AGG_TEMP1_SROA_0_0_COPYLOAD]], !annotation [[META2]]
// CHECK-NEXT: br i1 [[CMP15_NOT]], label %[[TRAP]], label %[[CONT:.*]], !prof [[PROF18:![0-9]+]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]]
Expand All @@ -276,15 +276,15 @@ void *__ended_by(end) eb_in_from_bidi(void *__single end, void *__bidi_indexable
}

// CHECK-LABEL: define dso_local noundef ptr @eb_in_from_single(
// CHECK-SAME: ptr noundef readnone captures(address) [[END:%.*]], ptr noundef readnone returned captures(address, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-SAME: ptr noundef readnone captures(address) [[END:%.*]], ptr noundef readnone returned captures(address, ret: address, provenance) [[P:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 4, !annotation [[META2]]
// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[END]], [[UPPER]], !annotation [[META2]]
// CHECK-NEXT: [[CMP1:%.*]] = icmp ule ptr [[P]], [[END]], !annotation [[META2]]
// CHECK-NEXT: [[SPEC_SELECT:%.*]] = and i1 [[CMP1]], [[CMP]]
// CHECK-NEXT: br i1 [[SPEC_SELECT]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF10]], !annotation [[META2]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META2]]
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]]
// CHECK-NEXT: unreachable, !annotation [[META2]]
// CHECK: [[CONT]]:
// CHECK-NEXT: ret ptr [[P]]
Expand Down
Loading