Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / tbaa-cast.cpp
blobfee2f30bccc18b0e403ce3dce3eb3b9a88114ff5
1 // RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s \
2 // RUN: -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,OLD-PATH
3 // RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s \
4 // RUN: -emit-llvm -new-struct-path-tbaa -o - | FileCheck %s -check-prefixes=CHECK,NEW-PATH
5 //
6 // Check that we generate correct TBAA information for lvalues constructed
7 // with use of casts.
9 struct V {
10 unsigned n;
13 struct S {
14 char bytes[4];
17 void foo(S *p) {
18 // CHECK-LABEL: _Z3fooP1S
19 // CHECK: store i32 5, {{.*}}, !tbaa [[TAG_V_n:!.*]]
20 ((V*)p->bytes)->n = 5;
23 // OLD-PATH-DAG: [[TAG_V_n]] = !{[[TYPE_V:!.*]], [[TYPE_int:!.*]], i64 0}
24 // OLD-PATH-DAG: [[TYPE_V]] = !{!"_ZTS1V", !{{.*}}, i64 0}
25 // OLD-PATH-DAG: [[TYPE_int]] = !{!"int", !{{.*}}, i64 0}
26 // NEW-PATH-DAG: [[TAG_V_n]] = !{[[TYPE_V:!.*]], [[TYPE_int:!.*]], i64 0, i64 4}
27 // NEW-PATH-DAG: [[TYPE_V]] = !{[[TYPE_char:!.*]], i64 4, !"_ZTS1V", [[TYPE_int]], i64 0, i64 4}
28 // NEW-PATH-DAG: [[TYPE_int]] = !{[[TYPE_char]], i64 4, !"int"}