From 53b99838541491a736c02bf889f8c1dd87107c8d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 25 Jul 2025 15:37:52 -0700 Subject: [PATCH 1/2] Revert "[BoundsSafety] Don't bind lvalues with temporary locations (#10969)" This reverts commit e7a3802d2d8ebed75fc8c077836add06c840a946. --- clang/lib/CodeGen/CGExpr.cpp | 10 +- clang/lib/CodeGen/CGExprAgg.cpp | 20 +- .../CodeGen/constant-eval-count-static-init.c | 14 +- .../count-attr-fields-assign-2-oob2.c | 54 +- .../dep-count-init-list-basic-O2.c | 4 +- .../flexible-array-member-promotion-deref.c | 134 ++--- .../CodeGen/multiple-dependees.c | 20 +- ...exible-array-member-checks-code-coverage.c | 16 +- .../CodeGen/array_subscript_agg.c | 130 ++--- .../CodeGen/builtin-memcpy-count-annotation.c | 22 +- .../CodeGen/call-with-count-ptr.c | 12 +- .../cast-to-count-argument-stmt-expr.c | 12 +- .../CodeGen/constant-eval-count-static-init.c | 20 +- .../count-attr-fields-assign-2-oob2.c | 65 ++- .../counted-to-counted-assignments-O2.c | 2 +- .../counted-to-counted-assignments.c | 70 +-- .../CodeGen/ended_by_assign_checks_seq-O2.c | 6 +- .../CodeGen/ended_by_assign_checks_seq.c | 20 +- .../CodeGen/ended_by_bag_of_bytes.c | 14 +- .../CodeGen/flexible-array-member-bidi-O0.c | 518 +++++++++--------- ...e-array-member-promotion-call-builtin-O2.c | 132 ++--- .../flexible-array-member-promotion-deref.c | 164 +++--- ...exible-array-member-promotion-returns-O2.c | 14 +- .../BoundsSafety/CodeGen/multiple-dependees.c | 26 +- .../CodeGen/nested-flexible-array-member-O2.c | 44 -- ...sted-flexible-array-member-nested-len-O2.c | 49 -- .../nested-flexible-array-member-nested-len.c | 277 ---------- .../CodeGen/nested-flexible-array-member.c | 269 --------- ...exible-array-member-checks-code-coverage.c | 14 +- 29 files changed, 793 insertions(+), 1359 deletions(-) delete mode 100644 clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-O2.c delete mode 100644 clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len-O2.c delete mode 100644 clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len.c delete mode 100644 clang/test/BoundsSafety/CodeGen/nested-flexible-array-member.c diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index d5f3f95e5f1e5..bd0c556455280 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -7071,8 +7071,14 @@ LValue CodeGenFunction::EmitMaterializeSequenceExprLValue( const MaterializeSequenceExpr *MSE) { if (MSE->isBinding()) { for (auto *OVE : MSE->opaquevalues()) { - CodeGenFunction::OpaqueValueMappingData::bind( - *this, OVE, OVE->getSourceExpr()); + if (CodeGenFunction::OpaqueValueMappingData::shouldBindAsLValue(OVE)) { + RValue PtrRV = EmitAnyExpr(OVE->getSourceExpr()); + LValue LV = MakeAddrLValue(PtrRV.getAggregateAddress(), OVE->getType()); + CodeGenFunction::OpaqueValueMappingData::bind(*this, OVE, LV); + } else { + CodeGenFunction::OpaqueValueMappingData::bind( + *this, OVE, OVE->getSourceExpr()); + } } } diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index eedbcdd98d19d..c10069e1c9627 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -441,13 +441,13 @@ void AggExprEmitter::EmitWidePointerBitCast(CastExpr *E) { RValue SrcRV = CGF.EmitAnyExpr(E->getSubExpr()); assert(SrcRV.isAggregate()); Address SrcAddr = SrcRV.getAggregateAddress(); - llvm::Value *Ptr = CGF.GetWidePointerElement(SrcAddr, WPIndex::Pointer); - llvm::Value *Upper = CGF.GetWidePointerElement(SrcAddr, WPIndex::Upper); - llvm::Value *Lower = E->getType()->isBidiIndexablePointerType() + EmitWidePointerToDest(E->getType(), + CGF.GetWidePointerElement(SrcAddr, WPIndex::Pointer), + CGF.GetWidePointerElement(SrcAddr, WPIndex::Upper), + E->getType()->isBidiIndexablePointerType() ? CGF.GetWidePointerElement(SrcAddr, WPIndex::Lower) - : nullptr; - - EmitWidePointerToDest(E->getType(), Ptr, Upper, Lower, ElemBitCast); + : nullptr, + ElemBitCast); } void AggExprEmitter::EmitWidePointer(LValue DestLV, llvm::Value *Ptr, @@ -596,7 +596,13 @@ void AggExprEmitter::VisitPredefinedBoundsCheckExpr( void AggExprEmitter::VisitMaterializeSequenceExpr(MaterializeSequenceExpr *MSE) { if (MSE->isBinding()) { for (auto *OVE : MSE->opaquevalues()) { - CodeGenFunction::OpaqueValueMappingData::bind(CGF, OVE, OVE->getSourceExpr()); + if (CodeGenFunction::OpaqueValueMappingData::shouldBindAsLValue(OVE)) { + RValue PtrRV = CGF.EmitAnyExpr(OVE->getSourceExpr()); + LValue LV = CGF.MakeAddrLValue(PtrRV.getAggregateAddress(), OVE->getType()); + CodeGenFunction::OpaqueValueMappingData::bind(CGF, OVE, LV); + } else { + CodeGenFunction::OpaqueValueMappingData::bind(CGF, OVE, OVE->getSourceExpr()); + } } } diff --git a/clang/test/BoundsSafety-legacy-checks/CodeGen/constant-eval-count-static-init.c b/clang/test/BoundsSafety-legacy-checks/CodeGen/constant-eval-count-static-init.c index 8e8ad44f08d5c..13c9cce4c30fd 100644 --- a/clang/test/BoundsSafety-legacy-checks/CodeGen/constant-eval-count-static-init.c +++ b/clang/test/BoundsSafety-legacy-checks/CodeGen/constant-eval-count-static-init.c @@ -17,9 +17,13 @@ const Item oidRsa = { _oidRsa, sizeof(_oidRsa)}; // CHECK-NEXT: entry: // CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca [[STRUCT_ITEM:%.*]], align 8 // CHECK-NEXT: store i32 0, ptr [[RETVAL]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr getelementptr inbounds nuw ([[STRUCT_ITEM:%.*]], ptr @oidRsa, i32 0, i32 1), align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @oidRsa, align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 @oidRsa, i64 16, i1 false) +// CHECK-NEXT: [[LENGTH:%.*]] = getelementptr inbounds nuw [[STRUCT_ITEM]], ptr [[AGG_TEMP1]], i32 0, i32 1 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[LENGTH]], align 8 +// CHECK-NEXT: [[DATA:%.*]] = getelementptr inbounds nuw [[STRUCT_ITEM]], ptr [[AGG_TEMP1]], i32 0, i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DATA]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP0]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 [[IDX_EXT]] // CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 @@ -42,11 +46,11 @@ const Item oidRsa = { _oidRsa, sizeof(_oidRsa)}; // CHECK-NEXT: unreachable // CHECK: cont: // CHECK-NEXT: [[TMP7:%.*]] = icmp uge ptr [[TMP5]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP7]], label %[[CONT3:.*]], label %[[TRAP2:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP2]]: +// CHECK-NEXT: br i1 [[TMP7]], label [[CONT3:%.*]], label [[TRAP2:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap2: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT3]]: +// CHECK: cont3: // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP5]], align 4 // CHECK-NEXT: ret i32 [[TMP8]] // diff --git a/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c b/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c index 32bcdabf0304a..39a10e41bf936 100644 --- a/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c +++ b/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c @@ -27,8 +27,11 @@ struct S { // CHECK-O0-NEXT: [[AGG_TEMP33:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-O0-NEXT: [[I:%.*]] = alloca i32, align 4 // CHECK-O0-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP43:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[AGG_TEMP56:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP57:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[AGG_TEMP73:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP74:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [10 x i32], ptr [[ARR]], i64 0, i64 0 // CHECK-O0-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY]], i64 10 // CHECK-O0-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0 @@ -146,9 +149,10 @@ struct S { // CHECK-O0-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK-O0: for.body: // CHECK-O0-NEXT: [[TMP24:%.*]] = load i32, ptr [[I]], align 4 -// CHECK-O0-NEXT: [[L44:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP43]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L44:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP43]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP25:%.*]] = load i32, ptr [[L44]], align 8 -// CHECK-O0-NEXT: [[BP45:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-O0-NEXT: [[BP45:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP43]], i32 0, i32 0 // CHECK-O0-NEXT: [[TMP26:%.*]] = load ptr, ptr [[BP45]], align 8 // CHECK-O0-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP25]] to i64 // CHECK-O0-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP26]], i64 [[IDX_EXT]] @@ -168,17 +172,17 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB_ADDR50:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP42]], i32 0, i32 2 // CHECK-O0-NEXT: [[WIDE_PTR_LB51:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR50]], align 8 // CHECK-O0-NEXT: [[TMP31:%.*]] = icmp ult ptr [[ARRAYIDX]], [[WIDE_PTR_UB49]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP31]], label %[[CONT53:.*]], label %[[TRAP52:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP52]]: +// CHECK-O0-NEXT: br i1 [[TMP31]], label [[CONT53:%.*]], label [[TRAP52:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap52: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT53]]: +// CHECK-O0: cont53: // CHECK-O0-NEXT: [[TMP32:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB51]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP32]], label %[[CONT55:.*]], label %[[TRAP54:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP54]]: +// CHECK-O0-NEXT: br i1 [[TMP32]], label [[CONT55:%.*]], label [[TRAP54:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap54: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT55]]: +// CHECK-O0: cont55: // CHECK-O0-NEXT: store i32 [[TMP24]], ptr [[ARRAYIDX]], align 4 // CHECK-O0-NEXT: br label [[FOR_INC:%.*]] // CHECK-O0: for.inc: @@ -187,9 +191,10 @@ struct S { // CHECK-O0-NEXT: store i32 [[INC]], ptr [[I]], align 4 // CHECK-O0-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP5:![0-9]+]] // CHECK-O0: for.end: -// CHECK-O0-NEXT: [[L58:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP57]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L58:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP57]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP34:%.*]] = load i32, ptr [[L58]], align 8 -// CHECK-O0-NEXT: [[BP259:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 +// CHECK-O0-NEXT: [[BP259:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP57]], i32 0, i32 1 // CHECK-O0-NEXT: [[TMP35:%.*]] = load ptr, ptr [[BP259]], align 8 // CHECK-O0-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP34]], 1 // CHECK-O0-NEXT: [[IDX_EXT60:%.*]] = sext i32 [[ADD]] to i64 @@ -208,21 +213,22 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB_ADDR67:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP56]], i32 0, i32 2 // CHECK-O0-NEXT: [[WIDE_PTR_LB68:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR67]], align 8 // CHECK-O0-NEXT: [[TMP39:%.*]] = icmp ult ptr [[ARRAYIDX64]], [[WIDE_PTR_UB66]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP39]], label %[[CONT70:.*]], label %[[TRAP69:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP69]]: +// CHECK-O0-NEXT: br i1 [[TMP39]], label [[CONT70:%.*]], label [[TRAP69:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap69: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT70]]: +// CHECK-O0: cont70: // CHECK-O0-NEXT: [[TMP40:%.*]] = icmp uge ptr [[ARRAYIDX64]], [[WIDE_PTR_LB68]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP40]], label %[[CONT72:.*]], label %[[TRAP71:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP71]]: +// CHECK-O0-NEXT: br i1 [[TMP40]], label [[CONT72:%.*]], label [[TRAP71:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap71: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT72]]: +// CHECK-O0: cont72: // CHECK-O0-NEXT: [[TMP41:%.*]] = load i32, ptr [[ARRAYIDX64]], align 4 -// CHECK-O0-NEXT: [[L75:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP74]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L75:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP74]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP42:%.*]] = load i32, ptr [[L75]], align 8 -// CHECK-O0-NEXT: [[BP76:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-O0-NEXT: [[BP76:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP74]], i32 0, i32 0 // CHECK-O0-NEXT: [[TMP43:%.*]] = load ptr, ptr [[BP76]], align 8 // CHECK-O0-NEXT: [[IDX_EXT77:%.*]] = sext i32 [[TMP42]] to i64 // CHECK-O0-NEXT: [[ADD_PTR78:%.*]] = getelementptr inbounds i32, ptr [[TMP43]], i64 [[IDX_EXT77]] @@ -240,17 +246,17 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB_ADDR84:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP73]], i32 0, i32 2 // CHECK-O0-NEXT: [[WIDE_PTR_LB85:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR84]], align 8 // CHECK-O0-NEXT: [[TMP47:%.*]] = icmp ult ptr [[ARRAYIDX81]], [[WIDE_PTR_UB83]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP47]], label %[[CONT87:.*]], label %[[TRAP86:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP86]]: +// CHECK-O0-NEXT: br i1 [[TMP47]], label [[CONT87:%.*]], label [[TRAP86:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap86: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT87]]: +// CHECK-O0: cont87: // CHECK-O0-NEXT: [[TMP48:%.*]] = icmp uge ptr [[ARRAYIDX81]], [[WIDE_PTR_LB85]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP48]], label %[[CONT89:.*]], label %[[TRAP88:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP88]]: +// CHECK-O0-NEXT: br i1 [[TMP48]], label [[CONT89:%.*]], label [[TRAP88:%.*]], {{!annotation ![0-9]+}} +// CHECK-O0: trap88: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT89]]: +// CHECK-O0: cont89: // CHECK-O0-NEXT: [[TMP49:%.*]] = load i32, ptr [[ARRAYIDX81]], align 4 // CHECK-O0-NEXT: [[ADD90:%.*]] = add nsw i32 [[TMP41]], [[TMP49]] // CHECK-O0-NEXT: ret i32 [[ADD90]] diff --git a/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/dep-count-init-list-basic-O2.c b/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/dep-count-init-list-basic-O2.c index 49043529a573f..92f7309f51c0c 100644 --- a/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/dep-count-init-list-basic-O2.c +++ b/clang/test/BoundsSafety-legacy-checks/CodeGen/count-dependent-assignment-checks/dep-count-init-list-basic-O2.c @@ -102,11 +102,11 @@ void TestAccessFail() { // CHECK-NEXT: [[TMP0:%.*]] = icmp ult ptr [[ARRAYIDX]], [[UPPER]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP1:%.*]] = icmp uge ptr [[ARRAYIDX]], [[ARR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[TMP0]], [[TMP1]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND]], label %[[CONT47:.*]], label [[TRAP:%.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND]], label [[CONT47:%.*]], label [[TRAP:%.*]], {{!annotation ![0-9]+}} // CHECK: trap: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT47]]: +// CHECK: cont47: // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 36, ptr nonnull [[ARR]]) #[[ATTR6]] // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety-legacy-checks/CodeGen/flexible-array-member-promotion-deref.c b/clang/test/BoundsSafety-legacy-checks/CodeGen/flexible-array-member-promotion-deref.c index 4f2ff5b2ef979..70025c13e8371 100644 --- a/clang/test/BoundsSafety-legacy-checks/CodeGen/flexible-array-member-promotion-deref.c +++ b/clang/test/BoundsSafety-legacy-checks/CodeGen/flexible-array-member-promotion-deref.c @@ -36,7 +36,7 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP2]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // CHECK-NEXT: [[FLEX_BASE_NULL_CHECK:%.*]] = icmp ne ptr [[WIDE_PTR_PTR]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK]], label [[FLEX_BASE_NONNULL:%.*]], label %[[CONT32:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK]], label [[FLEX_BASE_NONNULL:%.*]], label [[CONT32:%.*]], {{!annotation ![0-9]+}} // CHECK: flex.base.nonnull: // CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i64 1 // CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[WIDE_PTR_PTR]], [[TMP4]], {{!annotation ![0-9]+}} @@ -54,17 +54,17 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB9:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR8]], align 8 // CHECK-NEXT: [[TMP6:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i64 1 // CHECK-NEXT: [[TMP7:%.*]] = icmp ule ptr [[TMP6]], [[WIDE_PTR_UB7]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP7]], label %[[CONT11:.*]], label %[[TRAP10:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP10]]: +// CHECK-NEXT: br i1 [[TMP7]], label [[CONT11:%.*]], label [[TRAP10:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap10: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT11]]: +// CHECK: cont11: // CHECK-NEXT: [[TMP8:%.*]] = icmp ule ptr [[WIDE_PTR_LB9]], [[WIDE_PTR_PTR5]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP8]], label %[[CONT13:.*]], label %[[TRAP12:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP12]]: +// CHECK-NEXT: br i1 [[TMP8]], label [[CONT13:%.*]], label [[TRAP12:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap12: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT13]]: +// CHECK: cont13: // CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS]], i64 0, i64 0 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP14]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) @@ -76,48 +76,48 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB20:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR19]], align 8 // CHECK-NEXT: [[TMP9:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR16]], i64 1 // CHECK-NEXT: [[TMP10:%.*]] = icmp ule ptr [[TMP9]], [[WIDE_PTR_UB18]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP10]], label %[[CONT22:.*]], label %[[TRAP21:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP21]]: +// CHECK-NEXT: br i1 [[TMP10]], label [[CONT22:%.*]], label [[TRAP21:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap21: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT22]]: +// CHECK: cont22: // CHECK-NEXT: [[TMP11:%.*]] = icmp ule ptr [[WIDE_PTR_LB20]], [[WIDE_PTR_PTR16]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP11]], label %[[CONT24:.*]], label %[[TRAP23:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP23]]: +// CHECK-NEXT: br i1 [[TMP11]], label [[CONT24:%.*]], label [[TRAP23:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap23: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT24]]: +// CHECK: cont24: // CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR16]], i32 0, i32 0 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[COUNT]], align 4 // CHECK-NEXT: [[FLEX_COUNT_MINUS:%.*]] = icmp sle i32 0, [[TMP12]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label %[[CONT26:.*]], label %[[TRAP25:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP25]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label [[CONT26:%.*]], label [[TRAP25:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap25: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT26]]: +// CHECK: cont26: // CHECK-NEXT: [[TMP13:%.*]] = icmp ule ptr [[ARRAYDECAY]], [[WIDE_PTR_UB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP13]], label %[[CONT28:.*]], label %[[TRAP27:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP27]]: +// CHECK-NEXT: br i1 [[TMP13]], label [[CONT28:%.*]], label [[TRAP27:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap27: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT28]]: +// CHECK: cont28: // CHECK-NEXT: [[TMP14:%.*]] = icmp uge ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT30:.*]], label %[[TRAP29:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP29]]: +// CHECK-NEXT: br i1 [[TMP14]], label [[CONT30:%.*]], label [[TRAP29:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap29: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT30]]: +// CHECK: cont30: // CHECK-NEXT: [[UPPER_INTPTR:%.*]] = ptrtoint ptr [[WIDE_PTR_UB]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FAM_INTPTR:%.*]] = ptrtoint ptr [[ARRAYDECAY]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT:%.*]] = sub nuw i64 [[UPPER_INTPTR]], [[FAM_INTPTR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT_DIV:%.*]] = sdiv exact i64 [[FLEX_AVAIL_COUNT]], 4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_INTPTR:%.*]] = zext i32 [[TMP12]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_CHECK:%.*]] = icmp ule i64 [[FLEX_COUNT_INTPTR]], [[FLEX_AVAIL_COUNT_DIV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK]], label %[[CONT32]], label %[[TRAP31:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP31]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK]], label [[CONT32]], label [[TRAP31:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap31: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT32]]: +// CHECK: cont32: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR34:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR33]], align 8 @@ -126,20 +126,20 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB_ADDR37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB38:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR37]], align 8 // CHECK-NEXT: [[TMP15:%.*]] = icmp ne ptr [[WIDE_PTR_PTR34]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP15]], label [[BOUNDSCHECK_NOTNULL:%.*]], label %[[CONT42:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[TMP15]], label [[BOUNDSCHECK_NOTNULL:%.*]], label [[CONT42:%.*]], {{!annotation ![0-9]+}} // CHECK: boundscheck.notnull: // CHECK-NEXT: [[TMP16:%.*]] = icmp ult ptr [[WIDE_PTR_PTR34]], [[WIDE_PTR_UB36]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP16]], label %[[CONT40:.*]], label %[[TRAP39:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP39]]: +// CHECK-NEXT: br i1 [[TMP16]], label [[CONT40:%.*]], label [[TRAP39:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap39: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT40]]: +// CHECK: cont40: // CHECK-NEXT: [[TMP17:%.*]] = icmp uge ptr [[WIDE_PTR_PTR34]], [[WIDE_PTR_LB38]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT42]], label %[[TRAP41:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP41]]: +// CHECK-NEXT: br i1 [[TMP17]], label [[CONT42]], label [[TRAP41:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap41: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT42]]: +// CHECK: cont42: // CHECK-NEXT: ret ptr [[WIDE_PTR_PTR34]] // flex_t *addrof_g(void) { @@ -149,6 +149,7 @@ flex_t *addrof_g(void) { // CHECK-LABEL: @addrof_deref_g( // CHECK-NEXT: entry: // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca [[STRUCT_FLEX_T:%.*]], align 4 // CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @g_flex, align 4 @@ -173,25 +174,26 @@ flex_t *addrof_g(void) { // CHECK-NEXT: unreachable // CHECK: cont: // CHECK-NEXT: [[TMP5:%.*]] = icmp uge ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT4:.*]], label %[[TRAP3:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP3]]: +// CHECK-NEXT: br i1 [[TMP5]], label [[CONT4:%.*]], label [[TRAP3:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap3: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT4]]: -// CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 +// CHECK: cont4: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TEMP1]], ptr align 4 [[WIDE_PTR_PTR]], i64 4, i1 false) +// CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS]], i64 0, i64 0 -// CHECK-NEXT: [[ELEMS6:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 +// CHECK-NEXT: [[ELEMS6:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY7:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS6]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 0 +// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 0 // CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[COUNT]], align 4 // CHECK-NEXT: [[IDX_EXT8:%.*]] = sext i32 [[TMP6]] to i64 // CHECK-NEXT: [[ADD_PTR9:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY7]], i64 [[IDX_EXT8]] // CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP7]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP1]], ptr [[TMP7]], align 8 // CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 1 // CHECK-NEXT: store ptr [[ADD_PTR9]], ptr [[TMP8]], align 8 // CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP9]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP1]], ptr [[TMP9]], align 8 // CHECK-NEXT: [[WIDE_PTR_UB_ADDR10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB11:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR10]], align 8 // CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP5]], i32 0, i32 0 @@ -212,17 +214,17 @@ flex_t *addrof_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR18:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB19:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR18]], align 8 // CHECK-NEXT: [[TMP15:%.*]] = icmp ult ptr [[TMP14]], [[WIDE_PTR_UB17]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT21:.*]], label %[[TRAP20:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP20]]: +// CHECK-NEXT: br i1 [[TMP15]], label [[CONT21:%.*]], label [[TRAP20:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap20: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT21]]: +// CHECK: cont21: // CHECK-NEXT: [[TMP16:%.*]] = icmp uge ptr [[TMP14]], [[WIDE_PTR_LB19]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP16]], label %[[CONT23:.*]], label %[[TRAP22:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP22]]: +// CHECK-NEXT: br i1 [[TMP16]], label [[CONT23:%.*]], label [[TRAP22:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap22: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT23]]: +// CHECK: cont23: // CHECK-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP14]], align 4 // CHECK-NEXT: ret i32 [[TMP17]] // @@ -240,6 +242,7 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[AGG_TEMP3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP14:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP43:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP44:%.*]] = alloca [[STRUCT_FLEX_T:%.*]], align 4 // CHECK-NEXT: [[AGG_TEMP45:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP62:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: store ptr [[P:%.*]], ptr [[P_INDIRECT_ADDR]], align 8 @@ -359,8 +362,8 @@ int addrof_deref_g(void) { // CHECK-NEXT: store ptr [[WIDE_PTR_PTR34]], ptr [[FLEX]], align 8 // CHECK-NEXT: [[TMP14:%.*]] = load ptr, ptr [[FLEX]], align 8 // CHECK-NEXT: [[TMP15:%.*]] = icmp ne ptr [[TMP14]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP15]], label %[[BOUNDSCHECK_NOTNULL46:.*]], label [[BOUNDSCHECK_NULL:%.*]], {{!annotation ![0-9]+}} -// CHECK: [[BOUNDSCHECK_NOTNULL46]]: +// CHECK-NEXT: br i1 [[TMP15]], label [[BOUNDSCHECK_NOTNULL46:%.*]], label [[BOUNDSCHECK_NULL:%.*]], {{!annotation ![0-9]+}} +// CHECK: boundscheck.notnull46: // CHECK-NEXT: [[ELEMS47:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[TMP14]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY48:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS47]], i64 0, i64 0 // CHECK-NEXT: [[COUNT49:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[TMP14]], i32 0, i32 0 @@ -390,31 +393,32 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP45]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB55:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR54]], align 8 // CHECK-NEXT: [[TMP23:%.*]] = icmp ult ptr [[WIDE_PTR_PTR51]], [[WIDE_PTR_UB53]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP23]], label %[[CONT57:.*]], label %[[TRAP56:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP56]]: +// CHECK-NEXT: br i1 [[TMP23]], label [[CONT57:%.*]], label [[TRAP56:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap56: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT57]]: +// CHECK: cont57: // CHECK-NEXT: [[TMP24:%.*]] = icmp uge ptr [[WIDE_PTR_PTR51]], [[WIDE_PTR_LB55]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP24]], label %[[CONT59:.*]], label %[[TRAP58:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP58]]: +// CHECK-NEXT: br i1 [[TMP24]], label [[CONT59:%.*]], label [[TRAP58:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap58: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT59]]: -// CHECK-NEXT: [[ELEMS60:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR51]], i32 0, i32 1 +// CHECK: cont59: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TEMP44]], ptr align 4 [[WIDE_PTR_PTR51]], i64 4, i1 false) +// CHECK-NEXT: [[ELEMS60:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP44]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY61:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS60]], i64 0, i64 0 -// CHECK-NEXT: [[ELEMS63:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR51]], i32 0, i32 1 +// CHECK-NEXT: [[ELEMS63:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP44]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY64:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS63]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT65:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR51]], i32 0, i32 0 +// CHECK-NEXT: [[COUNT65:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP44]], i32 0, i32 0 // CHECK-NEXT: [[TMP25:%.*]] = load i32, ptr [[COUNT65]], align 4 // CHECK-NEXT: [[IDX_EXT66:%.*]] = sext i32 [[TMP25]] to i64 // CHECK-NEXT: [[ADD_PTR67:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY64]], i64 [[IDX_EXT66]] // CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP62]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR51]], ptr [[TMP26]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP44]], ptr [[TMP26]], align 8 // CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP62]], i32 0, i32 1 // CHECK-NEXT: store ptr [[ADD_PTR67]], ptr [[TMP27]], align 8 // CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP62]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR51]], ptr [[TMP28]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP44]], ptr [[TMP28]], align 8 // CHECK-NEXT: [[WIDE_PTR_UB_ADDR68:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP62]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB69:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR68]], align 8 // CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP62]], i32 0, i32 0 @@ -435,17 +439,17 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR76:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP43]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB77:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR76]], align 8 // CHECK-NEXT: [[TMP34:%.*]] = icmp ult ptr [[TMP33]], [[WIDE_PTR_UB75]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP34]], label %[[CONT79:.*]], label %[[TRAP78:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP78]]: +// CHECK-NEXT: br i1 [[TMP34]], label [[CONT79:%.*]], label [[TRAP78:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap78: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT79]]: +// CHECK: cont79: // CHECK-NEXT: [[TMP35:%.*]] = icmp uge ptr [[TMP33]], [[WIDE_PTR_LB77]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP35]], label %[[CONT81:.*]], label %[[TRAP80:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP80]]: +// CHECK-NEXT: br i1 [[TMP35]], label [[CONT81:%.*]], label [[TRAP80:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap80: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT81]]: +// CHECK: cont81: // CHECK-NEXT: store i32 10, ptr [[TMP33]], align 4 // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety-legacy-checks/CodeGen/multiple-dependees.c b/clang/test/BoundsSafety-legacy-checks/CodeGen/multiple-dependees.c index 910750254ddd9..4de5581828efd 100644 --- a/clang/test/BoundsSafety-legacy-checks/CodeGen/multiple-dependees.c +++ b/clang/test/BoundsSafety-legacy-checks/CodeGen/multiple-dependees.c @@ -27,6 +27,7 @@ struct T { // CHECK-NEXT: [[AGG_TEMP20:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP32:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP40:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP41:%.*]] = alloca [[STRUCT_T]], align 8 // CHECK-NEXT: store i32 [[IDX:%.*]], ptr [[IDX_ADDR]], align 4 // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 16 [[ARR]], i8 0, i64 64, i1 false) // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [16 x i32], ptr [[ARR]], i64 0, i64 0 @@ -111,11 +112,12 @@ struct T { // CHECK-NEXT: [[WIDE_PTR_LB38:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR37]], align 8 // CHECK-NEXT: [[PTR39:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 2 // CHECK-NEXT: store ptr [[WIDE_PTR_PTR34]], ptr [[PTR39]], align 8 -// CHECK-NEXT: [[CNT142:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP41]], ptr align 8 [[T]], i64 16, i1 false) +// CHECK-NEXT: [[CNT142:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 0 // CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[CNT142]], align 8 -// CHECK-NEXT: [[CNT243:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 1 +// CHECK-NEXT: [[CNT243:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 1 // CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[CNT243]], align 4 -// CHECK-NEXT: [[PTR44:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 2 +// CHECK-NEXT: [[PTR44:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 2 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[PTR44]], align 8 // CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 2, [[TMP5]] // CHECK-NEXT: [[MUL45:%.*]] = mul nsw i32 3, [[TMP6]] @@ -138,17 +140,17 @@ struct T { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR50:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP40]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB51:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR50]], align 8 // CHECK-NEXT: [[TMP13:%.*]] = icmp ult ptr [[TMP12]], [[WIDE_PTR_UB49]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP13]], label %[[CONT53:.*]], label %[[TRAP52:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP52]]: +// CHECK-NEXT: br i1 [[TMP13]], label [[CONT53:%.*]], label [[TRAP52:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap52: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT53]]: +// CHECK: cont53: // CHECK-NEXT: [[TMP14:%.*]] = icmp uge ptr [[TMP12]], [[WIDE_PTR_LB51]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT55:.*]], label %[[TRAP54:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP54]]: +// CHECK-NEXT: br i1 [[TMP14]], label [[CONT55:%.*]], label [[TRAP54:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap54: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT55]]: +// CHECK: cont55: // CHECK-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP12]], align 4 // CHECK-NEXT: ret i32 [[TMP15]] // diff --git a/clang/test/BoundsSafety-legacy-checks/Profile/flexible-array-member-checks-code-coverage.c b/clang/test/BoundsSafety-legacy-checks/Profile/flexible-array-member-checks-code-coverage.c index 711e2b8d9b013..2f13fef9e416f 100644 --- a/clang/test/BoundsSafety-legacy-checks/Profile/flexible-array-member-checks-code-coverage.c +++ b/clang/test/BoundsSafety-legacy-checks/Profile/flexible-array-member-checks-code-coverage.c @@ -20,30 +20,30 @@ void bar(struct s *p); // CHECK-NEXT: store i64 [[TMP0]], ptr @__profc_foo, align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[SIZE]] to i64 // CHECK-NEXT: [[FLEX_BASE_NULL_CHECK_NOT:%.*]] = icmp eq ptr [[BUF]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label %[[CONT40:.*]], label [[FLEX_BASE_NONNULL:%.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label [[CONT40:%.*]], label [[FLEX_BASE_NONNULL:%.*]], {{!annotation ![0-9]+}} // CHECK: flex.base.nonnull: // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[BUF]], i64 [[IDX_EXT]] // CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[BUF]], i64 4 // CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[BUF]], [[TMP1]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[DOTNOT49:%.*]] = icmp ugt ptr [[TMP1]], [[ADD_PTR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[DOTNOT]], i1 true, i1 [[DOTNOT49]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND]], label %[[TRAP:.*]], label %[[CONT27:.*]], !prof [[PROF6:![0-9]+]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP]]: +// CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT27:%.*]], !prof [[PROF6:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK: trap: // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT27]]: +// CHECK: cont27: // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[BUF]], align 4, {{!tbaa ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_MINUS:%.*]] = icmp sgt i32 [[TMP2]], -1, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label %[[CONT30:.*]], label %[[TRAP]], !prof [[PROF13:![0-9]+]], {{!annotation ![0-9]+}} -// CHECK: [[CONT30]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label [[CONT30:%.*]], label [[TRAP]], !prof [[PROF13:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK: cont30: // CHECK-NEXT: [[GEPDIFF:%.*]] = add nsw i64 [[IDX_EXT]], -4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT_DIV:%.*]] = ashr exact i64 [[GEPDIFF]], 2, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_INTPTR:%.*]] = zext nneg i32 [[TMP2]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_CHECK_NOT:%.*]] = icmp ult i64 [[FLEX_AVAIL_COUNT_DIV]], [[FLEX_COUNT_INTPTR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[DOTNOT50:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} // CHECK-NEXT: [[OR_COND52:%.*]] = or i1 [[DOTNOT50]], [[FLEX_COUNT_CHECK_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND52]], label %[[TRAP]], label %[[CONT40]], !prof [[PROF17:![0-9]+]], {{!annotation ![0-9]+}} -// CHECK: [[CONT40]]: +// CHECK-NEXT: br i1 [[OR_COND52]], label [[TRAP]], label [[CONT40]], !prof [[PROF17:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK: cont40: // CHECK-NEXT: tail call void @bar(ptr noundef [[BUF]]) #[[ATTR4:[0-9]+]] // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c b/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c index 30753b1e12bff..cb7869dc0d795 100644 --- a/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c +++ b/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c @@ -12,7 +12,7 @@ struct Foo { }; // NEW-LABEL: define dso_local i64 @access_Foo_bi( -// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { +// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -54,7 +54,7 @@ struct Foo { // NEW-NEXT: ret i64 [[TMP5]] // // LEGACY-LABEL: define dso_local i64 @access_Foo_bi( -// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { +// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -807,22 +807,24 @@ struct HasFAM { // ArraySubscriptExpr (rdar://145253815). // NEW-LABEL: define dso_local i64 @access_Foo_from_HasFAM( -// NEW-SAME: ptr dead_on_return noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-SAME: ptr noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[HAS_FAM_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 // NEW-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // NEW-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// NEW-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// NEW-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// NEW-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 // NEW-NEXT: store ptr [[HAS_FAM]], ptr [[HAS_FAM_INDIRECT_ADDR]], align 8 // NEW-NEXT: store i32 [[IDX]], ptr [[IDX_ADDR]], align 4 // NEW-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 [[HAS_FAM]], i64 24, i1 false) -// NEW-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 0 +// NEW-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP2]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// NEW-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 0 // NEW-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// NEW-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 1 +// NEW-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 1 // NEW-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// NEW-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 2 +// NEW-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 2 // NEW-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // NEW-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_HASFAM:%.*]], ptr [[WIDE_PTR_PTR]], i64 1 // NEW-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[WIDE_PTR_UB]], !annotation [[META6:![0-9]+]] @@ -832,75 +834,77 @@ struct HasFAM { // NEW-NEXT: unreachable, !annotation [[META6]] // NEW: [[CONT]]: // NEW-NEXT: [[TMP2:%.*]] = icmp ule ptr [[WIDE_PTR_LB]], [[WIDE_PTR_PTR]], !annotation [[META4]] -// NEW-NEXT: br i1 [[TMP2]], label %[[CONT3:.*]], label %[[TRAP2:.*]], !prof [[PROF3]], !annotation [[META4]] -// NEW: [[TRAP2]]: +// NEW-NEXT: br i1 [[TMP2]], label %[[CONT4:.*]], label %[[TRAP3:.*]], !prof [[PROF3]], !annotation [[META4]] +// NEW: [[TRAP3]]: // NEW-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META4]] // NEW-NEXT: unreachable, !annotation [[META4]] -// NEW: [[CONT3]]: +// NEW: [[CONT4]]: // NEW-NEXT: [[FAM:%.*]] = getelementptr inbounds nuw [[STRUCT_HASFAM]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 // NEW-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x %struct.Foo], ptr [[FAM]], i64 0, i64 0 -// NEW-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[HAS_FAM]], i64 24, i1 false) -// NEW-NEXT: [[WIDE_PTR_UB_ADDR5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 1 -// NEW-NEXT: [[WIDE_PTR_UB6:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR5]], align 8 -// NEW-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// NEW-NEXT: store ptr [[WIDE_PTR_UB6]], ptr [[TMP3]], align 8 -// NEW-NEXT: [[WIDE_PTR_PTR_ADDR7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// NEW-NEXT: [[WIDE_PTR_PTR8:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR7]], align 8 +// NEW-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP5]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// NEW-NEXT: [[WIDE_PTR_UB_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 1 +// NEW-NEXT: [[WIDE_PTR_UB7:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR6]], align 8 +// NEW-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// NEW-NEXT: store ptr [[WIDE_PTR_UB7]], ptr [[TMP3]], align 8 +// NEW-NEXT: [[WIDE_PTR_PTR_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// NEW-NEXT: [[WIDE_PTR_PTR9:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR8]], align 8 // NEW-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 // NEW-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP4]], align 8 // NEW-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1 -// NEW-NEXT: store ptr [[WIDE_PTR_PTR8]], ptr [[TMP5]], align 8 +// NEW-NEXT: store ptr [[WIDE_PTR_PTR9]], ptr [[TMP5]], align 8 // NEW-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 // NEW-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP6]], align 8 -// NEW-NEXT: [[WIDE_PTR_PTR_ADDR9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 -// NEW-NEXT: [[WIDE_PTR_PTR10:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR9]], align 8 +// NEW-NEXT: [[WIDE_PTR_PTR_ADDR10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 +// NEW-NEXT: [[WIDE_PTR_PTR11:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR10]], align 8 // NEW-NEXT: [[TMP7:%.*]] = load i32, ptr [[IDX_ADDR]], align 4 // NEW-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP7]] to i64 -// NEW-NEXT: [[ARRAYIDX:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[WIDE_PTR_PTR10]], i64 [[IDXPROM]] -// NEW-NEXT: [[WIDE_PTR_UB_ADDR11:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1 -// NEW-NEXT: [[WIDE_PTR_UB12:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR11]], align 8 -// NEW-NEXT: [[WIDE_PTR_LB_ADDR13:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 -// NEW-NEXT: [[WIDE_PTR_LB14:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR13]], align 8 +// NEW-NEXT: [[ARRAYIDX:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[WIDE_PTR_PTR11]], i64 [[IDXPROM]] +// NEW-NEXT: [[WIDE_PTR_UB_ADDR12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1 +// NEW-NEXT: [[WIDE_PTR_UB13:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR12]], align 8 +// NEW-NEXT: [[WIDE_PTR_LB_ADDR14:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 +// NEW-NEXT: [[WIDE_PTR_LB15:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR14]], align 8 // NEW-NEXT: [[TMP8:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[ARRAYIDX]], i64 1, !annotation [[META2]] -// NEW-NEXT: [[TMP9:%.*]] = icmp ule ptr [[TMP8]], [[WIDE_PTR_UB12]], !annotation [[META2]] -// NEW-NEXT: br i1 [[TMP9]], label %[[CONT16:.*]], label %[[TRAP15:.*]], !prof [[PROF3]], !annotation [[META2]] -// NEW: [[TRAP15]]: +// NEW-NEXT: [[TMP9:%.*]] = icmp ule ptr [[TMP8]], [[WIDE_PTR_UB13]], !annotation [[META2]] +// NEW-NEXT: br i1 [[TMP9]], label %[[CONT17:.*]], label %[[TRAP16:.*]], !prof [[PROF3]], !annotation [[META2]] +// NEW: [[TRAP16]]: // NEW-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]] // NEW-NEXT: unreachable, !annotation [[META2]] -// NEW: [[CONT16]]: +// NEW: [[CONT17]]: // NEW-NEXT: [[TMP10:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP8]], !annotation [[META2]] -// NEW-NEXT: br i1 [[TMP10]], label %[[CONT18:.*]], label %[[TRAP17:.*]], !prof [[PROF3]], !annotation [[META2]] -// NEW: [[TRAP17]]: +// NEW-NEXT: br i1 [[TMP10]], label %[[CONT19:.*]], label %[[TRAP18:.*]], !prof [[PROF3]], !annotation [[META2]] +// NEW: [[TRAP18]]: // NEW-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META2]] // NEW-NEXT: unreachable, !annotation [[META2]] -// NEW: [[CONT18]]: -// NEW-NEXT: [[TMP11:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB14]], !annotation [[META4]] -// NEW-NEXT: br i1 [[TMP11]], label %[[CONT20:.*]], label %[[TRAP19:.*]], !prof [[PROF3]], !annotation [[META4]] -// NEW: [[TRAP19]]: +// NEW: [[CONT19]]: +// NEW-NEXT: [[TMP11:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB15]], !annotation [[META4]] +// NEW-NEXT: br i1 [[TMP11]], label %[[CONT21:.*]], label %[[TRAP20:.*]], !prof [[PROF3]], !annotation [[META4]] +// NEW: [[TRAP20]]: // NEW-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META4]] // NEW-NEXT: unreachable, !annotation [[META4]] -// NEW: [[CONT20]]: +// NEW: [[CONT21]]: // NEW-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[RETVAL]], ptr align 4 [[ARRAYIDX]], i64 8, i1 false) // NEW-NEXT: [[TMP12:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP12]] // // LEGACY-LABEL: define dso_local i64 @access_Foo_from_HasFAM( -// LEGACY-SAME: ptr dead_on_return noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-SAME: ptr noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[HAS_FAM_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 // LEGACY-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // LEGACY-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// LEGACY-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// LEGACY-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// LEGACY-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 // LEGACY-NEXT: store ptr [[HAS_FAM]], ptr [[HAS_FAM_INDIRECT_ADDR]], align 8 // LEGACY-NEXT: store i32 [[IDX]], ptr [[IDX_ADDR]], align 4 // LEGACY-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 [[HAS_FAM]], i64 24, i1 false) -// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 0 +// LEGACY-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP2]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 0 // LEGACY-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// LEGACY-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 1 +// LEGACY-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 1 // LEGACY-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// LEGACY-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 2 +// LEGACY-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 2 // LEGACY-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // LEGACY-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_HASFAM:%.*]], ptr [[WIDE_PTR_PTR]], i64 1 // LEGACY-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[WIDE_PTR_UB]], !annotation [[META3:![0-9]+]] @@ -910,31 +914,31 @@ struct HasFAM { // LEGACY-NEXT: unreachable, !annotation [[META3]] // LEGACY: [[CONT]]: // LEGACY-NEXT: [[TMP2:%.*]] = icmp ule ptr [[WIDE_PTR_LB]], [[WIDE_PTR_PTR]], !annotation [[META5:![0-9]+]] -// LEGACY-NEXT: br i1 [[TMP2]], label %[[CONT3:.*]], label %[[TRAP2:.*]], !prof [[PROF4]], !annotation [[META5]] -// LEGACY: [[TRAP2]]: +// LEGACY-NEXT: br i1 [[TMP2]], label %[[CONT4:.*]], label %[[TRAP3:.*]], !prof [[PROF4]], !annotation [[META5]] +// LEGACY: [[TRAP3]]: // LEGACY-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], !annotation [[META5]] // LEGACY-NEXT: unreachable, !annotation [[META5]] -// LEGACY: [[CONT3]]: +// LEGACY: [[CONT4]]: // LEGACY-NEXT: [[FAM:%.*]] = getelementptr inbounds nuw [[STRUCT_HASFAM]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 // LEGACY-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x %struct.Foo], ptr [[FAM]], i64 0, i64 0 -// LEGACY-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[HAS_FAM]], i64 24, i1 false) -// LEGACY-NEXT: [[WIDE_PTR_UB_ADDR5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 1 -// LEGACY-NEXT: [[WIDE_PTR_UB6:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR5]], align 8 -// LEGACY-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// LEGACY-NEXT: store ptr [[WIDE_PTR_UB6]], ptr [[TMP3]], align 8 -// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// LEGACY-NEXT: [[WIDE_PTR_PTR8:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR7]], align 8 +// LEGACY-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP5]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// LEGACY-NEXT: [[WIDE_PTR_UB_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 1 +// LEGACY-NEXT: [[WIDE_PTR_UB7:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR6]], align 8 +// LEGACY-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// LEGACY-NEXT: store ptr [[WIDE_PTR_UB7]], ptr [[TMP3]], align 8 +// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// LEGACY-NEXT: [[WIDE_PTR_PTR9:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR8]], align 8 // LEGACY-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 // LEGACY-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP4]], align 8 // LEGACY-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 1 -// LEGACY-NEXT: store ptr [[WIDE_PTR_PTR8]], ptr [[TMP5]], align 8 +// LEGACY-NEXT: store ptr [[WIDE_PTR_PTR9]], ptr [[TMP5]], align 8 // LEGACY-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 // LEGACY-NEXT: store ptr [[ARRAYDECAY]], ptr [[TMP6]], align 8 -// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 -// LEGACY-NEXT: [[WIDE_PTR_PTR10:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR9]], align 8 +// LEGACY-NEXT: [[WIDE_PTR_PTR_ADDR10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 +// LEGACY-NEXT: [[WIDE_PTR_PTR11:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR10]], align 8 // LEGACY-NEXT: [[TMP7:%.*]] = load i32, ptr [[IDX_ADDR]], align 4 // LEGACY-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP7]] to i64 -// LEGACY-NEXT: [[ARRAYIDX:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[WIDE_PTR_PTR10]], i64 [[IDXPROM]] +// LEGACY-NEXT: [[ARRAYIDX:%.*]] = getelementptr [[STRUCT_FOO]], ptr [[WIDE_PTR_PTR11]], i64 [[IDXPROM]] // LEGACY-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[RETVAL]], ptr align 4 [[ARRAYIDX]], i64 8, i1 false) // LEGACY-NEXT: [[TMP8:%.*]] = load i64, ptr [[RETVAL]], align 4 // LEGACY-NEXT: ret i64 [[TMP8]] @@ -1031,7 +1035,7 @@ struct Foo access_Foo_eb(struct Foo* __ended_by(end) start, int idx, struct Foo* } // NEW-LABEL: define dso_local i32 @access_Foo_member_bi( -// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1072,7 +1076,7 @@ struct Foo access_Foo_eb(struct Foo* __ended_by(end) start, int idx, struct Foo* // NEW-NEXT: ret i32 [[TMP5]] // // LEGACY-LABEL: define dso_local i32 @access_Foo_member_bi( -// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1423,7 +1427,7 @@ struct Foo access_MemberIsAgg_member_bidi(struct MemberIsAgg* __indexable ptr, i // Access using ptr arithmetic has identical codegen // NEW-LABEL: define dso_local i64 @access_Foo_bi_ptr_arith( -// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -1478,7 +1482,7 @@ struct Foo access_MemberIsAgg_member_bidi(struct MemberIsAgg* __indexable ptr, i // NEW-NEXT: ret i64 [[TMP14]] // // LEGACY-LABEL: define dso_local i64 @access_Foo_bi_ptr_arith( -// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -1530,7 +1534,7 @@ struct Foo access_Foo_bi_ptr_arith(struct Foo* __bidi_indexable ptr, int idx) { } // NEW-LABEL: define dso_local void @compute_addr_with_subscript_Foo_bi( -// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1557,7 +1561,7 @@ struct Foo access_Foo_bi_ptr_arith(struct Foo* __bidi_indexable ptr, int idx) { // NEW-NEXT: ret void // // LEGACY-LABEL: define dso_local void @compute_addr_with_subscript_Foo_bi( -// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1588,7 +1592,7 @@ void compute_addr_with_subscript_Foo_bi(struct Foo* __bidi_indexable ptr, int id } // NEW-LABEL: define dso_local void @compute_addr_with_ptr_arith_Foo_bi( -// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1648,7 +1652,7 @@ void compute_addr_with_subscript_Foo_bi(struct Foo* __bidi_indexable ptr, int id // NEW-NEXT: ret void // // LEGACY-LABEL: define dso_local void @compute_addr_with_ptr_arith_Foo_bi( -// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 diff --git a/clang/test/BoundsSafety/CodeGen/builtin-memcpy-count-annotation.c b/clang/test/BoundsSafety/CodeGen/builtin-memcpy-count-annotation.c index 2428816997820..77be34d119921 100644 --- a/clang/test/BoundsSafety/CodeGen/builtin-memcpy-count-annotation.c +++ b/clang/test/BoundsSafety/CodeGen/builtin-memcpy-count-annotation.c @@ -178,8 +178,8 @@ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR88:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP81]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB89:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR88]], align 8 // CHECK-NEXT: [[CMP90:%.*]] = icmp ule ptr [[WIDE_PTR_PTR76]], [[WIDE_PTR_PTR85]] -// CHECK-NEXT: br i1 [[CMP90]], label %[[LAND_LHS_TRUE91:.*]], label %[[LAND_END144:.*]], -// CHECK: [[LAND_LHS_TRUE91]]: +// CHECK-NEXT: br i1 [[CMP90]], label [[LAND_LHS_TRUE91:%.*]], label [[LAND_END144:%.*]] +// CHECK: land.lhs.true91: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP92]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_LB_ADDR93:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP92]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB94:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR93]], align 8 @@ -199,8 +199,8 @@ // CHECK-NEXT: [[WIDE_PTR_LB_ADDR106:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP101]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB107:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR106]], align 8 // CHECK-NEXT: [[CMP108:%.*]] = icmp ule ptr [[WIDE_PTR_PTR96]], [[WIDE_PTR_PTR103]] -// CHECK-NEXT: br i1 [[CMP108]], label %[[LAND_RHS109:.*]], label %[[LAND_END144]] -// CHECK: [[LAND_RHS109]]: +// CHECK-NEXT: br i1 [[CMP108]], label [[LAND_RHS109:%.*]], label [[LAND_END144]] +// CHECK: land.rhs109: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP111]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_UB_ADDR112:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP111]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB113:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR112]], align 8 @@ -246,15 +246,15 @@ // CHECK-NEXT: [[SUB_PTR_LHS_CAST140:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR121]] to i64 // CHECK-NEXT: [[SUB_PTR_RHS_CAST141:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR135]] to i64 // CHECK-NEXT: [[SUB_PTR_SUB142:%.*]] = sub i64 [[SUB_PTR_LHS_CAST140]], [[SUB_PTR_RHS_CAST141]] -// CHECK-NEXT: [[CMP143:%.*]] = icmp ule i64 10, [[SUB_PTR_SUB142]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br label %[[LAND_END144]] -// CHECK: [[LAND_END144]]: {{.*}} -// CHECK-NEXT: [[TMP25:%.*]] = phi i1 [ false, %[[LAND_LHS_TRUE91]] ], [ false, [[CONT]] ], [ [[CMP143]], %[[LAND_RHS109]] ], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP25]], label %[[CONT146:.*]], label %[[TRAP145:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP145]]: +// CHECK-NEXT: [[CMP143:%.*]] = icmp ule i64 10, [[SUB_PTR_SUB142]] +// CHECK-NEXT: br label [[LAND_END144]] +// CHECK: land.end144: +// CHECK-NEXT: [[TMP25:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE91]] ], [ false, [[CONT]] ], [ [[CMP143]], [[LAND_RHS109]] ], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[TMP25]], label [[CONT146:%.*]], label [[TRAP145:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap145: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable -// CHECK: [[CONT146]]: +// CHECK: cont146: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP147]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR148:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP147]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR149:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR148]], align 8 diff --git a/clang/test/BoundsSafety/CodeGen/call-with-count-ptr.c b/clang/test/BoundsSafety/CodeGen/call-with-count-ptr.c index 105bdb905e4d9..2ede5ecb200aa 100644 --- a/clang/test/BoundsSafety/CodeGen/call-with-count-ptr.c +++ b/clang/test/BoundsSafety/CodeGen/call-with-count-ptr.c @@ -241,11 +241,11 @@ int arr[] = {0, 1, 2, 3, 4, 5}; // CHECK_X64_O0-NEXT: br label [[LAND_END]] // CHECK_X64_O0: land.end: // CHECK_X64_O0-NEXT: [[TMP38:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE]] ], [ false, [[CONT]] ], [ [[CMP116]], [[LAND_RHS]] ], {{!annotation ![0-9]+}} -// CHECK_X64_O0-NEXT: br i1 [[TMP38]], label %[[CONT118:.*]], label %[[TRAP117:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK_X64_O0: [[TRAP117]]: +// CHECK_X64_O0-NEXT: br i1 [[TMP38]], label [[CONT118:%.*]], label [[TRAP117:%.*]], {{!annotation ![0-9]+}} +// CHECK_X64_O0: trap117: // CHECK_X64_O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK_X64_O0-NEXT: unreachable -// CHECK_X64_O0: [[CONT118]]: +// CHECK_X64_O0: cont118: // CHECK_X64_O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP119]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) // CHECK_X64_O0-NEXT: [[WIDE_PTR_PTR_ADDR120:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP119]], i32 0, i32 0 // CHECK_X64_O0-NEXT: [[WIDE_PTR_PTR121:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR120]], align 8 @@ -491,11 +491,11 @@ int arr[] = {0, 1, 2, 3, 4, 5}; // CHECK_ARM64_O0-NEXT: br label [[LAND_END]] // CHECK_ARM64_O0: land.end: // CHECK_ARM64_O0-NEXT: [[TMP38:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE]] ], [ false, [[CONT]] ], [ [[CMP116]], [[LAND_RHS]] ], {{!annotation ![0-9]+}} -// CHECK_ARM64_O0-NEXT: br i1 [[TMP38]], label %[[CONT118:.*]], label %[[TRAP117:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK_ARM64_O0: [[TRAP117]]: +// CHECK_ARM64_O0-NEXT: br i1 [[TMP38]], label [[CONT118:%.*]], label [[TRAP117:%.*]], {{!annotation ![0-9]+}} +// CHECK_ARM64_O0: trap117: // CHECK_ARM64_O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK_ARM64_O0-NEXT: unreachable -// CHECK_ARM64_O0: [[CONT118]]: +// CHECK_ARM64_O0: cont118: // CHECK_ARM64_O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP119]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) // CHECK_ARM64_O0-NEXT: [[WIDE_PTR_PTR_ADDR120:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP119]], i32 0, i32 0 // CHECK_ARM64_O0-NEXT: [[WIDE_PTR_PTR121:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR120]], align 8 diff --git a/clang/test/BoundsSafety/CodeGen/cast-to-count-argument-stmt-expr.c b/clang/test/BoundsSafety/CodeGen/cast-to-count-argument-stmt-expr.c index 07712ec7bebd1..9d7a8f9e108ff 100644 --- a/clang/test/BoundsSafety/CodeGen/cast-to-count-argument-stmt-expr.c +++ b/clang/test/BoundsSafety/CodeGen/cast-to-count-argument-stmt-expr.c @@ -32,6 +32,7 @@ void Foo(int *__indexable ptr); // CHECK-NEXT: [[AGG_TEMP27:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP30:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP51:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [10 x i32], ptr [[ARR]], i64 0, i64 0 // CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY]], i64 10 // CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0 @@ -146,9 +147,10 @@ void Foo(int *__indexable ptr); // CHECK-NEXT: store ptr [[WIDE_PTR_PTR44]], ptr [[BUF49]], align 8 // CHECK-NEXT: [[LEN50:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 // CHECK-NEXT: store i32 0, ptr [[LEN50]], align 8 -// CHECK-NEXT: [[LEN52:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP51]], ptr align 8 [[S]], i64 16, i1 false) +// CHECK-NEXT: [[LEN52:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP51]], i32 0, i32 0 // CHECK-NEXT: [[TMP18:%.*]] = load i32, ptr [[LEN52]], align 8 -// CHECK-NEXT: [[BUF53:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 +// CHECK-NEXT: [[BUF53:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP51]], i32 0, i32 1 // CHECK-NEXT: [[TMP19:%.*]] = load ptr, ptr [[BUF53]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP18]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP19]], i64 [[IDX_EXT]] @@ -166,11 +168,11 @@ void Foo(int *__indexable ptr); // CHECK-NEXT: [[WIDE_PTR_LB_ADDR58:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2, {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_LB59:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR58]], align 8, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP23:%.*]] = icmp uge ptr [[WIDE_PTR_PTR55]], [[WIDE_PTR_LB59]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP23]], label %[[CONT61:.*]], label %[[TRAP60:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP60]]: +// CHECK-NEXT: br i1 [[TMP23]], label [[CONT61:%.*]], label [[TRAP60:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap60: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT61]]: +// CHECK: cont61: // CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.indexable", ptr [[AGG_TMP]], i32 0, i32 0 // CHECK-NEXT: store ptr [[WIDE_PTR_PTR55]], ptr [[TMP24]], align 8 // CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.indexable", ptr [[AGG_TMP]], i32 0, i32 1 diff --git a/clang/test/BoundsSafety/CodeGen/constant-eval-count-static-init.c b/clang/test/BoundsSafety/CodeGen/constant-eval-count-static-init.c index e23e6df6bca79..67da0f4492dba 100644 --- a/clang/test/BoundsSafety/CodeGen/constant-eval-count-static-init.c +++ b/clang/test/BoundsSafety/CodeGen/constant-eval-count-static-init.c @@ -16,9 +16,13 @@ const Item oidRsa = { _oidRsa, sizeof(_oidRsa)}; // CHECK-NEXT: entry: // CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca [[STRUCT_ITEM:%.*]], align 8 // CHECK-NEXT: store i32 0, ptr [[RETVAL]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr getelementptr inbounds nuw ([[STRUCT_ITEM:%.*]], ptr @oidRsa, i32 0, i32 1), align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @oidRsa, align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 @oidRsa, i64 16, i1 false) +// CHECK-NEXT: [[LENGTH:%.*]] = getelementptr inbounds nuw [[STRUCT_ITEM]], ptr [[AGG_TEMP1]], i32 0, i32 1 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[LENGTH]], align 8 +// CHECK-NEXT: [[DATA:%.*]] = getelementptr inbounds nuw [[STRUCT_ITEM]], ptr [[AGG_TEMP1]], i32 0, i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DATA]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP0]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 [[IDX_EXT]] // CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 @@ -42,17 +46,17 @@ const Item oidRsa = { _oidRsa, sizeof(_oidRsa)}; // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} // CHECK: cont: // CHECK-NEXT: [[TMP7:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP5]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP7]], label %[[CONT3:.*]], label %[[TRAP2:.*]], !prof [[PROF3]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP2]]: +// CHECK-NEXT: br i1 [[TMP7]], label [[CONT3:%.*]], label [[TRAP2:%.*]], !prof [[PROF3]], {{!annotation ![0-9]+}} +// CHECK: trap2: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT3]]: +// CHECK: cont3: // CHECK-NEXT: [[TMP8:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP8]], label %[[CONT5:.*]], label %[[TRAP4:.*]], !prof [[PROF3]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP4]]: +// CHECK-NEXT: br i1 [[TMP8]], label [[CONT5:%.*]], label [[TRAP4:%.*]], !prof [[PROF3]], {{!annotation ![0-9]+}} +// CHECK: trap4: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT5]]: +// CHECK: cont5: // CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 // CHECK-NEXT: ret i32 [[TMP9]] // diff --git a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c index abbe8a25313b4..df26a4e6bbb61 100644 --- a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c +++ b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/count-attr-fields-assign-2-oob2.c @@ -26,8 +26,11 @@ struct S { // CHECK-O0-NEXT: [[AGG_TEMP33:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-O0-NEXT: [[I:%.*]] = alloca i32, align 4 // CHECK-O0-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP43:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[AGG_TEMP58:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP59:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[AGG_TEMP77:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-O0-NEXT: [[AGG_TEMP78:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-O0-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [10 x i32], ptr [[ARR]], i64 0, i64 0 // CHECK-O0-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY]], i64 10 // CHECK-O0-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[TMP]], i32 0, i32 0 @@ -145,9 +148,10 @@ struct S { // CHECK-O0-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK-O0: for.body: // CHECK-O0-NEXT: [[TMP24:%.*]] = load i32, ptr [[I]], align 4 -// CHECK-O0-NEXT: [[L44:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP43]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L44:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP43]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP25:%.*]] = load i32, ptr [[L44]], align 8 -// CHECK-O0-NEXT: [[BP45:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-O0-NEXT: [[BP45:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP43]], i32 0, i32 0 // CHECK-O0-NEXT: [[TMP26:%.*]] = load ptr, ptr [[BP45]], align 8 // CHECK-O0-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP25]] to i64 // CHECK-O0-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP26]], i64 [[IDX_EXT]] @@ -168,23 +172,23 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB51:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR50]], align 8 // CHECK-O0-NEXT: [[TMP31:%.*]] = getelementptr i32, ptr [[ARRAYIDX]], i64 1, {{!annotation ![0-9]+}} // CHECK-O0-NEXT: [[TMP32:%.*]] = icmp ule ptr [[TMP31]], [[WIDE_PTR_UB49]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP32]], label %[[CONT53:.*]], label %[[TRAP52:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP52]]: +// CHECK-O0-NEXT: br i1 [[TMP32]], label [[CONT53:%.*]], label [[TRAP52:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap52: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT53]]: +// CHECK-O0: cont53: // CHECK-O0-NEXT: [[TMP33:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP31]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP33]], label %[[CONT55:.*]], label %[[TRAP54:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP54]]: +// CHECK-O0-NEXT: br i1 [[TMP33]], label [[CONT55:%.*]], label [[TRAP54:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap54: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT55]]: +// CHECK-O0: cont55: // CHECK-O0-NEXT: [[TMP34:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB51]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP34]], label %[[CONT57:.*]], label %[[TRAP56:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP56]]: +// CHECK-O0-NEXT: br i1 [[TMP34]], label [[CONT57:%.*]], label [[TRAP56:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap56: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT57]]: +// CHECK-O0: cont57: // CHECK-O0-NEXT: store i32 [[TMP24]], ptr [[ARRAYIDX]], align 4 // CHECK-O0-NEXT: br label [[FOR_INC:%.*]] // CHECK-O0: for.inc: @@ -193,9 +197,10 @@ struct S { // CHECK-O0-NEXT: store i32 [[INC]], ptr [[I]], align 4 // CHECK-O0-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP6:![0-9]+]] // CHECK-O0: for.end: -// CHECK-O0-NEXT: [[L60:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP59]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L60:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP59]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP36:%.*]] = load i32, ptr [[L60]], align 8 -// CHECK-O0-NEXT: [[BP261:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 +// CHECK-O0-NEXT: [[BP261:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP59]], i32 0, i32 1 // CHECK-O0-NEXT: [[TMP37:%.*]] = load ptr, ptr [[BP261]], align 8 // CHECK-O0-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP36]], 1 // CHECK-O0-NEXT: [[IDX_EXT62:%.*]] = sext i32 [[ADD]] to i64 @@ -214,25 +219,29 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB_ADDR69:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP58]], i32 0, i32 2 // CHECK-O0-NEXT: [[WIDE_PTR_LB70:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR69]], align 8 // CHECK-O0-NEXT: [[TMP41:%.*]] = getelementptr i32, ptr [[ARRAYIDX66]], i64 1, {{!annotation ![0-9]+}} -// COM: rdar://154226004 (Seemingly necessary range check (ptr <= ptr + 1) has been removed after fixing materialization bug for LValues) -// COM: These checks preserve as expected: lower <= arrayidx66(ptr + 8), tmp41 (ptr + 9) <= upper -// COM: This check has been dropped. Not sure why: arrayidx66(ptr + 8) <= tmp41(ptr + 9) // CHECK-O0-NEXT: [[TMP42:%.*]] = icmp ule ptr [[TMP41]], [[WIDE_PTR_UB68]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: br i1 [[TMP42]], label [[CONT72:%.*]], label [[TRAP71:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} // CHECK-O0: trap71: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} // CHECK-O0: cont72: -// CHECK-O0-NEXT: [[TMP43:%.*]] = icmp uge ptr [[ARRAYIDX66]], [[WIDE_PTR_LB70]], {{!annotation ![0-9]+}} +// CHECK-O0-NEXT: [[TMP43:%.*]] = icmp ule ptr [[ARRAYIDX66]], [[TMP41]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: br i1 [[TMP43]], label [[CONT74:%.*]], label [[TRAP73:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} // CHECK-O0: trap73: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} // CHECK-O0: cont74: +// CHECK-O0-NEXT: [[TMP44:%.*]] = icmp uge ptr [[ARRAYIDX66]], [[WIDE_PTR_LB70]], {{!annotation ![0-9]+}} +// CHECK-O0-NEXT: br i1 [[TMP44]], label [[CONT76:%.*]], label [[TRAP75:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap75: +// CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} +// CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} +// CHECK-O0: cont76: // CHECK-O0-NEXT: [[TMP45:%.*]] = load i32, ptr [[ARRAYIDX66]], align 4 -// CHECK-O0-NEXT: [[L79:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-O0-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP78]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-O0-NEXT: [[L79:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP78]], i32 0, i32 2 // CHECK-O0-NEXT: [[TMP46:%.*]] = load i32, ptr [[L79]], align 8 -// CHECK-O0-NEXT: [[BP80:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-O0-NEXT: [[BP80:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP78]], i32 0, i32 0 // CHECK-O0-NEXT: [[TMP47:%.*]] = load ptr, ptr [[BP80]], align 8 // CHECK-O0-NEXT: [[IDX_EXT81:%.*]] = sext i32 [[TMP46]] to i64 // CHECK-O0-NEXT: [[ADD_PTR82:%.*]] = getelementptr inbounds i32, ptr [[TMP47]], i64 [[IDX_EXT81]] @@ -251,23 +260,23 @@ struct S { // CHECK-O0-NEXT: [[WIDE_PTR_LB89:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR88]], align 8 // CHECK-O0-NEXT: [[TMP51:%.*]] = getelementptr i32, ptr [[ARRAYIDX85]], i64 1, {{!annotation ![0-9]+}} // CHECK-O0-NEXT: [[TMP52:%.*]] = icmp ule ptr [[TMP51]], [[WIDE_PTR_UB87]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP52]], label %[[CONT91:.*]], label %[[TRAP90:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP90]]: +// CHECK-O0-NEXT: br i1 [[TMP52]], label [[CONT91:%.*]], label [[TRAP90:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap90: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT91]]: +// CHECK-O0: cont91: // CHECK-O0-NEXT: [[TMP53:%.*]] = icmp ule ptr [[ARRAYIDX85]], [[TMP51]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP53]], label %[[CONT93:.*]], label %[[TRAP92:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP92]]: +// CHECK-O0-NEXT: br i1 [[TMP53]], label [[CONT93:%.*]], label [[TRAP92:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap92: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT93]]: +// CHECK-O0: cont93: // CHECK-O0-NEXT: [[TMP54:%.*]] = icmp uge ptr [[ARRAYIDX85]], [[WIDE_PTR_LB89]], {{!annotation ![0-9]+}} -// CHECK-O0-NEXT: br i1 [[TMP54]], label %[[CONT95:.*]], label %[[TRAP94:.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} -// CHECK-O0: [[TRAP94]]: +// CHECK-O0-NEXT: br i1 [[TMP54]], label [[CONT95:%.*]], label [[TRAP94:%.*]], !prof [[PROF2]], {{!annotation ![0-9]+}} +// CHECK-O0: trap94: // CHECK-O0-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-O0-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK-O0: [[CONT95]]: +// CHECK-O0: cont95: // CHECK-O0-NEXT: [[TMP55:%.*]] = load i32, ptr [[ARRAYIDX85]], align 4 // CHECK-O0-NEXT: [[ADD96:%.*]] = add nsw i32 [[TMP45]], [[TMP55]] // CHECK-O0-NEXT: ret i32 [[ADD96]] diff --git a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments-O2.c b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments-O2.c index bc3f1304eac71..e8554d34bd974 100644 --- a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments-O2.c +++ b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments-O2.c @@ -47,7 +47,7 @@ void TestPtrOK() { // CHECK: trap: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: cont56: +// CHECK: cont57: // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 40, ptr nonnull [[ARR]]) #[[ATTR6]] // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments.c b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments.c index 018c446c5a0ef..b231efc1668bb 100644 --- a/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments.c +++ b/clang/test/BoundsSafety/CodeGen/count-dependent-assignment-checks/counted-to-counted-assignments.c @@ -19,6 +19,7 @@ struct S { // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP7:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP14:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP15:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP18:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP21:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP28:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -91,9 +92,10 @@ struct S { // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP15]], i8 0, i64 4, i1 false) // CHECK-NEXT: br label [[HERE:%.*]] // CHECK: here: -// CHECK-NEXT: [[LEN16:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP15]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[LEN16:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP15]], i32 0, i32 2 // CHECK-NEXT: [[TMP16:%.*]] = load i32, ptr [[LEN16]], align 8 -// CHECK-NEXT: [[PTR217:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 +// CHECK-NEXT: [[PTR217:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP15]], i32 0, i32 1 // CHECK-NEXT: [[TMP17:%.*]] = load ptr, ptr [[PTR217]], align 8 // CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP16]], 1 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[SUB]] to i64 @@ -123,7 +125,7 @@ struct S { // CHECK-NEXT: [[WIDE_PTR_UB_ADDR29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_UB30:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR29]], align 8, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR23]], [[WIDE_PTR_UB30]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP]], label [[LAND_LHS_TRUE:%.*]], label %[[LAND_END54:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[CMP]], label [[LAND_LHS_TRUE:%.*]], label [[LAND_END54:%.*]], {{!annotation ![0-9]+}} // CHECK: land.lhs.true: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP31]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false), {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_LB_ADDR32:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP31]], i32 0, i32 2, {{!annotation ![0-9]+}} @@ -136,7 +138,7 @@ struct S { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR39:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP34]], i32 0, i32 2, {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_LB40:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR39]], align 8, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP41:%.*]] = icmp ule ptr [[WIDE_PTR_LB33]], [[WIDE_PTR_PTR36]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP41]], label [[LAND_RHS:%.*]], label %[[LAND_END54]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[CMP41]], label [[LAND_RHS:%.*]], label [[LAND_END54]], {{!annotation ![0-9]+}} // CHECK: land.rhs: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP42]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false), {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_UB_ADDR43:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP42]], i32 0, i32 1, {{!annotation ![0-9]+}} @@ -153,24 +155,24 @@ struct S { // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_DIV:%.*]] = sdiv exact i64 [[SUB_PTR_SUB]], 4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP52:%.*]] = icmp sle i64 10, [[SUB_PTR_DIV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP52]], label %[[LAND_RHS53:.*]], label %[[LAND_END:.*]], {{!annotation ![0-9]+}} -// CHECK: [[LAND_RHS53]]: -// CHECK-NEXT: br label %[[LAND_END]], {{!annotation ![0-9]+}} -// CHECK: [[LAND_END]]: -// CHECK-NEXT: [[TMP24:%.*]] = phi i1 [ false, [[LAND_RHS]] ], [ true, %[[LAND_RHS53]] ] -// CHECK-NEXT: br label %[[LAND_END54]], {{!annotation ![0-9]+}} -// CHECK: [[LAND_END54]]: -// CHECK-NEXT: [[TMP25:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE]] ], [ false, [[HERE]] ], [ [[TMP24]], %[[LAND_END]] ], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP25]], label %[[CONT56:.*]], label %[[TRAP55:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP55]]: +// CHECK-NEXT: br i1 [[CMP52]], label [[LAND_RHS53:%.*]], label [[LAND_END:%.*]], {{!annotation ![0-9]+}} +// CHECK: land.rhs53: +// CHECK-NEXT: br label [[LAND_END]], {{!annotation ![0-9]+}} +// CHECK: land.end: +// CHECK-NEXT: [[TMP24:%.*]] = phi i1 [ false, [[LAND_RHS]] ], [ true, [[LAND_RHS53]] ] +// CHECK-NEXT: br label [[LAND_END54]], {{!annotation ![0-9]+}} +// CHECK: land.end54: +// CHECK-NEXT: [[TMP25:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE]] ], [ false, [[HERE]] ], [ [[TMP24]], [[LAND_END]] ], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[TMP25]], label [[CONT56:%.*]], label [[TRAP55:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap55: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT56]]: -// CHECK-NEXT: br i1 true, label %[[CONT58:.*]], label %[[TRAP57:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP57]]: +// CHECK: cont56: +// CHECK-NEXT: br i1 true, label [[CONT58:%.*]], label [[TRAP57:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap57: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT58]]: +// CHECK: cont58: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP59]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR60:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP59]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR61:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR60]], align 8 @@ -214,6 +216,7 @@ int Foo() { // CHECK-NEXT: [[AGG_TEMP7:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP14:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[TMP_TMP15:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP16:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP20:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP23:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP30:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -286,9 +289,10 @@ int Foo() { // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP15]], i8 0, i64 4, i1 false) // CHECK-NEXT: br label [[HERE:%.*]] // CHECK: here: -// CHECK-NEXT: [[LEN17:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP16]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[LEN17:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP16]], i32 0, i32 2 // CHECK-NEXT: [[TMP16:%.*]] = load i32, ptr [[LEN17]], align 8 -// CHECK-NEXT: [[PTR18:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-NEXT: [[PTR18:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP16]], i32 0, i32 0 // CHECK-NEXT: [[TMP17:%.*]] = load ptr, ptr [[PTR18]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP16]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP17]], i64 [[IDX_EXT]] @@ -330,7 +334,7 @@ int Foo() { // CHECK-NEXT: [[WIDE_PTR_UB_ADDR31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP30]], i32 0, i32 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_UB32:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR31]], align 8, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR25]], [[WIDE_PTR_UB32]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP]], label [[LAND_LHS_TRUE:%.*]], label %[[LAND_END56:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[CMP]], label [[LAND_LHS_TRUE:%.*]], label [[LAND_END56:%.*]], {{!annotation ![0-9]+}} // CHECK: land.lhs.true: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP33]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false), {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_LB_ADDR34:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP33]], i32 0, i32 2, {{!annotation ![0-9]+}} @@ -343,7 +347,7 @@ int Foo() { // CHECK-NEXT: [[WIDE_PTR_LB_ADDR41:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP36]], i32 0, i32 2, {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_LB42:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR41]], align 8, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP43:%.*]] = icmp ule ptr [[WIDE_PTR_LB35]], [[WIDE_PTR_PTR38]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP43]], label [[LAND_RHS:%.*]], label %[[LAND_END56]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[CMP43]], label [[LAND_RHS:%.*]], label [[LAND_END56]], {{!annotation ![0-9]+}} // CHECK: land.rhs: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP44]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false), {{!annotation ![0-9]+}} // CHECK-NEXT: [[WIDE_PTR_UB_ADDR45:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP44]], i32 0, i32 1, {{!annotation ![0-9]+}} @@ -360,24 +364,24 @@ int Foo() { // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_DIV:%.*]] = sdiv exact i64 [[SUB_PTR_SUB]], 4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP54:%.*]] = icmp sle i64 10, [[SUB_PTR_DIV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[CMP54]], label %[[LAND_RHS55:.*]], label [[LAND_END:%.*]], {{!annotation ![0-9]+}} -// CHECK: [[LAND_RHS55]]: +// CHECK-NEXT: br i1 [[CMP54]], label [[LAND_RHS55:%.*]], label [[LAND_END:%.*]], {{!annotation ![0-9]+}} +// CHECK: land.rhs55: // CHECK-NEXT: br label [[LAND_END]], {{!annotation ![0-9]+}} // CHECK: land.end: -// CHECK-NEXT: [[TMP33:%.*]] = phi i1 [ false, [[LAND_RHS]] ], [ true, %[[LAND_RHS55]] ] -// CHECK-NEXT: br label %[[LAND_END56]], {{!annotation ![0-9]+}} -// CHECK: [[LAND_END56]]: +// CHECK-NEXT: [[TMP33:%.*]] = phi i1 [ false, [[LAND_RHS]] ], [ true, [[LAND_RHS55]] ] +// CHECK-NEXT: br label [[LAND_END56]], {{!annotation ![0-9]+}} +// CHECK: land.end56: // CHECK-NEXT: [[TMP34:%.*]] = phi i1 [ false, [[LAND_LHS_TRUE]] ], [ false, [[HERE]] ], [ [[TMP33]], [[LAND_END]] ], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP34]], label %[[CONT58:.*]], label %[[TRAP57:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP57]]: +// CHECK-NEXT: br i1 [[TMP34]], label [[CONT58:%.*]], label [[TRAP57:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap57: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT58]]: -// CHECK-NEXT: br i1 true, label %[[CONT60:.*]], label %[[TRAP59:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP59]]: +// CHECK: cont58: +// CHECK-NEXT: br i1 true, label [[CONT60:%.*]], label [[TRAP59:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap59: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT60]]: +// CHECK: cont60: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP61]], ptr align 8 [[AGG_TEMP14]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR62:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP61]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR63:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR62]], align 8 diff --git a/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq-O2.c b/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq-O2.c index c0470aae6ef39..ad204cd2e2082 100644 --- a/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq-O2.c +++ b/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq-O2.c @@ -69,11 +69,11 @@ void TestRangeOK4(void) { // CHECK-NEXT: [[CMP80_NOT:%.*]] = icmp ugt ptr [[BOUND_PTR_ARITH60]], [[BOUND_PTR_ARITH8]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[CMP95_NOT:%.*]] = icmp ugt ptr [[ARR]], [[BOUND_PTR_ARITH60]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP80_NOT]], [[CMP95_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND]], label %[[TRAP:.*]], label %[[CONT96:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP]]: +// CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT96:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR7:[0-9]+]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT96]]: +// CHECK: cont96: // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 40, ptr nonnull [[ARR]]) #[[ATTR6]] // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq.c b/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq.c index 8998ce1e02220..a7527ad8256ad 100644 --- a/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq.c +++ b/clang/test/BoundsSafety/CodeGen/ended_by_assign_checks_seq.c @@ -28,9 +28,12 @@ void foo(void); // CHECK-NEXT: [[AGG_TEMP34:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP50:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP51:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP55:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[TMP_TMP56:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP57:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP62:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP63:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP67:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP74:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP82:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -154,7 +157,8 @@ void foo(void); // CHECK-NEXT: [[END49:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 // CHECK-NEXT: store ptr [[WIDE_PTR_PTR44]], ptr [[END49]], align 8 // CHECK-NEXT: call void @foo() -// CHECK-NEXT: [[ITER52:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP51]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[ITER52:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP51]], i32 0, i32 0 // CHECK-NEXT: [[TMP27:%.*]] = load ptr, ptr [[ITER52]], align 8 // CHECK-NEXT: [[START53:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 // CHECK-NEXT: [[TMP28:%.*]] = load ptr, ptr [[START53]], align 8 @@ -166,9 +170,10 @@ void foo(void); // CHECK-NEXT: store ptr [[TMP27]], ptr [[TMP31]], align 8 // CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP50]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP29]], ptr [[TMP32]], align 8 -// CHECK-NEXT: [[START58:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP57]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[START58:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP57]], i32 0, i32 2 // CHECK-NEXT: [[TMP33:%.*]] = load ptr, ptr [[START58]], align 8 -// CHECK-NEXT: [[END59:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 +// CHECK-NEXT: [[END59:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP57]], i32 0, i32 1 // CHECK-NEXT: [[TMP34:%.*]] = load ptr, ptr [[END59]], align 8 // CHECK-NEXT: [[ITER60:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 // CHECK-NEXT: [[TMP35:%.*]] = load ptr, ptr [[ITER60]], align 8 @@ -191,7 +196,8 @@ void foo(void); // CHECK-NEXT: [[TMP46:%.*]] = load ptr, ptr [[TMP45]], align 8 // CHECK-NEXT: [[TMP47:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP55]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP46]], ptr [[TMP47]], align 8 -// CHECK-NEXT: [[ITER64:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP63]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[ITER64:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP63]], i32 0, i32 0 // CHECK-NEXT: [[TMP48:%.*]] = load ptr, ptr [[ITER64]], align 8 // CHECK-NEXT: [[END65:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 // CHECK-NEXT: [[TMP49:%.*]] = load ptr, ptr [[END65]], align 8 @@ -238,11 +244,11 @@ void foo(void); // CHECK-NEXT: br label [[LAND_END]], {{!annotation ![0-9]+}} // CHECK: land.end: // CHECK-NEXT: [[TMP54:%.*]] = phi i1 [ false, [[CONT25]] ], [ [[CMP96]], [[LAND_RHS]] ], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP54]], label %[[CONT98:.*]], label %[[TRAP97:.*]], {{!prof ![0-9]+}}, {{!annotation ![0-9]+}} -// CHECK: [[TRAP97]]: +// CHECK-NEXT: br i1 [[TMP54]], label [[CONT98:%.*]], label [[TRAP97:%.*]], {{!annotation ![0-9]+}} +// CHECK: trap97: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT98]]: +// CHECK: cont98: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP99]], ptr align 8 [[AGG_TEMP50]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR100:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP99]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR101:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR100]], align 8 diff --git a/clang/test/BoundsSafety/CodeGen/ended_by_bag_of_bytes.c b/clang/test/BoundsSafety/CodeGen/ended_by_bag_of_bytes.c index 9ac57a739fca4..81552244d7ae6 100644 --- a/clang/test/BoundsSafety/CodeGen/ended_by_bag_of_bytes.c +++ b/clang/test/BoundsSafety/CodeGen/ended_by_bag_of_bytes.c @@ -19,8 +19,11 @@ struct T { // CHECK-NEXT: entry: // CHECK-NEXT: [[T:%.*]] = alloca [[STRUCT_T:%.*]], align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca [[STRUCT_S:%.*]], align 8 // CHECK-NEXT: [[AGG_TEMP3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP4:%.*]] = alloca [[STRUCT_T]], align 8 // CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP6:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-NEXT: [[AGG_TEMP9:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP10:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP17:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -32,7 +35,8 @@ struct T { // CHECK-NEXT: store i32 [[T_COERCE0:%.*]], ptr [[TMP0]], align 8 // CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw { i32, ptr }, ptr [[T]], i32 0, i32 1 // CHECK-NEXT: store ptr [[T_COERCE1:%.*]], ptr [[TMP1]], align 8 -// CHECK-NEXT: [[ITER:%.*]] = getelementptr inbounds nuw [[STRUCT_S:%.*]], ptr [[S:%.*]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 [[S:%.*]], i64 24, i1 false) +// CHECK-NEXT: [[ITER:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP1]], i32 0, i32 0 // CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[ITER]], align 8 // CHECK-NEXT: [[START:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 2 // CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[START]], align 8 @@ -44,9 +48,10 @@ struct T { // CHECK-NEXT: store ptr [[TMP2]], ptr [[TMP6]], align 8 // CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP4]], ptr [[TMP7]], align 8 -// CHECK-NEXT: [[CNT:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[T]], i64 16, i1 false) +// CHECK-NEXT: [[CNT:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP4]], i32 0, i32 0 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[CNT]], align 8 -// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 1 +// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP4]], i32 0, i32 1 // CHECK-NEXT: [[TMP9:%.*]] = load ptr, ptr [[PTR]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP8]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP9]], i64 [[IDX_EXT]] @@ -56,7 +61,8 @@ struct T { // CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP11]], align 8 // CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP9]], ptr [[TMP12]], align 8 -// CHECK-NEXT: [[ITER7:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP6]], ptr align 8 [[S]], i64 24, i1 false) +// CHECK-NEXT: [[ITER7:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[AGG_TEMP6]], i32 0, i32 0 // CHECK-NEXT: [[TMP13:%.*]] = load ptr, ptr [[ITER7]], align 8 // CHECK-NEXT: [[END:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[S]], i32 0, i32 1 // CHECK-NEXT: [[TMP14:%.*]] = load ptr, ptr [[END]], align 8 diff --git a/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c b/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c index df32a55b9974f..58aaaa1ae958a 100644 --- a/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c +++ b/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c @@ -14,7 +14,7 @@ struct Simple { // rdar://132731845 the flexible arrays are not bounds checked // CHECK-LABEL: define dso_local void @simple_no_flexbase_update( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -48,7 +48,7 @@ void simple_no_flexbase_update(struct Simple * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @simple_flexbase_update( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -85,7 +85,7 @@ void simple_flexbase_update(struct Simple * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @simple_flexbase_self_assign( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -128,7 +128,7 @@ struct Shared { int * __counted_by(len) baz(int len); // CHECK-LABEL: define dso_local void @shared_no_flexbase_update( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -266,7 +266,7 @@ void shared_no_flexbase_update(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_no_flexbase_update_reverse( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -401,7 +401,7 @@ void shared_no_flexbase_update_reverse(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_update( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -542,7 +542,7 @@ void shared_flexbase_update(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_update_reverse( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -683,7 +683,7 @@ void shared_flexbase_update_reverse(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_self_assign( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -823,7 +823,7 @@ void shared_flexbase_self_assign(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_reverse( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -963,29 +963,31 @@ void shared_flexbase_self_assign_reverse(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_fr( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 // CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP15:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP22:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP25:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP28:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP36:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP39:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP51:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP58:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP70:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP16:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP23:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP26:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP29:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP37:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP40:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP52:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP59:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP71:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 // CHECK-NEXT: store ptr [[P]], ptr [[P_INDIRECT_ADDR]], align 8 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[P]], ptr align 8 [[P]], i64 24, i1 false) // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP2]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // CHECK-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_SHARED:%.*]], ptr [[WIDE_PTR_PTR]], i64 1 // CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[WIDE_PTR_UB]], !annotation [[META2]] @@ -995,34 +997,34 @@ void shared_flexbase_self_assign_reverse(struct Shared * __bidi_indexable p) { // CHECK-NEXT: unreachable, !annotation [[META2]] // CHECK: [[CONT]]: // CHECK-NEXT: [[TMP2:%.*]] = icmp ule ptr [[WIDE_PTR_LB]], [[WIDE_PTR_PTR]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP2]], label %[[CONT3:.*]], label %[[TRAP2:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP2]]: +// CHECK-NEXT: br i1 [[TMP2]], label %[[CONT4:.*]], label %[[TRAP3:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP3]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT3]]: +// CHECK: [[CONT4]]: // CHECK-NEXT: [[LEN:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR]], i32 0, i32 0 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[LEN]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR6:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR5]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB8:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR7]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB10:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR9]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR6]], i64 1 -// CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[TMP4]], [[WIDE_PTR_UB8]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT12:.*]], label %[[TRAP11:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP11]]: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP5]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR7:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR6]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB9:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR8]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB11:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR10]], align 8 +// CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR7]], i64 1 +// CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[TMP4]], [[WIDE_PTR_UB9]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT13:.*]], label %[[TRAP12:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP12]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT12]]: -// CHECK-NEXT: [[TMP6:%.*]] = icmp ule ptr [[WIDE_PTR_LB10]], [[WIDE_PTR_PTR6]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT14:.*]], label %[[TRAP13:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP13]]: +// CHECK: [[CONT13]]: +// CHECK-NEXT: [[TMP6:%.*]] = icmp ule ptr [[WIDE_PTR_LB11]], [[WIDE_PTR_PTR7]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT15:.*]], label %[[TRAP14:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP14]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT14]]: -// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR6]], i32 0, i32 1 +// CHECK: [[CONT15]]: +// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR7]], i32 0, i32 1 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[PTR]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP3]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP7]], i64 [[IDX_EXT]] @@ -1032,111 +1034,111 @@ void shared_flexbase_self_assign_reverse(struct Shared * __bidi_indexable p) { // CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP9]], align 8 // CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP7]], ptr [[TMP10]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP15]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR17:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR16]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR18:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB19:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR18]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR20:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB21:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR20]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP22]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR23:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP22]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB24:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR23]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR17]], [[WIDE_PTR_UB24]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP]], label %[[LAND_LHS_TRUE:.*]], label %[[LAND_END48:.*]], !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP16]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR17:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR18:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR17]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR19:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB20:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR19]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR21:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB22:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR21]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP23]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP23]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB25:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR24]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR18]], [[WIDE_PTR_UB25]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP]], label %[[LAND_LHS_TRUE:.*]], label %[[LAND_END49:.*]], !annotation [[META5]] // CHECK: [[LAND_LHS_TRUE]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP25]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR26:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP25]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB27:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR26]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP28]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR30:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR29]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB32:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR31]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB34:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR33]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[CMP35:%.*]] = icmp ule ptr [[WIDE_PTR_LB27]], [[WIDE_PTR_PTR30]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP35]], label %[[LAND_RHS:.*]], label %[[LAND_END48]], !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP26]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR27:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB28:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR27]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP29]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR30:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR31:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR30]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR32:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB33:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR32]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR34:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB35:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR34]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[CMP36:%.*]] = icmp ule ptr [[WIDE_PTR_LB28]], [[WIDE_PTR_PTR31]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP36]], label %[[LAND_RHS:.*]], label %[[LAND_END49]], !annotation [[META5]] // CHECK: [[LAND_RHS]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP36]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP36]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB38:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR37]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP39]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR40:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR41:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR40]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR42:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB43:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR42]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR44:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB45:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR44]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_UB38]] to i64, !annotation [[META5]] -// CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR41]] to i64, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP37]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR38:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP37]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB39:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR38]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP40]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR41:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR42:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR41]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR43:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB44:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR43]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR45:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB46:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR45]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_UB39]] to i64, !annotation [[META5]] +// CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR42]] to i64, !annotation [[META5]] // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], !annotation [[META5]] // CHECK-NEXT: [[SUB_PTR_DIV:%.*]] = sdiv exact i64 [[SUB_PTR_SUB]], 4, !annotation [[META5]] -// CHECK-NEXT: [[CMP46:%.*]] = icmp sle i64 11, [[SUB_PTR_DIV]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP46]], label %[[LAND_RHS47:.*]], label %[[LAND_END:.*]], !annotation [[META5]] -// CHECK: [[LAND_RHS47]]: +// CHECK-NEXT: [[CMP47:%.*]] = icmp sle i64 11, [[SUB_PTR_DIV]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP47]], label %[[LAND_RHS48:.*]], label %[[LAND_END:.*]], !annotation [[META5]] +// CHECK: [[LAND_RHS48]]: // CHECK-NEXT: br label %[[LAND_END]], !annotation [[META5]] // CHECK: [[LAND_END]]: -// CHECK-NEXT: [[TMP11:%.*]] = phi i1 [ false, %[[LAND_RHS]] ], [ true, %[[LAND_RHS47]] ] -// CHECK-NEXT: br label %[[LAND_END48]], !annotation [[META5]] -// CHECK: [[LAND_END48]]: -// CHECK-NEXT: [[TMP12:%.*]] = phi i1 [ false, %[[LAND_LHS_TRUE]] ], [ false, %[[CONT14]] ], [ [[TMP11]], %[[LAND_END]] ], !annotation [[META5]] -// CHECK-NEXT: br i1 [[TMP12]], label %[[CONT50:.*]], label %[[TRAP49:.*]], !prof [[PROF3]], !annotation [[META5]] -// CHECK: [[TRAP49]]: +// CHECK-NEXT: [[TMP11:%.*]] = phi i1 [ false, %[[LAND_RHS]] ], [ true, %[[LAND_RHS48]] ] +// CHECK-NEXT: br label %[[LAND_END49]], !annotation [[META5]] +// CHECK: [[LAND_END49]]: +// CHECK-NEXT: [[TMP12:%.*]] = phi i1 [ false, %[[LAND_LHS_TRUE]] ], [ false, %[[CONT15]] ], [ [[TMP11]], %[[LAND_END]] ], !annotation [[META5]] +// CHECK-NEXT: br i1 [[TMP12]], label %[[CONT51:.*]], label %[[TRAP50:.*]], !prof [[PROF3]], !annotation [[META5]] +// CHECK: [[TRAP50]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META5]] // CHECK-NEXT: unreachable, !annotation [[META5]] -// CHECK: [[CONT50]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP51]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR52:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP51]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR53:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR52]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP51]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB55:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR54]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR56:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP51]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB57:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR56]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP58]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR59:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP58]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR60:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR59]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR61:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP58]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB62:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR61]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR63:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP58]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB64:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR63]], align 8 -// CHECK-NEXT: [[TMP13:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR60]], i64 1 -// CHECK-NEXT: [[TMP14:%.*]] = icmp ule ptr [[TMP13]], [[WIDE_PTR_UB62]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT66:.*]], label %[[TRAP65:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP65]]: +// CHECK: [[CONT51]]: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP52]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR53:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP52]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR54:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR53]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR55:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP52]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB56:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR55]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR57:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP52]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB58:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR57]], align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP59]], ptr align 8 [[P]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR60:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP59]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR61:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR60]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR62:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP59]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB63:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR62]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR64:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP59]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB65:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR64]], align 8 +// CHECK-NEXT: [[TMP13:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR61]], i64 1 +// CHECK-NEXT: [[TMP14:%.*]] = icmp ule ptr [[TMP13]], [[WIDE_PTR_UB63]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT67:.*]], label %[[TRAP66:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP66]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT66]]: -// CHECK-NEXT: [[TMP15:%.*]] = icmp ule ptr [[WIDE_PTR_LB64]], [[WIDE_PTR_PTR60]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT68:.*]], label %[[TRAP67:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP67]]: +// CHECK: [[CONT67]]: +// CHECK-NEXT: [[TMP15:%.*]] = icmp ule ptr [[WIDE_PTR_LB65]], [[WIDE_PTR_PTR61]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT69:.*]], label %[[TRAP68:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP68]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT68]]: -// CHECK-NEXT: [[PTR69:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR60]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR53]], ptr [[PTR69]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP70]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR71:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR72:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR71]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR73:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB74:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR73]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR75:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB76:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR75]], align 8 -// CHECK-NEXT: [[TMP16:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR72]], i64 1 -// CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB74]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT78:.*]], label %[[TRAP77:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP77]]: +// CHECK: [[CONT69]]: +// CHECK-NEXT: [[PTR70:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR61]], i32 0, i32 1 +// CHECK-NEXT: store ptr [[WIDE_PTR_PTR54]], ptr [[PTR70]], align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP71]], ptr align 8 [[P]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR72:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR73:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR72]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR74:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB75:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR74]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR76:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB77:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR76]], align 8 +// CHECK-NEXT: [[TMP16:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR73]], i64 1 +// CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB75]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT79:.*]], label %[[TRAP78:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP78]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT78]]: -// CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[WIDE_PTR_LB76]], [[WIDE_PTR_PTR72]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT80:.*]], label %[[TRAP79:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP79]]: +// CHECK: [[CONT79]]: +// CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[WIDE_PTR_LB77]], [[WIDE_PTR_PTR73]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT81:.*]], label %[[TRAP80:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP80]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT80]]: -// CHECK-NEXT: [[LEN81:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR72]], i32 0, i32 0 -// CHECK-NEXT: store i32 11, ptr [[LEN81]], align 8 +// CHECK: [[CONT81]]: +// CHECK-NEXT: [[LEN82:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR73]], i32 0, i32 0 +// CHECK-NEXT: store i32 11, ptr [[LEN82]], align 8 // CHECK-NEXT: ret void // void shared_flexbase_self_assign_fr(struct Shared * __bidi_indexable p) { @@ -1146,29 +1148,31 @@ void shared_flexbase_self_assign_fr(struct Shared * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_fr_reverse( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 // CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP4:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP15:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP22:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP25:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP28:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP36:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP39:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP51:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP63:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP70:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP5:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP16:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP23:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP26:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP29:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP37:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP40:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP52:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP64:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 +// CHECK-NEXT: [[AGG_TEMP71:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 // CHECK-NEXT: store ptr [[P]], ptr [[P_INDIRECT_ADDR]], align 8 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[P]], ptr align 8 [[P]], i64 24, i1 false) // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP1]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP2]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP1]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP2]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // CHECK-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_SHARED:%.*]], ptr [[WIDE_PTR_PTR]], i64 1 // CHECK-NEXT: [[TMP1:%.*]] = icmp ule ptr [[TMP0]], [[WIDE_PTR_UB]], !annotation [[META2]] @@ -1178,34 +1182,34 @@ void shared_flexbase_self_assign_fr(struct Shared * __bidi_indexable p) { // CHECK-NEXT: unreachable, !annotation [[META2]] // CHECK: [[CONT]]: // CHECK-NEXT: [[TMP2:%.*]] = icmp ule ptr [[WIDE_PTR_LB]], [[WIDE_PTR_PTR]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP2]], label %[[CONT3:.*]], label %[[TRAP2:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP2]]: +// CHECK-NEXT: br i1 [[TMP2]], label %[[CONT4:.*]], label %[[TRAP3:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP3]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT3]]: +// CHECK: [[CONT4]]: // CHECK-NEXT: [[LEN:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR]], i32 0, i32 0 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[LEN]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP4]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR6:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR5]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB8:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR7]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP4]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB10:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR9]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR6]], i64 1 -// CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[TMP4]], [[WIDE_PTR_UB8]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT12:.*]], label %[[TRAP11:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP11]]: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP5]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR7:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR6]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB9:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR8]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP5]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB11:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR10]], align 8 +// CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR7]], i64 1 +// CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[TMP4]], [[WIDE_PTR_UB9]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT13:.*]], label %[[TRAP12:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP12]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT12]]: -// CHECK-NEXT: [[TMP6:%.*]] = icmp ule ptr [[WIDE_PTR_LB10]], [[WIDE_PTR_PTR6]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT14:.*]], label %[[TRAP13:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP13]]: +// CHECK: [[CONT13]]: +// CHECK-NEXT: [[TMP6:%.*]] = icmp ule ptr [[WIDE_PTR_LB11]], [[WIDE_PTR_PTR7]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT15:.*]], label %[[TRAP14:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP14]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT14]]: -// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR6]], i32 0, i32 1 +// CHECK: [[CONT15]]: +// CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR7]], i32 0, i32 1 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[PTR]], align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP3]] to i64 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[TMP7]], i64 [[IDX_EXT]] @@ -1215,111 +1219,111 @@ void shared_flexbase_self_assign_fr(struct Shared * __bidi_indexable p) { // CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP9]], align 8 // CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: store ptr [[TMP7]], ptr [[TMP10]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP15]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR17:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR16]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR18:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB19:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR18]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR20:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP15]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB21:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR20]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP22]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR23:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP22]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB24:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR23]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR17]], [[WIDE_PTR_UB24]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP]], label %[[LAND_LHS_TRUE:.*]], label %[[LAND_END48:.*]], !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP16]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR17:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR18:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR17]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR19:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB20:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR19]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR21:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP16]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB22:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR21]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP23]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP23]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB25:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR24]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[WIDE_PTR_PTR18]], [[WIDE_PTR_UB25]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP]], label %[[LAND_LHS_TRUE:.*]], label %[[LAND_END49:.*]], !annotation [[META5]] // CHECK: [[LAND_LHS_TRUE]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP25]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR26:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP25]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB27:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR26]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP28]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR30:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR29]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB32:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR31]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP28]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB34:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR33]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[CMP35:%.*]] = icmp ule ptr [[WIDE_PTR_LB27]], [[WIDE_PTR_PTR30]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP35]], label %[[LAND_RHS:.*]], label %[[LAND_END48]], !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP26]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR27:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB28:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR27]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP29]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR30:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR31:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR30]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR32:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB33:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR32]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR34:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP29]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB35:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR34]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[CMP36:%.*]] = icmp ule ptr [[WIDE_PTR_LB28]], [[WIDE_PTR_PTR31]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP36]], label %[[LAND_RHS:.*]], label %[[LAND_END49]], !annotation [[META5]] // CHECK: [[LAND_RHS]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP36]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP36]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB38:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR37]], align 8, !annotation [[META5]] -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP39]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR40:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 0, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_PTR41:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR40]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR42:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 1, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_UB43:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR42]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR44:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP39]], i32 0, i32 2, !annotation [[META5]] -// CHECK-NEXT: [[WIDE_PTR_LB45:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR44]], align 8, !annotation [[META5]] -// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_UB38]] to i64, !annotation [[META5]] -// CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR41]] to i64, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP37]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR38:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP37]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB39:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR38]], align 8, !annotation [[META5]] +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP40]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false), !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR41:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 0, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_PTR42:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR41]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR43:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 1, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_UB44:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR43]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR45:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP40]], i32 0, i32 2, !annotation [[META5]] +// CHECK-NEXT: [[WIDE_PTR_LB46:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR45]], align 8, !annotation [[META5]] +// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_UB39]] to i64, !annotation [[META5]] +// CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[WIDE_PTR_PTR42]] to i64, !annotation [[META5]] // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], !annotation [[META5]] // CHECK-NEXT: [[SUB_PTR_DIV:%.*]] = sdiv exact i64 [[SUB_PTR_SUB]], 4, !annotation [[META5]] -// CHECK-NEXT: [[CMP46:%.*]] = icmp sle i64 11, [[SUB_PTR_DIV]], !annotation [[META5]] -// CHECK-NEXT: br i1 [[CMP46]], label %[[LAND_RHS47:.*]], label %[[LAND_END:.*]], !annotation [[META5]] -// CHECK: [[LAND_RHS47]]: +// CHECK-NEXT: [[CMP47:%.*]] = icmp sle i64 11, [[SUB_PTR_DIV]], !annotation [[META5]] +// CHECK-NEXT: br i1 [[CMP47]], label %[[LAND_RHS48:.*]], label %[[LAND_END:.*]], !annotation [[META5]] +// CHECK: [[LAND_RHS48]]: // CHECK-NEXT: br label %[[LAND_END]], !annotation [[META5]] // CHECK: [[LAND_END]]: -// CHECK-NEXT: [[TMP11:%.*]] = phi i1 [ false, %[[LAND_RHS]] ], [ true, %[[LAND_RHS47]] ] -// CHECK-NEXT: br label %[[LAND_END48]], !annotation [[META5]] -// CHECK: [[LAND_END48]]: -// CHECK-NEXT: [[TMP12:%.*]] = phi i1 [ false, %[[LAND_LHS_TRUE]] ], [ false, %[[CONT14]] ], [ [[TMP11]], %[[LAND_END]] ], !annotation [[META5]] -// CHECK-NEXT: br i1 [[TMP12]], label %[[CONT50:.*]], label %[[TRAP49:.*]], !prof [[PROF3]], !annotation [[META5]] -// CHECK: [[TRAP49]]: +// CHECK-NEXT: [[TMP11:%.*]] = phi i1 [ false, %[[LAND_RHS]] ], [ true, %[[LAND_RHS48]] ] +// CHECK-NEXT: br label %[[LAND_END49]], !annotation [[META5]] +// CHECK: [[LAND_END49]]: +// CHECK-NEXT: [[TMP12:%.*]] = phi i1 [ false, %[[LAND_LHS_TRUE]] ], [ false, %[[CONT15]] ], [ [[TMP11]], %[[LAND_END]] ], !annotation [[META5]] +// CHECK-NEXT: br i1 [[TMP12]], label %[[CONT51:.*]], label %[[TRAP50:.*]], !prof [[PROF3]], !annotation [[META5]] +// CHECK: [[TRAP50]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META5]] // CHECK-NEXT: unreachable, !annotation [[META5]] -// CHECK: [[CONT50]]: -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP51]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR52:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP51]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR53:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR52]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP51]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB55:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR54]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR56:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP51]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB57:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR56]], align 8 -// CHECK-NEXT: [[TMP13:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR53]], i64 1 -// CHECK-NEXT: [[TMP14:%.*]] = icmp ule ptr [[TMP13]], [[WIDE_PTR_UB55]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT59:.*]], label %[[TRAP58:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP58]]: +// CHECK: [[CONT51]]: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP52]], ptr align 8 [[P]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR53:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP52]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR54:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR53]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR55:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP52]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB56:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR55]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR57:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP52]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB58:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR57]], align 8 +// CHECK-NEXT: [[TMP13:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR54]], i64 1 +// CHECK-NEXT: [[TMP14:%.*]] = icmp ule ptr [[TMP13]], [[WIDE_PTR_UB56]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT60:.*]], label %[[TRAP59:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP59]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT59]]: -// CHECK-NEXT: [[TMP15:%.*]] = icmp ule ptr [[WIDE_PTR_LB57]], [[WIDE_PTR_PTR53]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT61:.*]], label %[[TRAP60:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP60]]: +// CHECK: [[CONT60]]: +// CHECK-NEXT: [[TMP15:%.*]] = icmp ule ptr [[WIDE_PTR_LB58]], [[WIDE_PTR_PTR54]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT62:.*]], label %[[TRAP61:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP61]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT61]]: -// CHECK-NEXT: [[LEN62:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR53]], i32 0, i32 0 -// CHECK-NEXT: store i32 11, ptr [[LEN62]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP63]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR64:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP63]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR65:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR64]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR66:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP63]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB67:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR66]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR68:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP63]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB69:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR68]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP70]], ptr align 8 [[P]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR71:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR72:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR71]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR73:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB74:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR73]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR75:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP70]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB76:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR75]], align 8 -// CHECK-NEXT: [[TMP16:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR72]], i64 1 -// CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB74]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT78:.*]], label %[[TRAP77:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP77]]: +// CHECK: [[CONT62]]: +// CHECK-NEXT: [[LEN63:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR54]], i32 0, i32 0 +// CHECK-NEXT: store i32 11, ptr [[LEN63]], align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP64]], ptr align 8 [[AGG_TEMP]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR65:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR66:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR65]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR67:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB68:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR67]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR69:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB70:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR69]], align 8 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP71]], ptr align 8 [[P]], i64 24, i1 false) +// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR72:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 0 +// CHECK-NEXT: [[WIDE_PTR_PTR73:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR72]], align 8 +// CHECK-NEXT: [[WIDE_PTR_UB_ADDR74:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 1 +// CHECK-NEXT: [[WIDE_PTR_UB75:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR74]], align 8 +// CHECK-NEXT: [[WIDE_PTR_LB_ADDR76:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP71]], i32 0, i32 2 +// CHECK-NEXT: [[WIDE_PTR_LB77:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR76]], align 8 +// CHECK-NEXT: [[TMP16:%.*]] = getelementptr [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR73]], i64 1 +// CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB75]], !annotation [[META2]] +// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT79:.*]], label %[[TRAP78:.*]], !prof [[PROF3]], !annotation [[META2]] +// CHECK: [[TRAP78]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] // CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT78]]: -// CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[WIDE_PTR_LB76]], [[WIDE_PTR_PTR72]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT80:.*]], label %[[TRAP79:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP79]]: +// CHECK: [[CONT79]]: +// CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[WIDE_PTR_LB77]], [[WIDE_PTR_PTR73]], !annotation [[META4]] +// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT81:.*]], label %[[TRAP80:.*]], !prof [[PROF3]], !annotation [[META4]] +// CHECK: [[TRAP80]]: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] // CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT80]]: -// CHECK-NEXT: [[PTR81:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR72]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR65]], ptr [[PTR81]], align 8 +// CHECK: [[CONT81]]: +// CHECK-NEXT: [[PTR82:%.*]] = getelementptr inbounds nuw [[STRUCT_SHARED]], ptr [[WIDE_PTR_PTR73]], i32 0, i32 1 +// CHECK-NEXT: store ptr [[WIDE_PTR_PTR66]], ptr [[PTR82]], align 8 // CHECK-NEXT: ret void // void shared_flexbase_self_assign_fr_reverse(struct Shared * __bidi_indexable p) { @@ -1335,7 +1339,7 @@ struct Double { }; // CHECK-LABEL: define dso_local void @double_no_flexbase_update_once( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 @@ -1369,7 +1373,7 @@ void double_no_flexbase_update_once(struct Double * __bidi_indexable p) { } // CHECK-LABEL: define dso_local void @double_no_flexbase_update_both( -// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 diff --git a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-call-builtin-O2.c b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-call-builtin-O2.c index 5dc10a0cf846f..7caad1d541b8d 100644 --- a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-call-builtin-O2.c +++ b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-call-builtin-O2.c @@ -21,25 +21,25 @@ typedef struct { // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[ELEMS]], i64 [[IDX_EXT]] // CHECK-NEXT: br label [[BOUNDSCHECK_CONT]] // CHECK: boundscheck.cont: -// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] +// CHECK-NEXT: [[AGG_TEMP2_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] // CHECK-NEXT: [[CONV:%.*]] = zext i32 [[SIZE:%.*]] to i64 -// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[FLEX]], [[AGG_TEMP1_SROA_3_0]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP1_SROA_3_0]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[FLEX]], [[AGG_TEMP2_SROA_3_0]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP2_SROA_3_0]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[FLEX]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP67_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP67_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP68_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP68_NOT]], {{!annotation ![0-9]+}} // CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT:%.*]], {{!annotation ![0-9]+}} // CHECK: trap: // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR4:[0-9]+]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} // CHECK: cont: // CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr align 1 [[FLEX]], i8 0, i64 [[CONV]], i1 false) -// CHECK-NEXT: [[DOTNOT88:%.*]] = icmp ne ptr [[FLEX]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[DOTNOT89:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND90:%.*]] = and i1 [[DOTNOT88]], [[DOTNOT89]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND90]], label [[TRAP]], label [[CONT87:%.*]], {{!annotation ![0-9]+}} -// CHECK: cont87: +// CHECK-NEXT: [[DOTNOT89:%.*]] = icmp ne ptr [[FLEX]], null, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[DOTNOT90:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND91:%.*]] = and i1 [[DOTNOT89]], [[DOTNOT90]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND91]], label [[TRAP]], label [[CONT88:%.*]], {{!annotation ![0-9]+}} +// CHECK: cont88: // CHECK-NEXT: ret ptr [[FLEX]] // void *set(flex_t *flex, unsigned size) { @@ -57,42 +57,42 @@ void *set(flex_t *flex, unsigned size) { // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[ELEMS]], i64 [[IDX_EXT]] // CHECK-NEXT: br label [[BOUNDSCHECK_CONT]] // CHECK: boundscheck.cont: -// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] -// CHECK-NEXT: [[DOTNOT187:%.*]] = icmp eq ptr [[SRC:%.*]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[DOTNOT187]], label [[BOUNDSCHECK_CONT11:%.*]], label [[BOUNDSCHECK_NOTNULL4:%.*]], {{!annotation ![0-9]+}} -// CHECK: boundscheck.notnull4: -// CHECK-NEXT: [[ELEMS5:%.*]] = getelementptr inbounds nuw i8, ptr [[SRC]], i64 4 +// CHECK-NEXT: [[AGG_TEMP2_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] +// CHECK-NEXT: [[DOTNOT188:%.*]] = icmp eq ptr [[SRC:%.*]], null, {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[DOTNOT188]], label [[BOUNDSCHECK_CONT12:%.*]], label [[BOUNDSCHECK_NOTNULL5:%.*]], {{!annotation ![0-9]+}} +// CHECK: boundscheck.notnull5: +// CHECK-NEXT: [[ELEMS6:%.*]] = getelementptr inbounds nuw i8, ptr [[SRC]], i64 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[SRC]], align 4, {{!tbaa ![0-9]+}} -// CHECK-NEXT: [[IDX_EXT8:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD_PTR9:%.*]] = getelementptr inbounds i32, ptr [[ELEMS5]], i64 [[IDX_EXT8]] -// CHECK-NEXT: br label [[BOUNDSCHECK_CONT11]] -// CHECK: boundscheck.cont11: -// CHECK-NEXT: [[AGG_TEMP3_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR9]], [[BOUNDSCHECK_NOTNULL4]] ], [ null, [[BOUNDSCHECK_CONT]] ] +// CHECK-NEXT: [[IDX_EXT9:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT: [[ADD_PTR10:%.*]] = getelementptr inbounds i32, ptr [[ELEMS6]], i64 [[IDX_EXT9]] +// CHECK-NEXT: br label [[BOUNDSCHECK_CONT12]] +// CHECK: boundscheck.cont12: +// CHECK-NEXT: [[AGG_TEMP4_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR10]], [[BOUNDSCHECK_NOTNULL5]] ], [ null, [[BOUNDSCHECK_CONT]] ] // CHECK-NEXT: [[CONV:%.*]] = zext i32 [[SIZE:%.*]] to i64 -// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[SRC]], [[AGG_TEMP3_SROA_3_0]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP3_SROA_3_0]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[SRC]], [[AGG_TEMP4_SROA_3_0]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP4_SROA_3_0]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[SRC]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP83_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP83_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP101_NOT:%.*]] = icmp ugt ptr [[DEST]], [[AGG_TEMP1_SROA_3_0]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND190:%.*]] = select i1 [[OR_COND]], i1 true, i1 [[CMP101_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_LHS_CAST153:%.*]] = ptrtoint ptr [[AGG_TEMP1_SROA_3_0]] to i64, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_RHS_CAST154:%.*]] = ptrtoint ptr [[DEST]] to i64, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_SUB155:%.*]] = sub i64 [[SUB_PTR_LHS_CAST153]], [[SUB_PTR_RHS_CAST154]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP156_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB155]], [[CONV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND191:%.*]] = select i1 [[OR_COND190]], i1 true, i1 [[CMP156_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND191]], label [[TRAP:%.*]], label [[CONT159:%.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP84_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP84_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP102_NOT:%.*]] = icmp ugt ptr [[DEST]], [[AGG_TEMP2_SROA_3_0]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND191:%.*]] = select i1 [[OR_COND]], i1 true, i1 [[CMP102_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_LHS_CAST154:%.*]] = ptrtoint ptr [[AGG_TEMP2_SROA_3_0]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_RHS_CAST155:%.*]] = ptrtoint ptr [[DEST]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_SUB156:%.*]] = sub i64 [[SUB_PTR_LHS_CAST154]], [[SUB_PTR_RHS_CAST155]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP157_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB156]], [[CONV]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND192:%.*]] = select i1 [[OR_COND191]], i1 true, i1 [[CMP157_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND192]], label [[TRAP:%.*]], label [[CONT160:%.*]], {{!annotation ![0-9]+}} // CHECK: trap: // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: cont159: +// CHECK: cont160: // CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[DEST]], ptr align 1 [[SRC]], i64 [[CONV]], i1 false) -// CHECK-NEXT: [[DOTNOT188:%.*]] = icmp ne ptr [[DEST]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[DOTNOT189:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND192:%.*]] = and i1 [[DOTNOT188]], [[DOTNOT189]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND192]], label [[TRAP]], label [[CONT185:%.*]], {{!annotation ![0-9]+}} -// CHECK: cont185: +// CHECK-NEXT: [[DOTNOT189:%.*]] = icmp ne ptr [[DEST]], null, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[DOTNOT190:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND193:%.*]] = and i1 [[DOTNOT189]], [[DOTNOT190]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND193]], label [[TRAP]], label [[CONT186:%.*]], {{!annotation ![0-9]+}} +// CHECK: cont186: // CHECK-NEXT: ret ptr [[DEST]] // void *cpy(flex_t *dest, const flex_t *src, unsigned size) { @@ -159,42 +159,42 @@ void *__unsafe_indexable pcpy(flex_t *dest, const flex_t *src, unsigned size) { // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[ELEMS]], i64 [[IDX_EXT]] // CHECK-NEXT: br label [[BOUNDSCHECK_CONT]] // CHECK: boundscheck.cont: -// CHECK-NEXT: [[AGG_TEMP1_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] -// CHECK-NEXT: [[DOTNOT187:%.*]] = icmp eq ptr [[SRC:%.*]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[DOTNOT187]], label [[BOUNDSCHECK_CONT11:%.*]], label [[BOUNDSCHECK_NOTNULL4:%.*]], {{!annotation ![0-9]+}} -// CHECK: boundscheck.notnull4: -// CHECK-NEXT: [[ELEMS5:%.*]] = getelementptr inbounds nuw i8, ptr [[SRC]], i64 4 +// CHECK-NEXT: [[AGG_TEMP2_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR]], [[BOUNDSCHECK_NOTNULL]] ], [ null, [[ENTRY:%.*]] ] +// CHECK-NEXT: [[DOTNOT188:%.*]] = icmp eq ptr [[SRC:%.*]], null, {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[DOTNOT188]], label [[BOUNDSCHECK_CONT12:%.*]], label [[BOUNDSCHECK_NOTNULL5:%.*]], {{!annotation ![0-9]+}} +// CHECK: boundscheck.notnull5: +// CHECK-NEXT: [[ELEMS6:%.*]] = getelementptr inbounds nuw i8, ptr [[SRC]], i64 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[SRC]], align 4, {{!tbaa ![0-9]+}} -// CHECK-NEXT: [[IDX_EXT8:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD_PTR9:%.*]] = getelementptr inbounds i32, ptr [[ELEMS5]], i64 [[IDX_EXT8]] -// CHECK-NEXT: br label [[BOUNDSCHECK_CONT11]] -// CHECK: boundscheck.cont11: -// CHECK-NEXT: [[AGG_TEMP3_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR9]], [[BOUNDSCHECK_NOTNULL4]] ], [ null, [[BOUNDSCHECK_CONT]] ] +// CHECK-NEXT: [[IDX_EXT9:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT: [[ADD_PTR10:%.*]] = getelementptr inbounds i32, ptr [[ELEMS6]], i64 [[IDX_EXT9]] +// CHECK-NEXT: br label [[BOUNDSCHECK_CONT12]] +// CHECK: boundscheck.cont12: +// CHECK-NEXT: [[AGG_TEMP4_SROA_3_0:%.*]] = phi ptr [ [[ADD_PTR10]], [[BOUNDSCHECK_NOTNULL5]] ], [ null, [[BOUNDSCHECK_CONT]] ] // CHECK-NEXT: [[CONV:%.*]] = zext i32 [[SIZE:%.*]] to i64 -// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[SRC]], [[AGG_TEMP3_SROA_3_0]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP3_SROA_3_0]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP_NOT:%.*]] = icmp ugt ptr [[SRC]], [[AGG_TEMP4_SROA_3_0]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[AGG_TEMP4_SROA_3_0]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[SRC]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP83_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP83_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP101_NOT:%.*]] = icmp ugt ptr [[DEST]], [[AGG_TEMP1_SROA_3_0]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND190:%.*]] = select i1 [[OR_COND]], i1 true, i1 [[CMP101_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_LHS_CAST153:%.*]] = ptrtoint ptr [[AGG_TEMP1_SROA_3_0]] to i64, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_RHS_CAST154:%.*]] = ptrtoint ptr [[DEST]] to i64, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[SUB_PTR_SUB155:%.*]] = sub i64 [[SUB_PTR_LHS_CAST153]], [[SUB_PTR_RHS_CAST154]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[CMP156_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB155]], [[CONV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND191:%.*]] = select i1 [[OR_COND190]], i1 true, i1 [[CMP156_NOT]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND191]], label [[TRAP:%.*]], label [[CONT159:%.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP84_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB]], [[CONV]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP84_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP102_NOT:%.*]] = icmp ugt ptr [[DEST]], [[AGG_TEMP2_SROA_3_0]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND191:%.*]] = select i1 [[OR_COND]], i1 true, i1 [[CMP102_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_LHS_CAST154:%.*]] = ptrtoint ptr [[AGG_TEMP2_SROA_3_0]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_RHS_CAST155:%.*]] = ptrtoint ptr [[DEST]] to i64, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[SUB_PTR_SUB156:%.*]] = sub i64 [[SUB_PTR_LHS_CAST154]], [[SUB_PTR_RHS_CAST155]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[CMP157_NOT:%.*]] = icmp ult i64 [[SUB_PTR_SUB156]], [[CONV]], {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND192:%.*]] = select i1 [[OR_COND191]], i1 true, i1 [[CMP157_NOT]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND192]], label [[TRAP:%.*]], label [[CONT160:%.*]], {{!annotation ![0-9]+}} // CHECK: trap: // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: cont159: +// CHECK: cont160: // CHECK-NEXT: tail call void @llvm.memmove.p0.p0.i64(ptr align 1 [[DEST]], ptr align 1 [[SRC]], i64 [[CONV]], i1 false) -// CHECK-NEXT: [[DOTNOT188:%.*]] = icmp ne ptr [[DEST]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[DOTNOT189:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} -// CHECK-NEXT: [[OR_COND192:%.*]] = and i1 [[DOTNOT188]], [[DOTNOT189]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND192]], label [[TRAP]], label [[CONT185:%.*]], {{!annotation ![0-9]+}} -// CHECK: cont185: +// CHECK-NEXT: [[DOTNOT189:%.*]] = icmp ne ptr [[DEST]], null, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[DOTNOT190:%.*]] = icmp eq i32 [[SIZE]], 0, {{!annotation ![0-9]+}} +// CHECK-NEXT: [[OR_COND193:%.*]] = and i1 [[DOTNOT189]], [[DOTNOT190]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND193]], label [[TRAP]], label [[CONT186:%.*]], {{!annotation ![0-9]+}} +// CHECK: cont186: // CHECK-NEXT: ret ptr [[DEST]] // void *move(flex_t *dest, const flex_t *src, unsigned size) { diff --git a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-deref.c b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-deref.c index e22d1b4fb1fdb..54875b343ac5f 100644 --- a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-deref.c +++ b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-deref.c @@ -35,7 +35,7 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP2]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 // CHECK-NEXT: [[FLEX_BASE_NULL_CHECK:%.*]] = icmp ne ptr [[WIDE_PTR_PTR]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK]], label [[FLEX_BASE_NONNULL:%.*]], label %[[CONT32:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK]], label [[FLEX_BASE_NONNULL:%.*]], label [[CONT32:%.*]], {{!annotation ![0-9]+}} // CHECK: flex.base.nonnull: // CHECK-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i64 1 // CHECK-NEXT: [[TMP5:%.*]] = icmp ule ptr [[WIDE_PTR_PTR]], [[TMP4]], {{!annotation ![0-9]+}} @@ -53,17 +53,17 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB9:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR8]], align 8 // CHECK-NEXT: [[TMP6:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i64 1 // CHECK-NEXT: [[TMP7:%.*]] = icmp ule ptr [[TMP6]], [[WIDE_PTR_UB7]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP7]], label %[[CONT11:.*]], label %[[TRAP10:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP10]]: +// CHECK-NEXT: br i1 [[TMP7]], label [[CONT11:%.*]], label [[TRAP10:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap10: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT11]]: +// CHECK: cont11: // CHECK-NEXT: [[TMP8:%.*]] = icmp ule ptr [[WIDE_PTR_LB9]], [[WIDE_PTR_PTR5]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP8]], label %[[CONT13:.*]], label %[[TRAP12:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP12]]: +// CHECK-NEXT: br i1 [[TMP8]], label [[CONT13:%.*]], label [[TRAP12:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap12: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT13]]: +// CHECK: cont13: // CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS]], i64 0, i64 0 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP14]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) @@ -75,48 +75,48 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB20:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR19]], align 8 // CHECK-NEXT: [[TMP9:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR16]], i64 1 // CHECK-NEXT: [[TMP10:%.*]] = icmp ule ptr [[TMP9]], [[WIDE_PTR_UB18]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP10]], label %[[CONT22:.*]], label %[[TRAP21:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP21]]: +// CHECK-NEXT: br i1 [[TMP10]], label [[CONT22:%.*]], label [[TRAP21:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap21: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT22]]: +// CHECK: cont22: // CHECK-NEXT: [[TMP11:%.*]] = icmp ule ptr [[WIDE_PTR_LB20]], [[WIDE_PTR_PTR16]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP11]], label %[[CONT24:.*]], label %[[TRAP23:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP23]]: +// CHECK-NEXT: br i1 [[TMP11]], label [[CONT24:%.*]], label [[TRAP23:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap23: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT24]]: +// CHECK: cont24: // CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR16]], i32 0, i32 0 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[COUNT]], align 4 // CHECK-NEXT: [[FLEX_COUNT_MINUS:%.*]] = icmp sle i32 0, [[TMP12]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label %[[CONT26:.*]], label %[[TRAP25:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP25]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label [[CONT26:%.*]], label [[TRAP25:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap25: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT26]]: +// CHECK: cont26: // CHECK-NEXT: [[TMP13:%.*]] = icmp ule ptr [[ARRAYDECAY]], [[WIDE_PTR_UB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP13]], label %[[CONT28:.*]], label %[[TRAP27:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP27]]: +// CHECK-NEXT: br i1 [[TMP13]], label [[CONT28:%.*]], label [[TRAP27:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap27: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT28]]: +// CHECK: cont28: // CHECK-NEXT: [[TMP14:%.*]] = icmp uge ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT30:.*]], label %[[TRAP29:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP29]]: +// CHECK-NEXT: br i1 [[TMP14]], label [[CONT30:%.*]], label [[TRAP29:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap29: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT30]]: +// CHECK: cont30: // CHECK-NEXT: [[UPPER_INTPTR:%.*]] = ptrtoint ptr [[WIDE_PTR_UB]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FAM_INTPTR:%.*]] = ptrtoint ptr [[ARRAYDECAY]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT:%.*]] = sub nuw i64 [[UPPER_INTPTR]], [[FAM_INTPTR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT_DIV:%.*]] = sdiv exact i64 [[FLEX_AVAIL_COUNT]], 4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_INTPTR:%.*]] = zext i32 [[TMP12]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_CHECK:%.*]] = icmp ule i64 [[FLEX_COUNT_INTPTR]], [[FLEX_AVAIL_COUNT_DIV]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK]], label %[[CONT32]], label %[[TRAP31:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP31]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK]], label [[CONT32]], label [[TRAP31:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap31: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT32]]: +// CHECK: cont32: // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP]], ptr align 8 [[AGG_TEMP1]], i64 24, i1 false) // CHECK-NEXT: [[WIDE_PTR_PTR_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 0 // CHECK-NEXT: [[WIDE_PTR_PTR34:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR33]], align 8 @@ -125,27 +125,27 @@ flex_t g_flex = {2, {1, 2}}; // CHECK-NEXT: [[WIDE_PTR_LB_ADDR37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP]], i32 0, i32 2 // CHECK-NEXT: [[WIDE_PTR_LB38:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR37]], align 8 // CHECK-NEXT: [[TMP15:%.*]] = icmp ne ptr [[WIDE_PTR_PTR34]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP15]], label [[BOUNDSCHECK_NOTNULL:%.*]], label %[[CONT44:.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[TMP15]], label [[BOUNDSCHECK_NOTNULL:%.*]], label [[CONT44:%.*]], {{!annotation ![0-9]+}} // CHECK: boundscheck.notnull: // CHECK-NEXT: [[TMP16:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR34]], i64 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB36]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT40:.*]], label %[[TRAP39:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP39]]: +// CHECK-NEXT: br i1 [[TMP17]], label [[CONT40:%.*]], label [[TRAP39:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap39: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT40]]: +// CHECK: cont40: // CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[WIDE_PTR_PTR34]], [[TMP16]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT42:.*]], label %[[TRAP41:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP41]]: +// CHECK-NEXT: br i1 [[TMP18]], label [[CONT42:%.*]], label [[TRAP41:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap41: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT42]]: +// CHECK: cont42: // CHECK-NEXT: [[TMP19:%.*]] = icmp uge ptr [[WIDE_PTR_PTR34]], [[WIDE_PTR_LB38]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP19]], label %[[CONT44]], label %[[TRAP43:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP43]]: +// CHECK-NEXT: br i1 [[TMP19]], label [[CONT44]], label [[TRAP43:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap43: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT44]]: +// CHECK: cont44: // CHECK-NEXT: ret ptr [[WIDE_PTR_PTR34]] // flex_t *addrof_g(void) { @@ -155,6 +155,7 @@ flex_t *addrof_g(void) { // CHECK-LABEL: @addrof_deref_g( // CHECK-NEXT: entry: // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca [[STRUCT_FLEX_T:%.*]], align 4 // CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP7:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @g_flex, align 4 @@ -180,31 +181,32 @@ flex_t *addrof_g(void) { // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} // CHECK: cont: // CHECK-NEXT: [[TMP6:%.*]] = icmp ule ptr [[WIDE_PTR_PTR]], [[TMP4]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT4:.*]], label %[[TRAP3:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP3]]: +// CHECK-NEXT: br i1 [[TMP6]], label [[CONT4:%.*]], label [[TRAP3:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap3: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT4]]: +// CHECK: cont4: // CHECK-NEXT: [[TMP7:%.*]] = icmp uge ptr [[WIDE_PTR_PTR]], [[WIDE_PTR_LB]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP7]], label %[[CONT6:.*]], label %[[TRAP5:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP5]]: +// CHECK-NEXT: br i1 [[TMP7]], label [[CONT6:%.*]], label [[TRAP5:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap5: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT6]]: -// CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 +// CHECK: cont6: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TEMP1]], ptr align 4 [[WIDE_PTR_PTR]], i64 4, i1 false) +// CHECK-NEXT: [[ELEMS:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS]], i64 0, i64 0 -// CHECK-NEXT: [[ELEMS8:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 1 +// CHECK-NEXT: [[ELEMS8:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY9:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS8]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR]], i32 0, i32 0 +// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP1]], i32 0, i32 0 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[COUNT]], align 4 // CHECK-NEXT: [[IDX_EXT10:%.*]] = sext i32 [[TMP8]] to i64 // CHECK-NEXT: [[ADD_PTR11:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY9]], i64 [[IDX_EXT10]] // CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP7]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP9]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP1]], ptr [[TMP9]], align 8 // CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP7]], i32 0, i32 1 // CHECK-NEXT: store ptr [[ADD_PTR11]], ptr [[TMP10]], align 8 // CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP7]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP11]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP1]], ptr [[TMP11]], align 8 // CHECK-NEXT: [[WIDE_PTR_UB_ADDR12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP7]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB13:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR12]], align 8 // CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP7]], i32 0, i32 0 @@ -226,23 +228,23 @@ flex_t *addrof_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB21:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR20]], align 8 // CHECK-NEXT: [[TMP16:%.*]] = getelementptr i32, ptr [[ARRAYIDX]], i64 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP17:%.*]] = icmp ule ptr [[TMP16]], [[WIDE_PTR_UB19]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP17]], label %[[CONT23:.*]], label %[[TRAP22:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP22]]: +// CHECK-NEXT: br i1 [[TMP17]], label [[CONT23:%.*]], label [[TRAP22:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap22: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT23]]: +// CHECK: cont23: // CHECK-NEXT: [[TMP18:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP16]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP18]], label %[[CONT25:.*]], label %[[TRAP24:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP24]]: +// CHECK-NEXT: br i1 [[TMP18]], label [[CONT25:%.*]], label [[TRAP24:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap24: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT25]]: +// CHECK: cont25: // CHECK-NEXT: [[TMP19:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB21]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP19]], label %[[CONT27:.*]], label %[[TRAP26:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP26]]: +// CHECK-NEXT: br i1 [[TMP19]], label [[CONT27:%.*]], label [[TRAP26:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap26: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT27]]: +// CHECK: cont27: // CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 // CHECK-NEXT: ret i32 [[TMP20]] // @@ -260,6 +262,7 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[AGG_TEMP3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP14:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP45:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 +// CHECK-NEXT: [[AGG_TEMP46:%.*]] = alloca [[STRUCT_FLEX_T:%.*]], align 4 // CHECK-NEXT: [[AGG_TEMP47:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP66:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: store ptr [[P:%.*]], ptr [[P_INDIRECT_ADDR]], align 8 @@ -386,8 +389,8 @@ int addrof_deref_g(void) { // CHECK-NEXT: store ptr [[WIDE_PTR_PTR34]], ptr [[FLEX]], align 8 // CHECK-NEXT: [[TMP16:%.*]] = load ptr, ptr [[FLEX]], align 8 // CHECK-NEXT: [[TMP17:%.*]] = icmp ne ptr [[TMP16]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP17]], label %[[BOUNDSCHECK_NOTNULL48:.*]], label [[BOUNDSCHECK_NULL:%.*]], {{!annotation ![0-9]+}} -// CHECK: [[BOUNDSCHECK_NOTNULL48]]: +// CHECK-NEXT: br i1 [[TMP17]], label [[BOUNDSCHECK_NOTNULL48:%.*]], label [[BOUNDSCHECK_NULL:%.*]], {{!annotation ![0-9]+}} +// CHECK: boundscheck.notnull48: // CHECK-NEXT: [[ELEMS49:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[TMP16]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY50:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS49]], i64 0, i64 0 // CHECK-NEXT: [[COUNT51:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[TMP16]], i32 0, i32 0 @@ -418,37 +421,38 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB57:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR56]], align 8 // CHECK-NEXT: [[TMP25:%.*]] = getelementptr [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR53]], i64 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP26:%.*]] = icmp ule ptr [[TMP25]], [[WIDE_PTR_UB55]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP26]], label %[[CONT59:.*]], label %[[TRAP58:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP58]]: +// CHECK-NEXT: br i1 [[TMP26]], label [[CONT59:%.*]], label [[TRAP58:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap58: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT59]]: +// CHECK: cont59: // CHECK-NEXT: [[TMP27:%.*]] = icmp ule ptr [[WIDE_PTR_PTR53]], [[TMP25]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP27]], label %[[CONT61:.*]], label %[[TRAP60:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP60]]: +// CHECK-NEXT: br i1 [[TMP27]], label [[CONT61:%.*]], label [[TRAP60:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap60: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT61]]: +// CHECK: cont61: // CHECK-NEXT: [[TMP28:%.*]] = icmp uge ptr [[WIDE_PTR_PTR53]], [[WIDE_PTR_LB57]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP28]], label %[[CONT63:.*]], label %[[TRAP62:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP62]]: +// CHECK-NEXT: br i1 [[TMP28]], label [[CONT63:%.*]], label [[TRAP62:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap62: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT63]]: -// CHECK-NEXT: [[ELEMS64:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR53]], i32 0, i32 1 +// CHECK: cont63: +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TEMP46]], ptr align 4 [[WIDE_PTR_PTR53]], i64 4, i1 false) +// CHECK-NEXT: [[ELEMS64:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP46]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY65:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS64]], i64 0, i64 0 -// CHECK-NEXT: [[ELEMS67:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR53]], i32 0, i32 1 +// CHECK-NEXT: [[ELEMS67:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP46]], i32 0, i32 1 // CHECK-NEXT: [[ARRAYDECAY68:%.*]] = getelementptr inbounds [0 x i32], ptr [[ELEMS67]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT69:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[WIDE_PTR_PTR53]], i32 0, i32 0 +// CHECK-NEXT: [[COUNT69:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[AGG_TEMP46]], i32 0, i32 0 // CHECK-NEXT: [[TMP29:%.*]] = load i32, ptr [[COUNT69]], align 4 // CHECK-NEXT: [[IDX_EXT70:%.*]] = sext i32 [[TMP29]] to i64 // CHECK-NEXT: [[ADD_PTR71:%.*]] = getelementptr inbounds i32, ptr [[ARRAYDECAY68]], i64 [[IDX_EXT70]] // CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR53]], ptr [[TMP30]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP46]], ptr [[TMP30]], align 8 // CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 1 // CHECK-NEXT: store ptr [[ADD_PTR71]], ptr [[TMP31]], align 8 // CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR53]], ptr [[TMP32]], align 8 +// CHECK-NEXT: store ptr [[AGG_TEMP46]], ptr [[TMP32]], align 8 // CHECK-NEXT: [[WIDE_PTR_UB_ADDR72:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 1 // CHECK-NEXT: [[WIDE_PTR_UB73:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR72]], align 8 // CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 0 @@ -470,23 +474,23 @@ int addrof_deref_g(void) { // CHECK-NEXT: [[WIDE_PTR_LB81:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR80]], align 8 // CHECK-NEXT: [[TMP37:%.*]] = getelementptr i32, ptr [[ARRAYIDX]], i64 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP38:%.*]] = icmp ule ptr [[TMP37]], [[WIDE_PTR_UB79]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP38]], label %[[CONT83:.*]], label %[[TRAP82:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP82]]: +// CHECK-NEXT: br i1 [[TMP38]], label [[CONT83:%.*]], label [[TRAP82:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap82: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT83]]: +// CHECK: cont83: // CHECK-NEXT: [[TMP39:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP37]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP39]], label %[[CONT85:.*]], label %[[TRAP84:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP84]]: +// CHECK-NEXT: br i1 [[TMP39]], label [[CONT85:%.*]], label [[TRAP84:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap84: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT85]]: +// CHECK: cont85: // CHECK-NEXT: [[TMP40:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB81]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP40]], label %[[CONT87:.*]], label %[[TRAP86:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP86]]: +// CHECK-NEXT: br i1 [[TMP40]], label [[CONT87:%.*]], label [[TRAP86:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap86: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR3]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT87]]: +// CHECK: cont87: // CHECK-NEXT: store i32 10, ptr [[ARRAYIDX]], align 4 // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-returns-O2.c b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-returns-O2.c index 7616de3893dd0..222b7d66ccf17 100644 --- a/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-returns-O2.c +++ b/clang/test/BoundsSafety/CodeGen/flexible-array-member-promotion-returns-O2.c @@ -15,7 +15,7 @@ inline flex_t *return_flex(int *__counted_by(11) buf) { } // CHECK-LABEL: @pointer_assign_good( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont47: // CHECK-NEXT: ret void // void pointer_assign_good() { @@ -25,7 +25,7 @@ void pointer_assign_good() { } // CHECK-LABEL: @pointer_assign_good2( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont47: // CHECK-NEXT: ret void // void pointer_assign_good2() { @@ -35,7 +35,7 @@ void pointer_assign_good2() { } // CHECK-LABEL: @pointer_init_good( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont47: // CHECK-NEXT: ret void // void pointer_init_good() { @@ -44,7 +44,7 @@ void pointer_init_good() { } // CHECK-LABEL: @pointer_init_good2( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont47: // CHECK-NEXT: ret void // void pointer_init_good2() { @@ -97,7 +97,7 @@ void pointer_count_init_good() { } // CHECK-LABEL: @elem_access_good( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont69: // CHECK-NEXT: ret void // void elem_access_good() { @@ -108,7 +108,7 @@ void elem_access_good() { } // CHECK-LABEL: @elem_access_trap( -// CHECK-NEXT: {{.*}}: +// CHECK-NEXT: cont47: // CHECK-NEXT: [[ARR:%.*]] = alloca [11 x i32], align 4 // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 44, ptr nonnull [[ARR]]) #[[ATTR6:[0-9]+]] // CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds nuw i8, ptr [[ARR]], i64 44 @@ -121,7 +121,7 @@ void elem_access_good() { // CHECK: trap: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR5]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: {{.*}}: +// CHECK: cont69: // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 44, ptr nonnull [[ARR]]) #[[ATTR6]] // CHECK-NEXT: ret void // diff --git a/clang/test/BoundsSafety/CodeGen/multiple-dependees.c b/clang/test/BoundsSafety/CodeGen/multiple-dependees.c index 01c7852648bc5..3baea91f578c0 100644 --- a/clang/test/BoundsSafety/CodeGen/multiple-dependees.c +++ b/clang/test/BoundsSafety/CodeGen/multiple-dependees.c @@ -26,6 +26,7 @@ struct T { // CHECK-NEXT: [[AGG_TEMP20:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP32:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 // CHECK-NEXT: [[AGG_TEMP40:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 +// CHECK-NEXT: [[AGG_TEMP41:%.*]] = alloca [[STRUCT_T]], align 8 // CHECK-NEXT: store i32 [[IDX:%.*]], ptr [[IDX_ADDR]], align 4 // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 16 [[ARR]], i8 0, i64 64, i1 false) // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [16 x i32], ptr [[ARR]], i64 0, i64 0 @@ -110,11 +111,12 @@ struct T { // CHECK-NEXT: [[WIDE_PTR_LB38:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR37]], align 8 // CHECK-NEXT: [[PTR39:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 2 // CHECK-NEXT: store ptr [[WIDE_PTR_PTR34]], ptr [[PTR39]], align 8 -// CHECK-NEXT: [[CNT142:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 0 +// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP41]], ptr align 8 [[T]], i64 16, i1 false) +// CHECK-NEXT: [[CNT142:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 0 // CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[CNT142]], align 8 -// CHECK-NEXT: [[CNT243:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 1 +// CHECK-NEXT: [[CNT243:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 1 // CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[CNT243]], align 4 -// CHECK-NEXT: [[PTR44:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[T]], i32 0, i32 2 +// CHECK-NEXT: [[PTR44:%.*]] = getelementptr inbounds nuw [[STRUCT_T]], ptr [[AGG_TEMP41]], i32 0, i32 2 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[PTR44]], align 8 // CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 2, [[TMP5]] // CHECK-NEXT: [[MUL45:%.*]] = mul nsw i32 3, [[TMP6]] @@ -138,23 +140,23 @@ struct T { // CHECK-NEXT: [[WIDE_PTR_LB51:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR50]], align 8 // CHECK-NEXT: [[TMP12:%.*]] = getelementptr i32, ptr [[ARRAYIDX]], i64 1, {{!annotation ![0-9]+}} // CHECK-NEXT: [[TMP13:%.*]] = icmp ule ptr [[TMP12]], [[WIDE_PTR_UB49]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP13]], label %[[CONT53:.*]], label %[[TRAP52:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP52]]: +// CHECK-NEXT: br i1 [[TMP13]], label [[CONT53:%.*]], label [[TRAP52:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap52: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT53]]: +// CHECK: cont53: // CHECK-NEXT: [[TMP14:%.*]] = icmp ule ptr [[ARRAYIDX]], [[TMP12]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP14]], label %[[CONT55:.*]], label %[[TRAP54:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP54]]: +// CHECK-NEXT: br i1 [[TMP14]], label [[CONT55:%.*]], label [[TRAP54:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap54: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT55]]: +// CHECK: cont55: // CHECK-NEXT: [[TMP15:%.*]] = icmp uge ptr [[ARRAYIDX]], [[WIDE_PTR_LB51]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[TMP15]], label %[[CONT57:.*]], label %[[TRAP56:.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} -// CHECK: [[TRAP56]]: +// CHECK-NEXT: br i1 [[TMP15]], label [[CONT57:%.*]], label [[TRAP56:%.*]], !prof [[PROF4]], {{!annotation ![0-9]+}} +// CHECK: trap56: // CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT57]]: +// CHECK: cont57: // CHECK-NEXT: [[TMP16:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 // CHECK-NEXT: ret i32 [[TMP16]] // diff --git a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-O2.c b/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-O2.c deleted file mode 100644 index 3e8b455c78297..0000000000000 --- a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-O2.c +++ /dev/null @@ -1,44 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 - -// RUN: %clang_cc1 -O2 -fbounds-safety -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s - -#include -typedef struct { - int count; - char arr[__counted_by(count)]; -} flex_t; - -typedef struct { - flex_t f; -} outer_flex_t; - -void use(void *__unsafe_indexable); - -// CHECK-LABEL: define void @process_frame( -// CHECK-SAME: ptr noundef [[FRAME:%.*]], i32 noundef [[FRAME_SIZE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { -// CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[FRAME_SIZE]] to i64 -// CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[FRAME]], i64 [[IDX_EXT]] -// CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[FRAME]], i64 4 -// CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[TMP0]], [[ADD_PTR]], !annotation [[META2:![0-9]+]] -// CHECK-NEXT: br i1 [[DOTNOT]], label %[[TRAP:.*]], label %[[CONT10:.*]], !prof [[PROF3:![0-9]+]], !annotation [[META2]] -// CHECK: [[TRAP]]: -// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META4:![0-9]+]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT10]]: -// CHECK-NEXT: tail call void @use(ptr noundef [[FRAME]]) #[[ATTR4:[0-9]+]] -// CHECK-NEXT: tail call void @use(ptr noundef [[TMP0]]) #[[ATTR4]] -// CHECK-NEXT: tail call void @use(ptr noundef [[TMP0]]) #[[ATTR4]] -// CHECK-NEXT: ret void -// -void process_frame(char *__counted_by(frame_size) frame, unsigned frame_size) { - outer_flex_t *of = (outer_flex_t *) frame; - use(&of->f); - use(of->f.arr); - use(&of->f.arr[0]); -} -//. -// CHECK: [[META2]] = !{!"bounds-safety-check-ptr-lt-upper-bound"} -// CHECK: [[PROF3]] = !{!"branch_weights", i32 8191, i32 -8192} -// CHECK: [[META4]] = !{!"bounds-safety-check-ptr-lt-upper-bound", !"bounds-safety-check-ptr-ge-lower-bound"} -//. diff --git a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len-O2.c b/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len-O2.c deleted file mode 100644 index 5391831035d85..0000000000000 --- a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len-O2.c +++ /dev/null @@ -1,49 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 - -// RUN: %clang_cc1 -O2 -fbounds-safety -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s - -#include - -typedef struct { - int count; -} header_t; - -typedef struct { - header_t header; - char arr[__counted_by(header.count)]; -} flex_t; - -typedef struct { - flex_t f; -} outer_flex_t; - -void use(void *__unsafe_indexable); - -// CHECK-LABEL: define void @process_frame( -// CHECK-SAME: ptr noundef [[FRAME:%.*]], i32 noundef [[FRAME_SIZE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { -// CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[FRAME_SIZE]] to i64 -// CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[FRAME]], i64 [[IDX_EXT]] -// CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[FRAME]], i64 4 -// CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[TMP0]], [[ADD_PTR]], !annotation [[META2:![0-9]+]] -// CHECK-NEXT: br i1 [[DOTNOT]], label %[[TRAP:.*]], label %[[CONT10:.*]], !prof [[PROF3:![0-9]+]], !annotation [[META2]] -// CHECK: [[TRAP]]: -// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], !annotation [[META4:![0-9]+]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT10]]: -// CHECK-NEXT: tail call void @use(ptr noundef [[FRAME]]) #[[ATTR4:[0-9]+]] -// CHECK-NEXT: tail call void @use(ptr noundef [[TMP0]]) #[[ATTR4]] -// CHECK-NEXT: tail call void @use(ptr noundef [[TMP0]]) #[[ATTR4]] -// CHECK-NEXT: ret void -// -void process_frame(char *__counted_by(frame_size) frame, unsigned frame_size) { - outer_flex_t *of = (outer_flex_t *) frame; - use(&of->f); - use(of->f.arr); - use(&of->f.arr[0]); -} -//. -// CHECK: [[META2]] = !{!"bounds-safety-check-ptr-lt-upper-bound"} -// CHECK: [[PROF3]] = !{!"branch_weights", i32 8191, i32 -8192} -// CHECK: [[META4]] = !{!"bounds-safety-check-ptr-lt-upper-bound", !"bounds-safety-check-ptr-ge-lower-bound"} -//. diff --git a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len.c b/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len.c deleted file mode 100644 index d141dfae4fed0..0000000000000 --- a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member-nested-len.c +++ /dev/null @@ -1,277 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 - -// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s - -#include - -typedef struct { - int count; -} header_t; - -typedef struct { - header_t header; - char arr[__counted_by(header.count)]; -} flex_t; - -typedef struct { - flex_t f; -} outer_flex_t; - -void use(void *__unsafe_indexable); - -// CHECK-LABEL: define void @process_frame( -// CHECK-SAME: ptr noundef [[FRAME:%.*]], i32 noundef [[FRAME_SIZE:%.*]]) #[[ATTR0:[0-9]+]] { -// CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[FRAME_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: [[FRAME_SIZE_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: [[OF:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: [[AGG_TEMP3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP26:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP27:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP28:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: [[AGG_TEMP65:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP66:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[TMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP67:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP81:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: store ptr [[FRAME]], ptr [[FRAME_ADDR]], align 8 -// CHECK-NEXT: store i32 [[FRAME_SIZE]], ptr [[FRAME_SIZE_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FRAME_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[FRAME_SIZE_ADDR]], align 4 -// CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 [[IDX_EXT]] -// CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP2]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP3]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP4]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 -// CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP5]], align 8 -// CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB]], ptr [[TMP6]], align 8 -// CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB]], ptr [[TMP7]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP3]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR5:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR4]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB7:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR6]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB9:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR8]], align 8 -// CHECK-NEXT: [[TMP8:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T:%.*]], ptr [[WIDE_PTR_PTR5]], i64 1 -// CHECK-NEXT: [[TMP9:%.*]] = icmp ule ptr [[TMP8]], [[WIDE_PTR_UB7]], !annotation [[META2:![0-9]+]] -// CHECK-NEXT: br i1 [[TMP9]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF3:![0-9]+]], !annotation [[META2]] -// CHECK: [[TRAP]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4:[0-9]+]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT]]: -// CHECK-NEXT: [[TMP10:%.*]] = icmp ule ptr [[WIDE_PTR_LB9]], [[WIDE_PTR_PTR5]], !annotation [[META4:![0-9]+]] -// CHECK-NEXT: br i1 [[TMP10]], label %[[CONT11:.*]], label %[[TRAP10:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP10]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT11]]: -// CHECK-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i32 0, i32 0 -// CHECK-NEXT: [[ARR:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T:%.*]], ptr [[F]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR]], i64 0, i64 0 -// CHECK-NEXT: [[HEADER:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F]], i32 0, i32 0 -// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_HEADER_T:%.*]], ptr [[HEADER]], i32 0, i32 0 -// CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[COUNT]], align 4 -// CHECK-NEXT: [[IDX_EXT12:%.*]] = sext i32 [[TMP11]] to i64 -// CHECK-NEXT: [[ADD_PTR13:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY]], i64 [[IDX_EXT12]] -// CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F]], ptr [[TMP12]], align 8 -// CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR13]], ptr [[TMP13]], align 8 -// CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F]], ptr [[TMP14]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR14:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR15:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR14]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB17:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR16]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR18:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB19:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR18]], align 8 -// CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR15]], ptr [[TMP15]], align 8 -// CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB17]], ptr [[TMP16]], align 8 -// CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB19]], ptr [[TMP17]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR20:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR21:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR20]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR22:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB23:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR22]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB25:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR24]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR21]]) -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP28]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR30:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR29]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB32:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR31]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB34:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR33]], align 8 -// CHECK-NEXT: [[TMP18:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR30]], i64 1 -// CHECK-NEXT: [[TMP19:%.*]] = icmp ule ptr [[TMP18]], [[WIDE_PTR_UB32]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP19]], label %[[CONT36:.*]], label %[[TRAP35:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP35]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT36]]: -// CHECK-NEXT: [[TMP20:%.*]] = icmp ule ptr [[WIDE_PTR_LB34]], [[WIDE_PTR_PTR30]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP20]], label %[[CONT38:.*]], label %[[TRAP37:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP37]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT38]]: -// CHECK-NEXT: [[F39:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR30]], i32 0, i32 0 -// CHECK-NEXT: [[ARR40:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY41:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR40]], i64 0, i64 0 -// CHECK-NEXT: [[ARR43:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY44:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR43]], i64 0, i64 0 -// CHECK-NEXT: [[HEADER45:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 0 -// CHECK-NEXT: [[COUNT46:%.*]] = getelementptr inbounds nuw [[STRUCT_HEADER_T]], ptr [[HEADER45]], i32 0, i32 0 -// CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[COUNT46]], align 4 -// CHECK-NEXT: [[IDX_EXT47:%.*]] = sext i32 [[TMP21]] to i64 -// CHECK-NEXT: [[ADD_PTR48:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY44]], i64 [[IDX_EXT47]] -// CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F39]], ptr [[TMP22]], align 8 -// CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR48]], ptr [[TMP23]], align 8 -// CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F39]], ptr [[TMP24]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR49:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB50:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR49]], align 8 -// CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB50]], ptr [[TMP25]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR51:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR52:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR51]], align 8 -// CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[ARRAYDECAY41]], ptr [[TMP26]], align 8 -// CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR52]], ptr [[TMP27]], align 8 -// CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[ARRAYDECAY41]], ptr [[TMP28]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR53:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR54:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR53]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR55:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB56:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR55]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR57:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB58:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR57]], align 8 -// CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR54]], ptr [[TMP29]], align 8 -// CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB56]], ptr [[TMP30]], align 8 -// CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB58]], ptr [[TMP31]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR59:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR60:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR59]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR61:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB62:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR61]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR63:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB64:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR63]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR60]]) -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP67]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR68:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP67]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR69:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR68]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR70:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP67]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB71:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR70]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR72:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP67]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB73:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR72]], align 8 -// CHECK-NEXT: [[TMP32:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR69]], i64 1 -// CHECK-NEXT: [[TMP33:%.*]] = icmp ule ptr [[TMP32]], [[WIDE_PTR_UB71]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP33]], label %[[CONT75:.*]], label %[[TRAP74:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP74]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT75]]: -// CHECK-NEXT: [[TMP34:%.*]] = icmp ule ptr [[WIDE_PTR_LB73]], [[WIDE_PTR_PTR69]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP34]], label %[[CONT77:.*]], label %[[TRAP76:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP76]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT77]]: -// CHECK-NEXT: [[F78:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR69]], i32 0, i32 0 -// CHECK-NEXT: [[ARR79:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F78]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY80:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR79]], i64 0, i64 0 -// CHECK-NEXT: [[ARR82:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F78]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY83:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR82]], i64 0, i64 0 -// CHECK-NEXT: [[HEADER84:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F78]], i32 0, i32 0 -// CHECK-NEXT: [[COUNT85:%.*]] = getelementptr inbounds nuw [[STRUCT_HEADER_T]], ptr [[HEADER84]], i32 0, i32 0 -// CHECK-NEXT: [[TMP35:%.*]] = load i32, ptr [[COUNT85]], align 4 -// CHECK-NEXT: [[IDX_EXT86:%.*]] = sext i32 [[TMP35]] to i64 -// CHECK-NEXT: [[ADD_PTR87:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY83]], i64 [[IDX_EXT86]] -// CHECK-NEXT: [[TMP36:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F78]], ptr [[TMP36]], align 8 -// CHECK-NEXT: [[TMP37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR87]], ptr [[TMP37]], align 8 -// CHECK-NEXT: [[TMP38:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F78]], ptr [[TMP38]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR88:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB89:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR88]], align 8 -// CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB89]], ptr [[TMP39]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR90:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP81]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR91:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR90]], align 8 -// CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[ARRAYDECAY80]], ptr [[TMP40]], align 8 -// CHECK-NEXT: [[TMP41:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR91]], ptr [[TMP41]], align 8 -// CHECK-NEXT: [[TMP42:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[ARRAYDECAY80]], ptr [[TMP42]], align 8 -// CHECK-NEXT: [[TMP43:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 0 -// CHECK-NEXT: [[TMP44:%.*]] = load ptr, ptr [[TMP43]], align 8 -// CHECK-NEXT: [[BOUND_PTR_ARITH:%.*]] = getelementptr i8, ptr [[TMP44]], i64 0 -// CHECK-NEXT: [[TMP45:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[BOUND_PTR_ARITH]], ptr [[TMP45]], align 8 -// CHECK-NEXT: [[TMP46:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 1 -// CHECK-NEXT: [[TMP47:%.*]] = load ptr, ptr [[TMP46]], align 8 -// CHECK-NEXT: [[TMP48:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[TMP47]], ptr [[TMP48]], align 8 -// CHECK-NEXT: [[TMP49:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 2 -// CHECK-NEXT: [[TMP50:%.*]] = load ptr, ptr [[TMP49]], align 8 -// CHECK-NEXT: [[TMP51:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[TMP50]], ptr [[TMP51]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR92:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR93:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR92]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR94:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB95:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR94]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR96:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP66]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB97:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR96]], align 8 -// CHECK-NEXT: [[TMP52:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR93]], ptr [[TMP52]], align 8 -// CHECK-NEXT: [[TMP53:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB95]], ptr [[TMP53]], align 8 -// CHECK-NEXT: [[TMP54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB97]], ptr [[TMP54]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR98:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR99:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR98]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR100:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB101:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR100]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR102:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP65]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB103:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR102]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR99]]) -// CHECK-NEXT: ret void -// -void process_frame(char *__counted_by(frame_size) frame, unsigned frame_size) { - outer_flex_t *of = (outer_flex_t *) frame; - use(&of->f); - use(of->f.arr); - use(&of->f.arr[0]); -} -//. -// CHECK: [[META2]] = !{!"bounds-safety-check-ptr-lt-upper-bound"} -// CHECK: [[PROF3]] = !{!"branch_weights", i32 1048575, i32 1} -// CHECK: [[META4]] = !{!"bounds-safety-check-ptr-ge-lower-bound"} -//. diff --git a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member.c b/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member.c deleted file mode 100644 index e4c2f087c761b..0000000000000 --- a/clang/test/BoundsSafety/CodeGen/nested-flexible-array-member.c +++ /dev/null @@ -1,269 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 - -// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s - -#include -typedef struct { - int count; - char arr[__counted_by(count)]; -} flex_t; - -typedef struct { - flex_t f; -} outer_flex_t; - -void use(void *__unsafe_indexable); - -// CHECK-LABEL: define void @process_frame( -// CHECK-SAME: ptr noundef [[FRAME:%.*]], i32 noundef [[FRAME_SIZE:%.*]]) #[[ATTR0:[0-9]+]] { -// CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[FRAME_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: [[FRAME_SIZE_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: [[OF:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP1:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: [[AGG_TEMP3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP26:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP27:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP28:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP42:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: [[AGG_TEMP64:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 -// CHECK-NEXT: [[AGG_TEMP65:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[TMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.0", align 8 -// CHECK-NEXT: [[AGG_TEMP66:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 -// CHECK-NEXT: [[AGG_TEMP80:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 -// CHECK-NEXT: store ptr [[FRAME]], ptr [[FRAME_ADDR]], align 8 -// CHECK-NEXT: store i32 [[FRAME_SIZE]], ptr [[FRAME_SIZE_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FRAME_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[FRAME_SIZE_ADDR]], align 4 -// CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 [[IDX_EXT]] -// CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP2]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP3]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[TMP0]], ptr [[TMP4]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR]], align 8 -// CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP5]], align 8 -// CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB]], ptr [[TMP6]], align 8 -// CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[OF]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB]], ptr [[TMP7]], align 8 -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP3]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR4:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR5:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR4]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR6:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB7:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR6]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR8:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP3]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB9:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR8]], align 8 -// CHECK-NEXT: [[TMP8:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T:%.*]], ptr [[WIDE_PTR_PTR5]], i64 1 -// CHECK-NEXT: [[TMP9:%.*]] = icmp ule ptr [[TMP8]], [[WIDE_PTR_UB7]], !annotation [[META2:![0-9]+]] -// CHECK-NEXT: br i1 [[TMP9]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF3:![0-9]+]], !annotation [[META2]] -// CHECK: [[TRAP]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4:[0-9]+]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT]]: -// CHECK-NEXT: [[TMP10:%.*]] = icmp ule ptr [[WIDE_PTR_LB9]], [[WIDE_PTR_PTR5]], !annotation [[META4:![0-9]+]] -// CHECK-NEXT: br i1 [[TMP10]], label %[[CONT11:.*]], label %[[TRAP10:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP10]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT11]]: -// CHECK-NEXT: [[F:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR5]], i32 0, i32 0 -// CHECK-NEXT: [[ARR:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T:%.*]], ptr [[F]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F]], i32 0, i32 0 -// CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[COUNT]], align 4 -// CHECK-NEXT: [[IDX_EXT12:%.*]] = sext i32 [[TMP11]] to i64 -// CHECK-NEXT: [[ADD_PTR13:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY]], i64 [[IDX_EXT12]] -// CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F]], ptr [[TMP12]], align 8 -// CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR13]], ptr [[TMP13]], align 8 -// CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F]], ptr [[TMP14]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR14:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR15:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR14]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB17:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR16]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR18:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP2]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB19:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR18]], align 8 -// CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR15]], ptr [[TMP15]], align 8 -// CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB17]], ptr [[TMP16]], align 8 -// CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB19]], ptr [[TMP17]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR20:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR21:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR20]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR22:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB23:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR22]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP1]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB25:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR24]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR21]]) -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP28]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR30:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR29]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB32:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR31]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR33:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP28]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB34:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR33]], align 8 -// CHECK-NEXT: [[TMP18:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR30]], i64 1 -// CHECK-NEXT: [[TMP19:%.*]] = icmp ule ptr [[TMP18]], [[WIDE_PTR_UB32]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP19]], label %[[CONT36:.*]], label %[[TRAP35:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP35]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT36]]: -// CHECK-NEXT: [[TMP20:%.*]] = icmp ule ptr [[WIDE_PTR_LB34]], [[WIDE_PTR_PTR30]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP20]], label %[[CONT38:.*]], label %[[TRAP37:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP37]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT38]]: -// CHECK-NEXT: [[F39:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR30]], i32 0, i32 0 -// CHECK-NEXT: [[ARR40:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY41:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR40]], i64 0, i64 0 -// CHECK-NEXT: [[ARR43:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY44:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR43]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT45:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F39]], i32 0, i32 0 -// CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[COUNT45]], align 4 -// CHECK-NEXT: [[IDX_EXT46:%.*]] = sext i32 [[TMP21]] to i64 -// CHECK-NEXT: [[ADD_PTR47:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY44]], i64 [[IDX_EXT46]] -// CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F39]], ptr [[TMP22]], align 8 -// CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR47]], ptr [[TMP23]], align 8 -// CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F39]], ptr [[TMP24]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR48:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB49:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR48]], align 8 -// CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB49]], ptr [[TMP25]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR50:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP42]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR51:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR50]], align 8 -// CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[ARRAYDECAY41]], ptr [[TMP26]], align 8 -// CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR51]], ptr [[TMP27]], align 8 -// CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[ARRAYDECAY41]], ptr [[TMP28]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR52:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR53:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR52]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB55:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR54]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR56:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP27]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB57:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR56]], align 8 -// CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR53]], ptr [[TMP29]], align 8 -// CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB55]], ptr [[TMP30]], align 8 -// CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB57]], ptr [[TMP31]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR58:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR59:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR58]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR60:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB61:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR60]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR62:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP26]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB63:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR62]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR59]]) -// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[AGG_TEMP66]], ptr align 8 [[OF]], i64 24, i1 false) -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR67:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR68:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR67]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR69:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB70:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR69]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR71:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable", ptr [[AGG_TEMP66]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB72:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR71]], align 8 -// CHECK-NEXT: [[TMP32:%.*]] = getelementptr [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR68]], i64 1 -// CHECK-NEXT: [[TMP33:%.*]] = icmp ule ptr [[TMP32]], [[WIDE_PTR_UB70]], !annotation [[META2]] -// CHECK-NEXT: br i1 [[TMP33]], label %[[CONT74:.*]], label %[[TRAP73:.*]], !prof [[PROF3]], !annotation [[META2]] -// CHECK: [[TRAP73]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META2]] -// CHECK-NEXT: unreachable, !annotation [[META2]] -// CHECK: [[CONT74]]: -// CHECK-NEXT: [[TMP34:%.*]] = icmp ule ptr [[WIDE_PTR_LB72]], [[WIDE_PTR_PTR68]], !annotation [[META4]] -// CHECK-NEXT: br i1 [[TMP34]], label %[[CONT76:.*]], label %[[TRAP75:.*]], !prof [[PROF3]], !annotation [[META4]] -// CHECK: [[TRAP75]]: -// CHECK-NEXT: call void @llvm.ubsantrap(i8 25) #[[ATTR4]], !annotation [[META4]] -// CHECK-NEXT: unreachable, !annotation [[META4]] -// CHECK: [[CONT76]]: -// CHECK-NEXT: [[F77:%.*]] = getelementptr inbounds nuw [[STRUCT_OUTER_FLEX_T]], ptr [[WIDE_PTR_PTR68]], i32 0, i32 0 -// CHECK-NEXT: [[ARR78:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F77]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY79:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR78]], i64 0, i64 0 -// CHECK-NEXT: [[ARR81:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F77]], i32 0, i32 1 -// CHECK-NEXT: [[ARRAYDECAY82:%.*]] = getelementptr inbounds [0 x i8], ptr [[ARR81]], i64 0, i64 0 -// CHECK-NEXT: [[COUNT83:%.*]] = getelementptr inbounds nuw [[STRUCT_FLEX_T]], ptr [[F77]], i32 0, i32 0 -// CHECK-NEXT: [[TMP35:%.*]] = load i32, ptr [[COUNT83]], align 4 -// CHECK-NEXT: [[IDX_EXT84:%.*]] = sext i32 [[TMP35]] to i64 -// CHECK-NEXT: [[ADD_PTR85:%.*]] = getelementptr inbounds i8, ptr [[ARRAYDECAY82]], i64 [[IDX_EXT84]] -// CHECK-NEXT: [[TMP36:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[F77]], ptr [[TMP36]], align 8 -// CHECK-NEXT: [[TMP37:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[ADD_PTR85]], ptr [[TMP37]], align 8 -// CHECK-NEXT: [[TMP38:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[F77]], ptr [[TMP38]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR86:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB87:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR86]], align 8 -// CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB87]], ptr [[TMP39]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR88:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.2", ptr [[AGG_TEMP80]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR89:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR88]], align 8 -// CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[ARRAYDECAY79]], ptr [[TMP40]], align 8 -// CHECK-NEXT: [[TMP41:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR89]], ptr [[TMP41]], align 8 -// CHECK-NEXT: [[TMP42:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[ARRAYDECAY79]], ptr [[TMP42]], align 8 -// CHECK-NEXT: [[TMP43:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 0 -// CHECK-NEXT: [[TMP44:%.*]] = load ptr, ptr [[TMP43]], align 8 -// CHECK-NEXT: [[BOUND_PTR_ARITH:%.*]] = getelementptr i8, ptr [[TMP44]], i64 0 -// CHECK-NEXT: [[TMP45:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[BOUND_PTR_ARITH]], ptr [[TMP45]], align 8 -// CHECK-NEXT: [[TMP46:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 1 -// CHECK-NEXT: [[TMP47:%.*]] = load ptr, ptr [[TMP46]], align 8 -// CHECK-NEXT: [[TMP48:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[TMP47]], ptr [[TMP48]], align 8 -// CHECK-NEXT: [[TMP49:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[TMP]], i32 0, i32 2 -// CHECK-NEXT: [[TMP50:%.*]] = load ptr, ptr [[TMP49]], align 8 -// CHECK-NEXT: [[TMP51:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[TMP50]], ptr [[TMP51]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR90:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR91:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR90]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR92:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB93:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR92]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR94:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.0", ptr [[AGG_TEMP65]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB95:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR94]], align 8 -// CHECK-NEXT: [[TMP52:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 0 -// CHECK-NEXT: store ptr [[WIDE_PTR_PTR91]], ptr [[TMP52]], align 8 -// CHECK-NEXT: [[TMP53:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 1 -// CHECK-NEXT: store ptr [[WIDE_PTR_UB93]], ptr [[TMP53]], align 8 -// CHECK-NEXT: [[TMP54:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 2 -// CHECK-NEXT: store ptr [[WIDE_PTR_LB95]], ptr [[TMP54]], align 8 -// CHECK-NEXT: [[WIDE_PTR_PTR_ADDR96:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 0 -// CHECK-NEXT: [[WIDE_PTR_PTR97:%.*]] = load ptr, ptr [[WIDE_PTR_PTR_ADDR96]], align 8 -// CHECK-NEXT: [[WIDE_PTR_UB_ADDR98:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 1 -// CHECK-NEXT: [[WIDE_PTR_UB99:%.*]] = load ptr, ptr [[WIDE_PTR_UB_ADDR98]], align 8 -// CHECK-NEXT: [[WIDE_PTR_LB_ADDR100:%.*]] = getelementptr inbounds nuw %"__bounds_safety::wide_ptr.bidi_indexable.1", ptr [[AGG_TEMP64]], i32 0, i32 2 -// CHECK-NEXT: [[WIDE_PTR_LB101:%.*]] = load ptr, ptr [[WIDE_PTR_LB_ADDR100]], align 8 -// CHECK-NEXT: call void @use(ptr noundef [[WIDE_PTR_PTR97]]) -// CHECK-NEXT: ret void -// -void process_frame(char *__counted_by(frame_size) frame, unsigned frame_size) { - outer_flex_t *of = (outer_flex_t *) frame; - use(&of->f); - use(of->f.arr); - use(&of->f.arr[0]); -} -//. -// CHECK: [[META2]] = !{!"bounds-safety-check-ptr-lt-upper-bound"} -// CHECK: [[PROF3]] = !{!"branch_weights", i32 1048575, i32 1} -// CHECK: [[META4]] = !{!"bounds-safety-check-ptr-ge-lower-bound"} -//. diff --git a/clang/test/BoundsSafety/Profile/flexible-array-member-checks-code-coverage.c b/clang/test/BoundsSafety/Profile/flexible-array-member-checks-code-coverage.c index f257d0dc815de..f0db02b64178a 100644 --- a/clang/test/BoundsSafety/Profile/flexible-array-member-checks-code-coverage.c +++ b/clang/test/BoundsSafety/Profile/flexible-array-member-checks-code-coverage.c @@ -18,28 +18,28 @@ void bar(struct s *p); // CHECK-NEXT: store i64 [[TMP0]], ptr @__profc_foo, align 8 // CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[SIZE]] to i64 // CHECK-NEXT: [[FLEX_BASE_NULL_CHECK_NOT:%.*]] = icmp eq ptr [[BUF]], null, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label %[[CONT41:.*]], label [[FLEX_BASE_NONNULL:%.*]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[FLEX_BASE_NULL_CHECK_NOT]], label [[CONT41:%.*]], label [[FLEX_BASE_NONNULL:%.*]], {{!annotation ![0-9]+}} // CHECK: flex.base.nonnull: // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[BUF]], i64 [[IDX_EXT]] // CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[BUF]], i64 4 // CHECK-NEXT: [[DOTNOT:%.*]] = icmp ugt ptr [[BUF]], [[TMP1]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[DOTNOT51:%.*]] = icmp ugt ptr [[TMP1]], [[ADD_PTR]], {{!annotation ![0-9]+}} // CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[DOTNOT]], i1 true, i1 [[DOTNOT51]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label %[[CONT27:.*]], !prof [[PROF6:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK-NEXT: br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT27:%.*]], !prof [[PROF6:![0-9]+]], {{!annotation ![0-9]+}} // CHECK: trap: // CHECK-NEXT: tail call void @llvm.ubsantrap(i8 25) #[[ATTR3:[0-9]+]], {{!annotation ![0-9]+}} // CHECK-NEXT: unreachable, {{!annotation ![0-9]+}} -// CHECK: [[CONT27]]: +// CHECK: cont27: // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[BUF]], align 4, {{!tbaa ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_MINUS:%.*]] = icmp sgt i32 [[TMP2]], -1, {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label %[[CONT30:.*]], label [[TRAP]], !prof [[PROF13:![0-9]+]], {{!annotation ![0-9]+}} -// CHECK: [[CONT30]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_MINUS]], label [[CONT30:%.*]], label [[TRAP]], !prof [[PROF13:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK: cont30: // CHECK-NEXT: [[GEPDIFF:%.*]] = add nsw i64 [[IDX_EXT]], -4, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_AVAIL_COUNT_DIV:%.*]] = ashr exact i64 [[GEPDIFF]], 2, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_INTPTR:%.*]] = zext nneg i32 [[TMP2]] to i64, {{!annotation ![0-9]+}} // CHECK-NEXT: [[FLEX_COUNT_CHECK_NOT_NOT:%.*]] = icmp ult i64 [[FLEX_AVAIL_COUNT_DIV]], [[FLEX_COUNT_INTPTR]], {{!annotation ![0-9]+}} -// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK_NOT_NOT]], label [[TRAP]], label %[[CONT41]], !prof [[PROF17:![0-9]+]], {{!annotation ![0-9]+}} -// CHECK: [[CONT41]]: +// CHECK-NEXT: br i1 [[FLEX_COUNT_CHECK_NOT_NOT]], label [[TRAP]], label [[CONT41]], !prof [[PROF17:![0-9]+]], {{!annotation ![0-9]+}} +// CHECK: cont41: // CHECK-NEXT: tail call void @bar(ptr noundef [[BUF]]) #[[ATTR4:[0-9]+]] // CHECK-NEXT: ret void // From 944b2fadcd889ee1e41da21240472cf0415e9953 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Tue, 29 Jul 2025 18:02:26 -0700 Subject: [PATCH 2/2] Adjust some failing CodeGen tests --- .../CodeGen/array_subscript_agg.c | 100 +++++++++--------- .../CodeGen/flexible-array-member-bidi-O0.c | 56 +++++----- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c b/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c index cb7869dc0d795..f9aa8f9ca8333 100644 --- a/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c +++ b/clang/test/BoundsSafety/CodeGen/array_subscript_agg.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 // REQUIRES: system-darwin // Include the `access_size` because this effects the checks that are emitted. -// RUN: %clang_cc1 -O0 -fbounds-safety -fbounds-safety-bringup-missing-checks=access_size,array_subscript_agg -triple arm64-apple-iphoneos -emit-llvm %s -o - | FileCheck --check-prefixes=NEW %s -// RUN: %clang_cc1 -O0 -fbounds-safety -fno-bounds-safety-bringup-missing-checks=access_size,array_subscript_agg -triple arm64-apple-iphoneos -emit-llvm %s -o - | FileCheck --check-prefixes=LEGACY %s +// RUN: %clang_cc1 -O0 -fbounds-safety -fbounds-safety-bringup-missing-checks=access_size,array_subscript_agg -triple arm64-apple-ios -emit-llvm %s -o - | FileCheck --check-prefixes=NEW %s +// RUN: %clang_cc1 -O0 -fbounds-safety -fno-bounds-safety-bringup-missing-checks=access_size,array_subscript_agg -triple arm64-apple-ios -emit-llvm %s -o - | FileCheck --check-prefixes=LEGACY %s #include #include @@ -11,8 +11,8 @@ struct Foo { int y; }; -// NEW-LABEL: define dso_local i64 @access_Foo_bi( -// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { +// NEW-LABEL: define i64 @access_Foo_bi( +// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -53,8 +53,8 @@ struct Foo { // NEW-NEXT: [[TMP5:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP5]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_bi( -// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { +// LEGACY-LABEL: define i64 @access_Foo_bi( +// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0:[0-9]+]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -76,7 +76,7 @@ struct Foo access_Foo_bi(struct Foo* __bidi_indexable ptr, int idx) { return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_idx( +// NEW-LABEL: define i64 @access_Foo_idx( // NEW-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -129,7 +129,7 @@ struct Foo access_Foo_bi(struct Foo* __bidi_indexable ptr, int idx) { // NEW-NEXT: [[TMP8:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP8]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_idx( +// LEGACY-LABEL: define i64 @access_Foo_idx( // LEGACY-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -163,7 +163,7 @@ struct Foo access_Foo_idx(struct Foo* __indexable ptr, int idx) { return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_cb( +// NEW-LABEL: define i64 @access_Foo_cb( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -216,7 +216,7 @@ struct Foo access_Foo_idx(struct Foo* __indexable ptr, int idx) { // NEW-NEXT: [[TMP10:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP10]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_cb( +// LEGACY-LABEL: define i64 @access_Foo_cb( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -250,7 +250,7 @@ struct Foo access_Foo_cb(struct Foo* __counted_by(count) ptr, int idx, int count return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_cbon( +// NEW-LABEL: define i64 @access_Foo_cbon( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -316,7 +316,7 @@ struct Foo access_Foo_cb(struct Foo* __counted_by(count) ptr, int idx, int count // NEW-NEXT: [[TMP14:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP14]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_cbon( +// LEGACY-LABEL: define i64 @access_Foo_cbon( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -363,7 +363,7 @@ struct Foo access_Foo_cbon(struct Foo* __counted_by_or_null(count) ptr, int idx, return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_sb( +// NEW-LABEL: define i64 @access_Foo_sb( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -416,7 +416,7 @@ struct Foo access_Foo_cbon(struct Foo* __counted_by_or_null(count) ptr, int idx, // NEW-NEXT: [[TMP10:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP10]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_sb( +// LEGACY-LABEL: define i64 @access_Foo_sb( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -450,7 +450,7 @@ struct Foo access_Foo_sb(struct Foo* __sized_by(count) ptr, int idx, int count) return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_sbon( +// NEW-LABEL: define i64 @access_Foo_sbon( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -516,7 +516,7 @@ struct Foo access_Foo_sb(struct Foo* __sized_by(count) ptr, int idx, int count) // NEW-NEXT: [[TMP14:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP14]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_sbon( +// LEGACY-LABEL: define i64 @access_Foo_sbon( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -563,7 +563,7 @@ struct Foo access_Foo_sbon(struct Foo* __sized_by_or_null(count) ptr, int idx, i return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_var_array_size( +// NEW-LABEL: define i64 @access_Foo_var_array_size( // NEW-SAME: i32 noundef [[COUNT:%.*]], ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -618,7 +618,7 @@ struct Foo access_Foo_sbon(struct Foo* __sized_by_or_null(count) ptr, int idx, i // NEW-NEXT: [[TMP12:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP12]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_var_array_size( +// LEGACY-LABEL: define i64 @access_Foo_var_array_size( // LEGACY-SAME: i32 noundef [[COUNT:%.*]], ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -654,7 +654,7 @@ struct Foo access_Foo_var_array_size(int count, struct Foo ptr[count], int idx) return ptr[idx]; } -// NEW-LABEL: define dso_local i64 @access_Foo_const_array_size( +// NEW-LABEL: define i64 @access_Foo_const_array_size( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -703,7 +703,7 @@ struct Foo access_Foo_var_array_size(int count, struct Foo ptr[count], int idx) // NEW-NEXT: [[TMP9:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP9]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_const_array_size( +// LEGACY-LABEL: define i64 @access_Foo_const_array_size( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -737,7 +737,7 @@ struct NestedArrayOfStructs { struct Foo arr[5]; }; -// NEW-LABEL: define dso_local i64 @access_Foo_from_struct_arr( +// NEW-LABEL: define i64 @access_Foo_from_struct_arr( // NEW-SAME: ptr noundef [[NAOS:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -775,7 +775,7 @@ struct NestedArrayOfStructs { // NEW-NEXT: [[TMP6:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP6]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_from_struct_arr( +// LEGACY-LABEL: define i64 @access_Foo_from_struct_arr( // LEGACY-SAME: ptr noundef [[NAOS:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -806,8 +806,8 @@ struct HasFAM { // FIXME: The `__counted_by` attribute isn't used for the bounds check on the // ArraySubscriptExpr (rdar://145253815). -// NEW-LABEL: define dso_local i64 @access_Foo_from_HasFAM( -// NEW-SAME: ptr noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-LABEL: define i64 @access_Foo_from_HasFAM( +// NEW-SAME: ptr dead_on_return noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[HAS_FAM_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -886,8 +886,8 @@ struct HasFAM { // NEW-NEXT: [[TMP12:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP12]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_from_HasFAM( -// LEGACY-SAME: ptr noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-LABEL: define i64 @access_Foo_from_HasFAM( +// LEGACY-SAME: ptr dead_on_return noundef [[HAS_FAM:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[HAS_FAM_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -949,7 +949,7 @@ struct Foo access_Foo_from_HasFAM(struct HasFAM* __bidi_indexable has_fam, int i // Access with a MemberExpr has identical codegen -// NEW-LABEL: define dso_local i64 @access_Foo_eb( +// NEW-LABEL: define i64 @access_Foo_eb( // NEW-SAME: ptr noundef [[START:%.*]], i32 noundef [[IDX:%.*]], ptr noundef [[END:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -1001,7 +1001,7 @@ struct Foo access_Foo_from_HasFAM(struct HasFAM* __bidi_indexable has_fam, int i // NEW-NEXT: [[TMP11:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP11]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_eb( +// LEGACY-LABEL: define i64 @access_Foo_eb( // LEGACY-SAME: ptr noundef [[START:%.*]], i32 noundef [[IDX:%.*]], ptr noundef [[END:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -1034,8 +1034,8 @@ struct Foo access_Foo_eb(struct Foo* __ended_by(end) start, int idx, struct Foo* return start[idx]; } -// NEW-LABEL: define dso_local i32 @access_Foo_member_bi( -// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-LABEL: define i32 @access_Foo_member_bi( +// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1075,8 +1075,8 @@ struct Foo access_Foo_eb(struct Foo* __ended_by(end) start, int idx, struct Foo* // NEW-NEXT: [[TMP5:%.*]] = load i32, ptr [[X]], align 4 // NEW-NEXT: ret i32 [[TMP5]] // -// LEGACY-LABEL: define dso_local i32 @access_Foo_member_bi( -// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-LABEL: define i32 @access_Foo_member_bi( +// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1113,7 +1113,7 @@ int access_Foo_member_bi(struct Foo* __bidi_indexable ptr, int idx) { return ptr[idx].x; } -// NEW-LABEL: define dso_local i32 @access_Foo_member_idx( +// NEW-LABEL: define i32 @access_Foo_member_idx( // NEW-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR:%.*]] = alloca %"__bounds_safety::wide_ptr.indexable", align 8 @@ -1165,7 +1165,7 @@ int access_Foo_member_bi(struct Foo* __bidi_indexable ptr, int idx) { // NEW-NEXT: [[TMP8:%.*]] = load i32, ptr [[X]], align 4 // NEW-NEXT: ret i32 [[TMP8]] // -// LEGACY-LABEL: define dso_local i32 @access_Foo_member_idx( +// LEGACY-LABEL: define i32 @access_Foo_member_idx( // LEGACY-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR:%.*]] = alloca %"__bounds_safety::wide_ptr.indexable", align 8 @@ -1214,7 +1214,7 @@ int access_Foo_member_idx(struct Foo* __indexable ptr, int idx) { return ptr[idx].x; } -// NEW-LABEL: define dso_local i32 @access_Foo_member_cb( +// NEW-LABEL: define i32 @access_Foo_member_cb( // NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_ADDR:%.*]] = alloca ptr, align 8 @@ -1266,7 +1266,7 @@ int access_Foo_member_idx(struct Foo* __indexable ptr, int idx) { // NEW-NEXT: [[TMP10:%.*]] = load i32, ptr [[X]], align 4 // NEW-NEXT: ret i32 [[TMP10]] // -// LEGACY-LABEL: define dso_local i32 @access_Foo_member_cb( +// LEGACY-LABEL: define i32 @access_Foo_member_cb( // LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]], i32 noundef [[COUNT:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_ADDR:%.*]] = alloca ptr, align 8 @@ -1319,7 +1319,7 @@ int access_Foo_member_cb(struct Foo* __counted_by(count) ptr, int idx, int count struct MemberIsAgg { struct Foo agg; }; -// NEW-LABEL: define dso_local i64 @access_MemberIsAgg_member_bidi( +// NEW-LABEL: define i64 @access_MemberIsAgg_member_bidi( // NEW-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -1373,7 +1373,7 @@ struct MemberIsAgg { // NEW-NEXT: [[TMP8:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP8]] // -// LEGACY-LABEL: define dso_local i64 @access_MemberIsAgg_member_bidi( +// LEGACY-LABEL: define i64 @access_MemberIsAgg_member_bidi( // LEGACY-SAME: [2 x i64] noundef [[PTR_COERCE:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 @@ -1426,8 +1426,8 @@ struct Foo access_MemberIsAgg_member_bidi(struct MemberIsAgg* __indexable ptr, i // Access using ptr arithmetic has identical codegen -// NEW-LABEL: define dso_local i64 @access_Foo_bi_ptr_arith( -// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-LABEL: define i64 @access_Foo_bi_ptr_arith( +// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -1481,8 +1481,8 @@ struct Foo access_MemberIsAgg_member_bidi(struct MemberIsAgg* __indexable ptr, i // NEW-NEXT: [[TMP14:%.*]] = load i64, ptr [[RETVAL]], align 4 // NEW-NEXT: ret i64 [[TMP14]] // -// LEGACY-LABEL: define dso_local i64 @access_Foo_bi_ptr_arith( -// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-LABEL: define i64 @access_Foo_bi_ptr_arith( +// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[RETVAL:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4 // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 @@ -1533,8 +1533,8 @@ struct Foo access_Foo_bi_ptr_arith(struct Foo* __bidi_indexable ptr, int idx) { return *(ptr + idx); } -// NEW-LABEL: define dso_local void @compute_addr_with_subscript_Foo_bi( -// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-LABEL: define void @compute_addr_with_subscript_Foo_bi( +// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1560,8 +1560,8 @@ struct Foo access_Foo_bi_ptr_arith(struct Foo* __bidi_indexable ptr, int idx) { // NEW-NEXT: store ptr [[TMP8]], ptr [[TMP9]], align 8 // NEW-NEXT: ret void // -// LEGACY-LABEL: define dso_local void @compute_addr_with_subscript_Foo_bi( -// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-LABEL: define void @compute_addr_with_subscript_Foo_bi( +// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1591,8 +1591,8 @@ void compute_addr_with_subscript_Foo_bi(struct Foo* __bidi_indexable ptr, int id struct Foo* f = &ptr[idx]; } -// NEW-LABEL: define dso_local void @compute_addr_with_ptr_arith_Foo_bi( -// NEW-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// NEW-LABEL: define void @compute_addr_with_ptr_arith_Foo_bi( +// NEW-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // NEW-NEXT: [[ENTRY:.*:]] // NEW-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // NEW-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 @@ -1651,8 +1651,8 @@ void compute_addr_with_subscript_Foo_bi(struct Foo* __bidi_indexable ptr, int id // NEW-NEXT: store ptr [[WIDE_PTR_PTR]], ptr [[TMP17]], align 8 // NEW-NEXT: ret void // -// LEGACY-LABEL: define dso_local void @compute_addr_with_ptr_arith_Foo_bi( -// LEGACY-SAME: ptr noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { +// LEGACY-LABEL: define void @compute_addr_with_ptr_arith_Foo_bi( +// LEGACY-SAME: ptr dead_on_return noundef [[PTR:%.*]], i32 noundef [[IDX:%.*]]) #[[ATTR0]] { // LEGACY-NEXT: [[ENTRY:.*:]] // LEGACY-NEXT: [[PTR_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // LEGACY-NEXT: [[IDX_ADDR:%.*]] = alloca i32, align 4 diff --git a/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c b/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c index 58aaaa1ae958a..587b37ae1c864 100644 --- a/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c +++ b/clang/test/BoundsSafety/CodeGen/flexible-array-member-bidi-O0.c @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 -// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-iphoneos -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-iphoneos -x objective-c -fexperimental-bounds-safety-objc -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O0 -fbounds-safety -triple arm64e-apple-ios -x objective-c -fexperimental-bounds-safety-objc -emit-llvm %s -o - | FileCheck %s #include @@ -13,8 +13,8 @@ struct Simple { // rdar://132731845 the flexible arrays are not bounds checked -// CHECK-LABEL: define dso_local void @simple_no_flexbase_update( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-LABEL: define void @simple_no_flexbase_update( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -47,8 +47,8 @@ void simple_no_flexbase_update(struct Simple * __bidi_indexable p) { p->len = 11; } -// CHECK-LABEL: define dso_local void @simple_flexbase_update( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @simple_flexbase_update( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -84,8 +84,8 @@ void simple_flexbase_update(struct Simple * __bidi_indexable p) { p2->len = 11; } -// CHECK-LABEL: define dso_local void @simple_flexbase_self_assign( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @simple_flexbase_self_assign( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable", align 8 @@ -127,8 +127,8 @@ struct Shared { }; int * __counted_by(len) baz(int len); -// CHECK-LABEL: define dso_local void @shared_no_flexbase_update( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_no_flexbase_update( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -265,8 +265,8 @@ void shared_no_flexbase_update(struct Shared * __bidi_indexable p) { p->ptr = p2; } -// CHECK-LABEL: define dso_local void @shared_no_flexbase_update_reverse( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_no_flexbase_update_reverse( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -400,8 +400,8 @@ void shared_no_flexbase_update_reverse(struct Shared * __bidi_indexable p) { p->len = 11; } -// CHECK-LABEL: define dso_local void @shared_flexbase_update( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_update( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -541,8 +541,8 @@ void shared_flexbase_update(struct Shared * __bidi_indexable p) { p2->len = 11; } -// CHECK-LABEL: define dso_local void @shared_flexbase_update_reverse( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_update_reverse( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P3:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -682,8 +682,8 @@ void shared_flexbase_update_reverse(struct Shared * __bidi_indexable p) { p2->ptr = p3; } -// CHECK-LABEL: define dso_local void @shared_flexbase_self_assign( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_self_assign( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -822,8 +822,8 @@ void shared_flexbase_self_assign(struct Shared * __bidi_indexable p) { p->len = 11; } -// CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_reverse( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_self_assign_reverse( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*]]: // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[P2:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -962,8 +962,8 @@ void shared_flexbase_self_assign_reverse(struct Shared * __bidi_indexable p) { p->ptr = p2; } -// CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_fr( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_self_assign_fr( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -1147,8 +1147,8 @@ void shared_flexbase_self_assign_fr(struct Shared * __bidi_indexable p) { p->len = 11; } -// CHECK-LABEL: define dso_local void @shared_flexbase_self_assign_fr_reverse( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @shared_flexbase_self_assign_fr_reverse( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.1", align 8 @@ -1338,8 +1338,8 @@ struct Double { int fam[__counted_by(len + len2)]; }; -// CHECK-LABEL: define dso_local void @double_no_flexbase_update_once( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @double_no_flexbase_update_once( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8 @@ -1372,8 +1372,8 @@ void double_no_flexbase_update_once(struct Double * __bidi_indexable p) { p->len = 11; } -// CHECK-LABEL: define dso_local void @double_no_flexbase_update_both( -// CHECK-SAME: ptr noundef [[P:%.*]]) #[[ATTR0]] { +// CHECK-LABEL: define void @double_no_flexbase_update_both( +// CHECK-SAME: ptr dead_on_return noundef [[P:%.*]]) #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[P_INDIRECT_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[AGG_TEMP:%.*]] = alloca %"__bounds_safety::wide_ptr.bidi_indexable.2", align 8