summaryrefslogtreecommitdiff
path: root/test/CodeGen/tbaa-for-vptr.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
commit9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch)
tree47df2c12b57214af6c31e47404b005675b8b7ffc /test/CodeGen/tbaa-for-vptr.cpp
parentf73d5f23a889b93d89ddef61ac0995df40286bb8 (diff)
Notes
Diffstat (limited to 'test/CodeGen/tbaa-for-vptr.cpp')
-rw-r--r--test/CodeGen/tbaa-for-vptr.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/CodeGen/tbaa-for-vptr.cpp b/test/CodeGen/tbaa-for-vptr.cpp
index 7ba058bffe66..ded574ea9376 100644
--- a/test/CodeGen/tbaa-for-vptr.cpp
+++ b/test/CodeGen/tbaa-for-vptr.cpp
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -emit-llvm -o - -fsanitize=thread %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -O1 %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -O1 -relaxed-aliasing -fsanitize=thread %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - -fsanitize=thread %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - -O1 %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - -O1 -relaxed-aliasing -fsanitize=thread %s | FileCheck %s
//
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s --check-prefix=NOTBAA
-// RUN: %clang_cc1 -emit-llvm -o - -O2 -relaxed-aliasing %s | FileCheck %s --check-prefix=NOTBAA
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s --check-prefix=NOTBAA
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - -O2 -relaxed-aliasing %s | FileCheck %s --check-prefix=NOTBAA
//
// Check that we generate TBAA for vtable pointer loads and stores.
-// When -fthread-sanitizer is used TBAA should be generated at all opt levels
+// When -fsanitize=thread is used TBAA should be generated at all opt levels
// even if -relaxed-aliasing is present.
struct A {
virtual int foo() const ;
@@ -17,12 +17,19 @@ void CreateA() {
new A;
}
-void CallFoo(A *a) {
+void CallFoo(A *a, int (A::*fp)() const) {
a->foo();
+ (a->*fp)();
}
+// CHECK-LABEL: @_Z7CallFoo
// CHECK: %{{.*}} = load {{.*}} !tbaa ![[NUM:[0-9]+]]
+// CHECK: br i1
+// CHECK: load {{.*}}, !tbaa ![[NUM]]
+//
+// CHECK-LABEL: @_ZN1AC2Ev
// CHECK: store {{.*}} !tbaa ![[NUM]]
+//
// CHECK: [[NUM]] = metadata !{metadata [[TYPE:!.*]], metadata [[TYPE]], i64 0}
// CHECK: [[TYPE]] = metadata !{metadata !"vtable pointer", metadata !{{.*}}
// NOTBAA-NOT: = metadata !{metadata !"Simple C/C++ TBAA"}