Jeff Vander Stoep | 247d86b | 2020-08-11 14:27:44 +0200 | [diff] [blame] | 1 | // RUN: %clang -target x86_64 -emit-llvm -S -g %s -o - | FileCheck %s |
| 2 | |
| 3 | #define _(x) (__builtin_preserve_access_index(x)) |
| 4 | |
| 5 | struct s1 { |
| 6 | char a; |
| 7 | int b[4]; |
| 8 | }; |
| 9 | |
| 10 | int unit1(struct s1 *arg) { |
| 11 | return _(arg->b[2]); |
| 12 | } |
| 13 | // CHECK: define dso_local i32 @unit1 |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame^] | 14 | // CHECK: call [4 x i32]* @llvm.preserve.struct.access.index.p0a4i32.p0s_struct.s1s(%struct.s1* elementtype(%struct.s1) %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]] |
| 15 | // CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* elementtype([4 x i32]) %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ARRAY:[0-9]+]] |
Jeff Vander Stoep | 247d86b | 2020-08-11 14:27:44 +0200 | [diff] [blame] | 16 | // |
| 17 | // CHECK: ![[ARRAY]] = !DICompositeType(tag: DW_TAG_array_type |
| 18 | // CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1" |