diff options
author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-20 12:35:17 +0000 |
---|---|---|
committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-20 12:35:17 +0000 |
commit | f761d0e514c593c49f9dde7eebd293e97b80b8b4 (patch) | |
tree | 6be84a0897b41a4c5b379e729db6e02cdbae106b /clang/test/CodeGen/tbaa-array.cpp | |
parent | 3d34d877cb9e682d321dd818d90178da68054ba6 (diff) | |
download | bcm5719-llvm-f761d0e514c593c49f9dde7eebd293e97b80b8b4.tar.gz bcm5719-llvm-f761d0e514c593c49f9dde7eebd293e97b80b8b4.zip |
[CodeGen] Fix generation of TBAA info for array-to-pointer conversions
Resolves:
Fatal error: Offset not zero at the point of scalar access.
http://llvm.org/PR34992
Differential Revision: https://reviews.llvm.org/D39083
llvm-svn: 316211
Diffstat (limited to 'clang/test/CodeGen/tbaa-array.cpp')
-rw-r--r-- | clang/test/CodeGen/tbaa-array.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CodeGen/tbaa-array.cpp b/clang/test/CodeGen/tbaa-array.cpp new file mode 100644 index 00000000000..86ca5ccb40d --- /dev/null +++ b/clang/test/CodeGen/tbaa-array.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s \ +// RUN: -emit-llvm -o - | FileCheck %s +// +// Check that we generate correct TBAA information for accesses to array +// elements. + +struct A { int i; }; +struct B { A a[1]; }; + +int foo(B *b) { +// CHECK-LABEL: _Z3fooP1B +// CHECK: load i32, {{.*}}, !tbaa [[TAG_A_i:!.*]] + return b->a->i; +} + +// CHECK-DAG: [[TAG_A_i]] = !{[[TYPE_A:!.*]], [[TYPE_int:!.*]], i64 0} +// CHECK-DAG: [[TYPE_A]] = !{!"_ZTS1A", !{{.*}}, i64 0} +// CHECK-DAG: [[TYPE_int]] = !{!"int", !{{.*}}, i64 0} |