blob: 2b9e310866640583761ec13fd17d3aeceb4d0353 [file] [log] [blame]
Ivan A. Kosareved141ba2017-10-17 09:12:13 +00001// 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
7struct V {
8 unsigned n;
9};
10
11struct S {
12 char bytes[4];
13};
14
15void 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}