Ivan A. Kosarev | ed141ba | 2017-10-17 09:12:13 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s \ |
| 2 | // RUN: -emit-llvm -o - | FileCheck %s |
| 3 | // |
| 4 | // Check that we generate correct TBAA information for lvalues constructed |
| 5 | // with use of casts. |
| 6 | |
| 7 | struct V { |
| 8 | unsigned n; |
| 9 | }; |
| 10 | |
| 11 | struct S { |
| 12 | char bytes[4]; |
| 13 | }; |
| 14 | |
| 15 | void foo(S *p) { |
| 16 | // CHECK-LABEL: _Z3fooP1S |
| 17 | // CHECK: store i32 5, {{.*}}, !tbaa [[TAG_V_n:!.*]] |
| 18 | ((V*)p->bytes)->n = 5; |
| 19 | } |
| 20 | |
| 21 | // CHECK-DAG: [[TAG_V_n]] = !{[[TYPE_V:!.*]], [[TYPE_int:!.*]], i64 0} |
| 22 | // CHECK-DAG: [[TYPE_V]] = !{!"_ZTS1V", !{{.*}}, i64 0} |
| 23 | // CHECK-DAG: [[TYPE_int]] = !{!"int", !{{.*}}, i64 0} |