2014-01-15 03:35:09 +08:00
|
|
|
// 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
|
2012-04-24 14:57:01 +08:00
|
|
|
//
|
2014-01-15 03:35:09 +08:00
|
|
|
// 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
|
2012-04-24 14:57:01 +08:00
|
|
|
//
|
2012-03-27 01:03:51 +08:00
|
|
|
// Check that we generate TBAA for vtable pointer loads and stores.
|
2014-03-20 18:48:29 +08:00
|
|
|
// When -fsanitize=thread is used TBAA should be generated at all opt levels
|
2012-04-24 14:57:01 +08:00
|
|
|
// even if -relaxed-aliasing is present.
|
2012-03-27 01:03:51 +08:00
|
|
|
struct A {
|
|
|
|
virtual int foo() const ;
|
|
|
|
virtual ~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
void CreateA() {
|
|
|
|
new A;
|
|
|
|
}
|
|
|
|
|
2014-03-13 02:26:14 +08:00
|
|
|
void CallFoo(A *a, int (A::*fp)() const) {
|
2012-03-27 01:03:51 +08:00
|
|
|
a->foo();
|
2014-03-13 02:26:14 +08:00
|
|
|
(a->*fp)();
|
2012-03-27 01:03:51 +08:00
|
|
|
}
|
|
|
|
|
2014-03-13 02:26:14 +08:00
|
|
|
// CHECK-LABEL: @_Z7CallFoo
|
2012-10-01 16:39:00 +08:00
|
|
|
// CHECK: %{{.*}} = load {{.*}} !tbaa ![[NUM:[0-9]+]]
|
2014-03-13 02:26:14 +08:00
|
|
|
// CHECK: br i1
|
|
|
|
// CHECK: load {{.*}}, !tbaa ![[NUM]]
|
|
|
|
//
|
|
|
|
// CHECK-LABEL: @_ZN1AC2Ev
|
2012-10-01 16:39:00 +08:00
|
|
|
// CHECK: store {{.*}} !tbaa ![[NUM]]
|
2014-03-13 02:26:14 +08:00
|
|
|
//
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[NUM]] = !{[[TYPE:!.*]], [[TYPE]], i64 0}
|
|
|
|
// CHECK: [[TYPE]] = !{!"vtable pointer", !{{.*}}
|
|
|
|
// NOTBAA-NOT: = !{!"Simple C/C++ TBAA"}
|