@@ -41,21 +41,24 @@ char access(struct Outer *bar, int index) {
4141
4242
4343
44- // CHECK-LABEL: define dso_local noundef nonnull ptr @assign(
44+ // CHECK-LABEL: define dso_local ptr @assign(
4545// CHECK-SAME: ptr noundef readonly captures(none) [[BAR:%.*]], i32 noundef [[LEN:%.*]]) local_unnamed_addr #[[ATTR0]] {
4646// CHECK-NEXT: entry:
47- // CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8, !nonnull [[META12:![0-9]+]], !noundef [[META12]]
47+ // CHECK-NEXT: [[AGG_TEMP1_SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[BAR]], align 8
4848// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 8
4949// CHECK-NEXT: [[AGG_TEMP1_SROA_2_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_2_0_BAR_SROA_IDX]], align 8
50+ // CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 16
51+ // CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX]], align 8, !tbaa [[TBAA12:![0-9]+]]
52+ // CHECK-NEXT: [[FLEX_BASE_NULL_CHECK_NOT:%.*]] = icmp eq ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], null, !annotation [[META14:![0-9]+]]
53+ // CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label [[BOUNDSCHECK_CONT_THREAD:%.*]], label [[FLEX_BASE_NONNULL:%.*]], !annotation [[META14]]
54+ // CHECK: flex.base.nonnull:
5055// CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], i64 8
51- // CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[TMP0]], !annotation [[META13 :![0-9]+]]
52- // CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !prof [[PROF14 :![0-9]+]], !annotation [[META13 ]]
56+ // CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], [[TMP0]], !annotation [[META15 :![0-9]+]]
57+ // CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !prof [[PROF16 :![0-9]+]], !annotation [[META15 ]]
5358// CHECK: trap:
54- // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META15 :![0-9]+]]
55- // CHECK-NEXT: unreachable, !annotation [[META15 ]]
59+ // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR2]], !annotation [[META17 :![0-9]+]]
60+ // CHECK-NEXT: unreachable, !annotation [[META17 ]]
5661// CHECK: cont:
57- // CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX:%.*]] = getelementptr inbounds nuw i8, ptr [[BAR]], i64 16
58- // CHECK-NEXT: [[AGG_TEMP1_SROA_3_0_COPYLOAD:%.*]] = load ptr, ptr [[AGG_TEMP1_SROA_3_0_BAR_SROA_IDX]], align 8, !tbaa [[TBAA16:![0-9]+]]
5962// CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[AGG_TEMP1_SROA_2_0_COPYLOAD]], !annotation [[META7]]
6063// CHECK-NEXT: [[TMP2:%.*]] = icmp ule ptr [[AGG_TEMP1_SROA_3_0_COPYLOAD]], [[AGG_TEMP1_SROA_0_0_COPYLOAD]], !annotation [[META8]]
6164// CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[TMP1]], i1 [[TMP2]], i1 false, !annotation [[META8]]
@@ -69,9 +72,14 @@ char access(struct Outer *bar, int index) {
6972// CHECK-NEXT: [[FLEX_COUNT_CHECK:%.*]] = icmp uge i64 [[FLEX_AVAIL_COUNT]], [[FLEX_COUNT_INTPTR]], !annotation [[META19]]
7073// CHECK-NEXT: [[OR_COND51:%.*]] = select i1 [[FLEX_COUNT_MINUS]], i1 [[FLEX_COUNT_CHECK]], i1 false, !annotation [[META19]]
7174// CHECK-NEXT: br i1 [[OR_COND51]], label [[BOUNDSCHECK_NOTNULL45:%.*]], label [[TRAP]], !prof [[PROF20:![0-9]+]], !annotation [[META18]]
75+ // CHECK: boundscheck.cont.thread:
76+ // CHECK-NEXT: store i32 [[LEN]], ptr inttoptr (i64 4 to ptr), align 4, !tbaa [[TBAA2]]
77+ // CHECK-NEXT: br label [[CONT48:%.*]]
7278// CHECK: boundscheck.notnull45:
7379// CHECK-NEXT: [[LEN32:%.*]] = getelementptr inbounds nuw i8, ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]], i64 4
7480// CHECK-NEXT: store i32 [[LEN]], ptr [[LEN32]], align 4, !tbaa [[TBAA2]]
81+ // CHECK-NEXT: br label [[CONT48]]
82+ // CHECK: cont48:
7583// CHECK-NEXT: ret ptr [[AGG_TEMP1_SROA_0_0_COPYLOAD]]
7684//
7785struct Outer * assign (void * __bidi_indexable bar , int len ) {
@@ -90,12 +98,12 @@ struct Outer * assign(void * __bidi_indexable bar, int len) {
9098// CHECK: [[PROF9]] = !{!"branch_weights", i32 -8192, i32 8191}
9199// CHECK: [[META10]] = !{!"bounds-safety-check-ptr-lt-upper-bound", !"bounds-safety-check-ptr-ge-lower-bound"}
92100// CHECK: [[TBAA11]] = !{[[META5]], [[META5]], i64 0}
93- // CHECK: [[META12 ]] = !{}
94- // CHECK: [[META13]] = !{!"bounds-safety-check-one-past-end-overflow" }
95- // CHECK: [[PROF14 ]] = !{!"branch_weights", i32 1, i32 1048575 }
96- // CHECK: [[META15]] = !{!"bounds-safety-check-one-past-end-overflow", !"bounds-safety-check-ptr-lt-upper-bound", !"bounds-safety-check-ptr-ge-lower-bound", !"bounds-safety-check-count-negative", !"bounds-safety-check-ptr-le-upper-bound", !"bounds-safety-check-flexible-count-gt-bounds" }
97- // CHECK: [[TBAA16 ]] = !{[[META17:![0-9]+]], [[META17]], i64 0 }
98- // CHECK: [[META17]] = !{!"any pointer", [[META5]], i64 0 }
101+ // CHECK: [[TBAA12 ]] = !{[[META13:![0-9]+]], [[META13]], i64 0 }
102+ // CHECK: [[META13]] = !{!"any pointer", [[META5]], i64 0 }
103+ // CHECK: [[META14 ]] = !{!"bounds-safety-check-ptr-neq-null" }
104+ // CHECK: [[META15]] = !{!"bounds-safety-check-one-past-end-overflow"}
105+ // CHECK: [[PROF16 ]] = !{!"branch_weights", i32 1, i32 1048575 }
106+ // CHECK: [[META17]] = !{!"bounds-safety-check-one-past-end-overflow", !"bounds-safety-check-ptr-lt-upper-bound", !"bounds-safety-check-ptr-ge-lower-bound", !"bounds-safety-check-count-negative", !"bounds-safety-check-ptr-le-upper-bound", !"bounds-safety-check-flexible-count-gt-bounds" }
99107// CHECK: [[META18]] = !{!"bounds-safety-check-count-negative"}
100108// CHECK: [[META19]] = !{!"bounds-safety-check-flexible-count-gt-bounds"}
101109// CHECK: [[PROF20]] = !{!"branch_weights", i32 -16384, i32 16381}
0 commit comments