From 8183b8ea9f39c8f3f9ea8b24d5c5a56f1eb00ed2 Mon Sep 17 00:00:00 2001
From: Manman Ren <manman.ren@gmail.com>
Date: Wed, 21 Aug 2013 21:00:10 +0000
Subject: [PATCH] TBAA: add testing case to check typedef can alias.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188931 91177308-0d34-0410-b5e6-96231b3b80d8
---
 test/CodeGen/tbaa.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/CodeGen/tbaa.cpp b/test/CodeGen/tbaa.cpp
index e1fc7a79bee..e931930a52e 100644
--- a/test/CodeGen/tbaa.cpp
+++ b/test/CodeGen/tbaa.cpp
@@ -222,6 +222,20 @@ char g14(struct six *a, struct six *b) {
   return a->b;
 }
 
+// Types that differ only by name may alias.
+typedef StructS StructS3;
+uint32_t g15(StructS *S, StructS3 *S3, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_i32]]
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_i32]]
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
+  S->f32 = 1;
+  S3->f32 = 4;
+  return S->f32;
+}
+
 // CHECK: [[TAG_char]] = metadata !{metadata !"omnipotent char", metadata [[TAG_cxx_tbaa:!.*]]}
 // CHECK: [[TAG_cxx_tbaa]] = metadata !{metadata !"Simple C/C++ TBAA"}
 // CHECK: [[TAG_i32]] = metadata !{metadata !"int", metadata [[TAG_char]]}
-- 
GitLab