[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / bpf-preserve-access-index.c
blob60082e6bb0036c7acff13775a88dad95da153025
1 // RUN: %clang %s -target bpfeb -x c -emit-llvm -S -g -O2 -Xclang -disable-llvm-passes -o - | FileCheck --check-prefix=CHECK %s
2 // RUN: %clang %s -target bpfel -x c -emit-llvm -S -g -O2 -Xclang -disable-llvm-passes -o - | FileCheck --check-prefix=CHECK %s
4 struct t {
5 int i:1;
6 int j:2;
7 union {
8 int a;
9 int b;
10 } c[4];
13 #define _(x) (__builtin_preserve_access_index(x))
15 const void *test(struct t *arg) {
16 return _(&arg->c[3].b);
19 // CHECK: llvm.preserve.struct.access.index
20 // CHECK: llvm.preserve.array.access.index
21 // CHECK: llvm.preserve.union.access.index
22 // CHECK-NOT: __builtin_preserve_access_index