[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / builtin-preserve-access-index-array.c
blob3ac5409f924fb937304f5ac2ed5d41045fe2a4ba
1 // RUN: %clang_cc1 -triple x86_64 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
3 #define _(x) (__builtin_preserve_access_index(x))
5 struct s1 {
6 char a;
7 int b[4];
8 };
10 const void *unit1(struct s1 *arg) {
11 return _(&arg->b[2]);
13 // CHECK: define dso_local ptr @unit1
14 // CHECK: call ptr @llvm.preserve.struct.access.index.p0.p0(ptr elementtype(%struct.s1) %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]]
15 // CHECK: call ptr @llvm.preserve.array.access.index.p0.p0(ptr elementtype([4 x i32]) %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ARRAY:[0-9]+]]
17 // CHECK: ![[ARRAY]] = !DICompositeType(tag: DW_TAG_array_type
18 // CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1"