@@ -55,45 +55,49 @@ int consume(int* __bidi_indexable ptr, int idx) {
5555// OPT2-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4
5656// OPT2-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8
5757// OPT2-NEXT: store ptr [[PTR]], ptr [[PTR_INDIRECT_ADDR]], align 8, !tbaa [[TBAA2:![0-9]+]]
58- // OPT2-NEXT: store i32 [[IDX]], ptr [[IDX_ADDR]], align 4, !tbaa [[TBAA6 :![0-9]+]]
59- // OPT2-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP]], ptr align 8 [[PTR]], i64 24, i1 false), !tbaa.struct [[TBAA_STRUCT8 :![0-9]+]]
58+ // OPT2-NEXT: store i32 [[IDX]], ptr [[IDX_ADDR]], align 4, !tbaa [[TBAA8 :![0-9]+]]
59+ // OPT2-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP]], ptr align 8 [[PTR]], i64 24, i1 false), !tbaa.struct [[TBAA_STRUCT10 :![0-9]+]]
6060// OPT2-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0
6161// OPT2-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8
62- // OPT2-NEXT: [[TMP0:%.*]] = load i32, ptr [[IDX_ADDR]], align 4, !tbaa [[TBAA6 ]]
62+ // OPT2-NEXT: [[TMP0:%.*]] = load i32, ptr [[IDX_ADDR]], align 4, !tbaa [[TBAA8 ]]
6363// OPT2-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP0]] to i64
6464// OPT2-NEXT: [[ARRAYIDX:%.*]] = getelementptr i32, ptr [[WIDE_PTR_PTR]], i64 [[IDXPROM]]
6565// OPT2-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1
6666// OPT2-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8
6767// OPT2-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2
6868// OPT2-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8
69- // OPT2-NEXT: [[TMP1:%.*]] = icmp ult ptr [[ARRAYIDX]], [[WIDE_PTR_UB]], !annotation [[META9 :![0-9]+]]
70- // OPT2-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !annotation [[META9 ]]
69+ // OPT2-NEXT: [[TMP1:%.*]] = icmp ult ptr [[ARRAYIDX]], [[WIDE_PTR_UB]], !annotation [[META13 :![0-9]+]]
70+ // OPT2-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !annotation [[META13 ]]
7171// OPT2: [[TRAP]]:
72- // OPT2-NEXT: call void asm sideeffect "", "n"(i64 0), !annotation [[META9 ]]
73- // OPT2-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META9 ]]
74- // OPT2-NEXT: unreachable, !annotation [[META9 ]]
72+ // OPT2-NEXT: call void asm sideeffect "", "n"(i64 0), !annotation [[META13 ]]
73+ // OPT2-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META13 ]]
74+ // OPT2-NEXT: unreachable, !annotation [[META13 ]]
7575// OPT2: [[CONT]]:
76- // OPT2-NEXT: [[TMP2:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB]], !annotation [[META10 :![0-9]+]]
77- // OPT2-NEXT: br i1 [[TMP2]], label %[[CONT2:.*]], label %[[TRAP1:.*]], !annotation [[META10 ]]
76+ // OPT2-NEXT: [[TMP2:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB]], !annotation [[META14 :![0-9]+]]
77+ // OPT2-NEXT: br i1 [[TMP2]], label %[[CONT2:.*]], label %[[TRAP1:.*]], !annotation [[META14 ]]
7878// OPT2: [[TRAP1]]:
79- // OPT2-NEXT: call void asm sideeffect "", "n"(i64 1), !annotation [[META10 ]]
80- // OPT2-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META10 ]]
81- // OPT2-NEXT: unreachable, !annotation [[META10 ]]
79+ // OPT2-NEXT: call void asm sideeffect "", "n"(i64 1), !annotation [[META14 ]]
80+ // OPT2-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META14 ]]
81+ // OPT2-NEXT: unreachable, !annotation [[META14 ]]
8282// OPT2: [[CONT2]]:
83- // OPT2-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA6 ]]
83+ // OPT2-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA8 ]]
8484// OPT2-NEXT: ret i32 [[TMP3]]
8585//
8686//.
8787// OPT0: [[META2]] = !{!"bounds-safety-check-ptr-lt-upper-bound"}
8888// OPT0: [[META3]] = !{!"bounds-safety-check-ptr-ge-lower-bound"}
8989//.
9090// OPT2: [[TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0}
91- // OPT2: [[META3]] = !{!"p2 int", [[META31:!.+]], i64 0}
92- // OPT2: [[META31]] = !{!"any pointer", [[META4:![0-9]+]], i64 0}
93- // OPT2: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0}
94- // OPT2: [[META5]] = !{!"Simple C/C++ TBAA"}
95- // OPT2: [[TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0}
96- // OPT2: [[META7]] = !{!"int", [[META4]], i64 0}
97- // OPT2: [[META9]] = !{!"bounds-safety-check-ptr-lt-upper-bound"}
98- // OPT2: [[META10]] = !{!"bounds-safety-check-ptr-ge-lower-bound"}
91+ // OPT2: [[META3]] = !{!"p2 int", [[META4:![0-9]+]], i64 0}
92+ // OPT2: [[META4]] = !{!"any p2 pointer", [[META5:![0-9]+]], i64 0}
93+ // OPT2: [[META5]] = !{!"any pointer", [[META6:![0-9]+]], i64 0}
94+ // OPT2: [[META6]] = !{!"omnipotent char", [[META7:![0-9]+]], i64 0}
95+ // OPT2: [[META7]] = !{!"Simple C/C++ TBAA"}
96+ // OPT2: [[TBAA8]] = !{[[META9:![0-9]+]], [[META9]], i64 0}
97+ // OPT2: [[META9]] = !{!"int", [[META6]], i64 0}
98+ // OPT2: [[TBAA_STRUCT10]] = !{i64 0, i64 24, [[META11:![0-9]+]]}
99+ // OPT2: [[META11]] = !{[[META12:![0-9]+]], [[META12]], i64 0}
100+ // OPT2: [[META12]] = !{!"p1 int", [[META5]], i64 0}
101+ // OPT2: [[META13]] = !{!"bounds-safety-check-ptr-lt-upper-bound"}
102+ // OPT2: [[META14]] = !{!"bounds-safety-check-ptr-ge-lower-bound"}
99103//.
0 commit comments