diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-24 21:21:46 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-24 21:21:46 +0000 |
commit | 8dd14da0dc02c95df4b826c94edd71f5514f1c19 (patch) | |
tree | ee8133d32bb8f37cdd22a10ad586407a072c5805 /clang/test/CodeGen | |
parent | 7efd7506078fb48d0b901d33da38ea538cf2fa6a (diff) | |
download | bcm5719-llvm-8dd14da0dc02c95df4b826c94edd71f5514f1c19.tar.gz bcm5719-llvm-8dd14da0dc02c95df4b826c94edd71f5514f1c19.zip |
CodeGen: Update Clang to use the new type metadata.
Differential Revision: http://reviews.llvm.org/D21054
llvm-svn: 273730
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/cfi-check-fail.c | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/cfi-check-fail2.c | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/cfi-icall-cross-dso.c | 64 | ||||
-rw-r--r-- | clang/test/CodeGen/cfi-icall.c | 18 |
4 files changed, 45 insertions, 41 deletions
diff --git a/clang/test/CodeGen/cfi-check-fail.c b/clang/test/CodeGen/cfi-check-fail.c index 4560cd87471..b850193b54a 100644 --- a/clang/test/CodeGen/cfi-check-fail.c +++ b/clang/test/CodeGen/cfi-check-fail.c @@ -23,7 +23,7 @@ void caller(void (*f)()) { // CHECK: %[[A:.*]] = bitcast i8* %[[DATA]] to { i8, { i8*, i32, i32 }, i8* }* // CHECK: %[[KINDPTR:.*]] = getelementptr {{.*}} %[[A]], i32 0, i32 0 // CHECK: %[[KIND:.*]] = load i8, i8* %[[KINDPTR]], align 4 -// CHECK: %[[VTVALID0:.*]] = call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata !"all-vtables") +// CHECK: %[[VTVALID0:.*]] = call i1 @llvm.type.test(i8* %[[ADDR]], metadata !"all-vtables") // CHECK: %[[VTVALID:.*]] = zext i1 %[[VTVALID0]] to i64 // CHECK: %[[NOT_0:.*]] = icmp ne i8 %[[KIND]], 0 // CHECK: br i1 %[[NOT_0]], label %[[CONT1:.*]], label %[[HANDLE0:.*]], !prof diff --git a/clang/test/CodeGen/cfi-check-fail2.c b/clang/test/CodeGen/cfi-check-fail2.c index 02ceb930e61..5340871c2eb 100644 --- a/clang/test/CodeGen/cfi-check-fail2.c +++ b/clang/test/CodeGen/cfi-check-fail2.c @@ -23,7 +23,7 @@ void caller(void (*f)()) { // CHECK: %[[A:.*]] = bitcast i8* %[[DATA]] to { i8, { i8*, i32, i32 }, i8* }* // CHECK: %[[KINDPTR:.*]] = getelementptr {{.*}} %[[A]], i32 0, i32 0 // CHECK: %[[KIND:.*]] = load i8, i8* %[[KINDPTR]], align 4 -// CHECK: %[[VTVALID0:.*]] = call i1 @llvm.bitset.test(i8* %[[ADDR]], metadata !"all-vtables") +// CHECK: %[[VTVALID0:.*]] = call i1 @llvm.type.test(i8* %[[ADDR]], metadata !"all-vtables") // CHECK: %[[VTVALID:.*]] = zext i1 %[[VTVALID0]] to i64 // CHECK: %[[NOT_0:.*]] = icmp ne i8 %[[KIND]], 0 // CHECK: br i1 %[[NOT_0]], label %[[CONT1:.*]], label %[[HANDLE0:.*]], !prof diff --git a/clang/test/CodeGen/cfi-icall-cross-dso.c b/clang/test/CodeGen/cfi-icall-cross-dso.c index 13cff1065fd..636a9e4aedb 100644 --- a/clang/test/CodeGen/cfi-icall-cross-dso.c +++ b/clang/test/CodeGen/cfi-icall-cross-dso.c @@ -26,11 +26,30 @@ // RUN: --check-prefix=MS --check-prefix=MS-TRAP \ // RUN: %s +// CHECK-DIAG: @[[SRC:.*]] = private unnamed_addr constant {{.*}}cfi-icall-cross-dso.c\00 +// CHECK-DIAG: @[[TYPE:.*]] = private unnamed_addr constant { i16, i16, [{{.*}} x i8] } { i16 -1, i16 0, [{{.*}} x i8] c"'void ()'\00" +// CHECK-DIAG: @[[DATA:.*]] = private unnamed_addr global {{.*}}@[[SRC]]{{.*}}@[[TYPE]] + + +// ITANIUM: call i1 @llvm.type.test(i8* %{{.*}}, metadata !"_ZTSFvE"), !nosanitize +// ITANIUM-DIAG: call void @__cfi_slowpath_diag(i64 6588678392271548388, i8* %{{.*}}, {{.*}}@[[DATA]]{{.*}}) {{.*}}, !nosanitize +// ITANIUM-TRAP: call void @__cfi_slowpath(i64 6588678392271548388, i8* %{{.*}}) {{.*}}, !nosanitize + +// MS: call i1 @llvm.type.test(i8* %{{.*}}, metadata !"?6AX@Z"), !nosanitize +// MS-DIAG: call void @__cfi_slowpath_diag(i64 4195979634929632483, i8* %{{.*}}, {{.*}}@[[DATA]]{{.*}}) {{.*}}, !nosanitize +// MS-TRAP: call void @__cfi_slowpath(i64 4195979634929632483, i8* %{{.*}}) {{.*}}, !nosanitize + void caller(void (*f)()) { f(); } +// Check that we emit both string and hash based type entries for static void g(), +// and don't emit them for the declaration of h(). + +// CHECK: define internal void @g({{.*}} !type [[TVOID:![0-9]+]] !type [[TVOID_ID:![0-9]+]] static void g(void) {} + +// CHECK: declare void @h({{[^!]*$}} void h(void); typedef void (*Fn)(void); @@ -41,41 +60,22 @@ Fn h1() { return &h; } +// CHECK: define void @bar({{.*}} !type [[TNOPROTO:![0-9]+]] !type [[TNOPROTO_ID:![0-9]+]] +// ITANIUM: define available_externally void @foo({{[^!]*$}} +// MS: define linkonce_odr void @foo({{.*}} !type [[TNOPROTO]] !type [[TNOPROTO_ID]] inline void foo() {} void bar() { foo(); } -// CHECK-DIAG: @[[SRC:.*]] = private unnamed_addr constant {{.*}}cfi-icall-cross-dso.c\00 -// CHECK-DIAG: @[[TYPE:.*]] = private unnamed_addr constant { i16, i16, [{{.*}} x i8] } { i16 -1, i16 0, [{{.*}} x i8] c"'void ()'\00" -// CHECK-DIAG: @[[DATA:.*]] = private unnamed_addr global {{.*}}@[[SRC]]{{.*}}@[[TYPE]] - - -// ITANIUM: call i1 @llvm.bitset.test(i8* %{{.*}}, metadata !"_ZTSFvE"), !nosanitize -// ITANIUM-DIAG: call void @__cfi_slowpath_diag(i64 6588678392271548388, i8* %{{.*}}, {{.*}}@[[DATA]]{{.*}}) {{.*}}, !nosanitize -// ITANIUM-TRAP: call void @__cfi_slowpath(i64 6588678392271548388, i8* %{{.*}}) {{.*}}, !nosanitize - -// MS: call i1 @llvm.bitset.test(i8* %{{.*}}, metadata !"?6AX@Z"), !nosanitize -// MS-DIAG: call void @__cfi_slowpath_diag(i64 4195979634929632483, i8* %{{.*}}, {{.*}}@[[DATA]]{{.*}}) {{.*}}, !nosanitize -// MS-TRAP: call void @__cfi_slowpath(i64 4195979634929632483, i8* %{{.*}}) {{.*}}, !nosanitize - -// ITANIUM: define available_externally void @foo() -// MS: define linkonce_odr void @foo() - -// Check that we emit both string and hash based bit set entries for static void g(), -// and don't emit them for the declaration of h(). - -// CHECK-NOT: !{!"{{.*}}", void ()* @h, i64 0} -// CHECK: !{!"{{.*}}", void ()* @g, i64 0} -// CHECK-NOT: !{!"{{.*}}", void ()* @h, i64 0} -// CHECK: !{i64 {{.*}}, void ()* @g, i64 0} -// CHECK-NOT: !{!"{{.*}}", void ()* @h, i64 0} +// CHECK: !{i32 4, !"Cross-DSO CFI", i32 1} -// ITANIUM-NOT: !{!{{.*}}, void ()* @foo, -// ITANIUM: !{!"_ZTSFvE", void ()* @bar, i64 0} -// ITANIUM-NOT: !{!{{.*}}, void ()* @foo, -// ITANIUM: !{i64 6588678392271548388, void ()* @bar, i64 0} -// ITANIUM-NOT: !{!{{.*}}, void ()* @foo, +// Check that the type entries are correct. -// MS: !{!"?6AX@Z", void ()* @foo, i64 0} -// MS: !{i64 4195979634929632483, void ()* @foo, i64 0} +// ITANIUM: [[TVOID]] = !{i64 0, !"_ZTSFvvE"} +// ITANIUM: [[TVOID_ID]] = !{i64 0, i64 9080559750644022485} +// ITANIUM: [[TNOPROTO]] = !{i64 0, !"_ZTSFvE"} +// ITANIUM: [[TNOPROTO_ID]] = !{i64 0, i64 6588678392271548388} -// CHECK: !{i32 4, !"Cross-DSO CFI", i32 1} +// MS: [[TVOID]] = !{i64 0, !"?6AXXZ"} +// MS: [[TVOID_ID]] = !{i64 0, i64 5113650790573562461} +// MS: [[TNOPROTO]] = !{i64 0, !"?6AX@Z"} +// MS: [[TNOPROTO_ID]] = !{i64 0, i64 4195979634929632483} diff --git a/clang/test/CodeGen/cfi-icall.c b/clang/test/CodeGen/cfi-icall.c index d6cebef49a1..ed34f4f44be 100644 --- a/clang/test/CodeGen/cfi-icall.c +++ b/clang/test/CodeGen/cfi-icall.c @@ -1,20 +1,24 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=ITANIUM %s -// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=MS %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s // Tests that we assign appropriate identifiers to unprototyped functions. +// CHECK: define void @f({{.*}} !type [[TVOID:![0-9]+]] void f() { } void xf(); +// CHECK: define void @g({{.*}} !type [[TINT:![0-9]+]] void g(int b) { void (*fp)() = b ? f : xf; - // ITANIUM: call i1 @llvm.bitset.test(i8* {{.*}}, metadata !"_ZTSFvE") + // ITANIUM: call i1 @llvm.type.test(i8* {{.*}}, metadata !"_ZTSFvE") fp(); } -// ITANIUM-DAG: !{!"_ZTSFvE", void ()* @f, i64 0} -// ITANIUM-DAG: !{!"_ZTSFvE", void (...)* @xf, i64 0} -// MS-DAG: !{!"?6AX@Z", void ()* @f, i64 0} -// MS-DAG: !{!"?6AX@Z", void (...)* @xf, i64 0} +// CHECK: declare !type [[TVOID:![0-9]+]] void @xf({{.*}} + +// ITANIUM-DAG: [[TVOID]] = !{i64 0, !"_ZTSFvE"} +// ITANIUM-DAG: [[TINT]] = !{i64 0, !"_ZTSFviE"} +// MS-DAG: [[TVOID]] = !{i64 0, !"?6AX@Z"} +// MS-DAG: [[TINT]] = !{i64 0, !"?6AXH@Z"} |