diff --git a/clang/test/BoundsSafety/CodeGen/constant-forge-ptr-expr.c b/clang/test/BoundsSafety/CodeGen/constant-forge-ptr-expr.c index 8f8732c2315ae..2a84cf1fa9e21 100644 --- a/clang/test/BoundsSafety/CodeGen/constant-forge-ptr-expr.c +++ b/clang/test/BoundsSafety/CodeGen/constant-forge-ptr-expr.c @@ -52,13 +52,13 @@ int *__bidi_indexable ptrBidiIndexable2 = __unsafe_forge_single(int *, &arr[0]); int *__bidi_indexable ptrBidiIndexable3 = __unsafe_forge_single(int *, 0x1234); // CHECKBS-LABEL: ptrBidiIndexable3: // CHECKBS: .quad 4660 -// CHECKBS: .quad 4664 +// CHECKBS: .quad 4660+4 // CHECKBS: .quad 4660 int *__bidi_indexable ptrBidiIndexable4 = __unsafe_forge_bidi_indexable(int *, 8000, 16); // CHECKBS-LABEL: ptrBidiIndexable4: // CHECKBS: .quad 8000 -// CHECKBS: .quad 8016 +// CHECKBS: .quad 8000+16 // CHECKBS: .quad 8000 // (4 * 80) + 8 + 4 * 9 = 364 diff --git a/clang/test/BoundsSafety/CodeGen/init-global-unsafe-forge-const.c b/clang/test/BoundsSafety/CodeGen/init-global-unsafe-forge-const.c index b8af774744818..e063513d9499f 100644 --- a/clang/test/BoundsSafety/CodeGen/init-global-unsafe-forge-const.c +++ b/clang/test/BoundsSafety/CodeGen/init-global-unsafe-forge-const.c @@ -1,5 +1,3 @@ - - // RUN: %clang_cc1 -triple arm64-apple-iphoneos -O0 -fbounds-safety -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -triple arm64-apple-iphoneos -O0 -fbounds-safety -x objective-c -fexperimental-bounds-safety-objc -emit-llvm %s -o - | FileCheck %s @@ -14,5 +12,5 @@ struct s *__bidi_indexable g4 = __unsafe_forge_bidi_indexable(void *, 4, sizeof( // CHECK: @g1 = global ptr inttoptr (i64 1 to ptr), align 8 // CHECK: @g2 = global ptr inttoptr (i64 2 to ptr), align 8 -// CHECK: @g3 = global %"__bounds_safety::wide_ptr.bidi_indexable" { ptr inttoptr (i64 3 to ptr), ptr inttoptr (i64 13 to ptr), ptr inttoptr (i64 3 to ptr) }, align 8 -// CHECK: @g4 = global %"__bounds_safety::wide_ptr.bidi_indexable{{.*}}" { ptr inttoptr (i64 4 to ptr), ptr inttoptr (i64 52 to ptr), ptr inttoptr (i64 4 to ptr) }, align 8 +// CHECK: @g3 = global %"__bounds_safety::wide_ptr.bidi_indexable" { ptr inttoptr (i64 3 to ptr), ptr inttoptr (i64 add (i64 ptrtoint (ptr inttoptr (i64 3 to ptr) to i64), i64 10) to ptr), ptr inttoptr (i64 3 to ptr) }, align 8 +// CHECK: @g4 = global %"__bounds_safety::wide_ptr.bidi_indexable{{.*}}" { ptr inttoptr (i64 4 to ptr), ptr inttoptr (i64 add (i64 ptrtoint (ptr inttoptr (i64 4 to ptr) to i64), i64 48) to ptr), ptr inttoptr (i64 4 to ptr) }, align 8 diff --git a/clang/test/BoundsSafety/CodeGen/unsafe_forge_constant_base.c b/clang/test/BoundsSafety/CodeGen/unsafe_forge_constant_base.c index c3173d3a3d3bd..0ed5762e2111b 100644 --- a/clang/test/BoundsSafety/CodeGen/unsafe_forge_constant_base.c +++ b/clang/test/BoundsSafety/CodeGen/unsafe_forge_constant_base.c @@ -8,7 +8,7 @@ void f1(void *__sized_by(size) ptr, unsigned size); //. // X86_64: @static_single.p_compile_time_constant_single = internal constant ptr inttoptr (i64 123400004321 to ptr), align 8 -// X86_64: @static_bidi.p_compile_time_constant_bidi = internal constant %"__bounds_safety::wide_ptr.bidi_indexable.1" { ptr inttoptr (i64 12300321 to ptr), ptr inttoptr (i64 12300333 to ptr), ptr inttoptr (i64 12300321 to ptr) }, align 8 +// X86_64: @static_bidi.p_compile_time_constant_bidi = internal constant %"__bounds_safety::wide_ptr.bidi_indexable.1" { ptr inttoptr (i64 12300321 to ptr), ptr inttoptr (i64 add (i64 ptrtoint (ptr inttoptr (i64 12300321 to ptr) to i64), i64 12) to ptr), ptr inttoptr (i64 12300321 to ptr) }, align 8 //. // X86_64-LABEL: define dso_local void @f2( // X86_64-SAME: ) #[[ATTR0:[0-9]+]] { diff --git a/clang/test/BoundsSafety/CodeGen/wide-ptr-init-with-incomplete-array.c b/clang/test/BoundsSafety/CodeGen/wide-ptr-init-with-incomplete-array.c index da68f55e98d13..3e2448e48a1c0 100644 --- a/clang/test/BoundsSafety/CodeGen/wide-ptr-init-with-incomplete-array.c +++ b/clang/test/BoundsSafety/CodeGen/wide-ptr-init-with-incomplete-array.c @@ -1,14 +1,13 @@ - - // RUN: %clang_cc1 -triple x86_64 -O0 -fbounds-safety -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -triple x86_64 -O0 -fbounds-safety -x objective-c -fexperimental-bounds-safety-objc -emit-llvm %s -o - | FileCheck %s + #include extern float foo[]; // CHECK: @foo = external global [0 x float] float *__indexable wide_f[] = {foo}; -// CHECK: @wide_f = global [1 x %"__bounds_safety::wide_ptr.indexable"] [%"__bounds_safety::wide_ptr.indexable" { ptr @foo, ptr @foo }] +// CHECK: @wide_f = global [1 x %"__bounds_safety::wide_ptr.indexable"] [%"__bounds_safety::wide_ptr.indexable" { ptr @foo, ptr inttoptr (i64 ptrtoint (ptr @foo to i64) to ptr) }] extern float bar[]; float bar[] = {1, 2, 3, 4}; @@ -18,7 +17,7 @@ float *__indexable wide_f2[] = {bar}; // CHECK: @wide_f2 = global [1 x %"__bounds_safety::wide_ptr.indexable"] [%"__bounds_safety::wide_ptr.indexable" { ptr @bar, ptr inttoptr (i64 add (i64 ptrtoint (ptr @bar to i64), i64 16) to ptr) }] float *__bidi_indexable wide_f3[] = {foo, bar}; -// CHECK: @wide_f3 = global [2 x %"__bounds_safety::wide_ptr.bidi_indexable"] [%"__bounds_safety::wide_ptr.bidi_indexable" { ptr @foo, ptr @foo, ptr @foo }, %"__bounds_safety::wide_ptr.bidi_indexable" { ptr @bar, ptr inttoptr (i64 add (i64 ptrtoint (ptr @bar to i64), i64 16) to ptr), ptr @bar }] +// CHECK: @wide_f3 = global [2 x %"__bounds_safety::wide_ptr.bidi_indexable"] [%"__bounds_safety::wide_ptr.bidi_indexable" { ptr @foo, ptr inttoptr (i64 ptrtoint (ptr @foo to i64) to ptr), ptr @foo }, %"__bounds_safety::wide_ptr.bidi_indexable" { ptr @bar, ptr inttoptr (i64 add (i64 ptrtoint (ptr @bar to i64), i64 16) to ptr), ptr @bar }] // CHECK-NOT: @foo // CHECK-NOT: @wide_f