mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-28 15:43:21 +00:00
Make CFI tests opaque pointers compatible
This commit is contained in:
parent
e6f0e358d6
commit
1433b2979b
@ -8,11 +8,10 @@
|
||||
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}}
|
||||
// CHECK: start:
|
||||
// CHECK-NEXT: %0 = bitcast i32 (i32)* %f to i8*
|
||||
// CHECK-NEXT: %1 = call i1 @llvm.type.test(i8* %0, metadata !"{{[[:print:]]+}}")
|
||||
// CHECK-NEXT: br i1 %1, label %type_test.pass, label %type_test.fail
|
||||
// CHECK: [[TT:%.+]] = call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"{{[[:print:]]+}}")
|
||||
// CHECK-NEXT: br i1 [[TT]], label %type_test.pass, label %type_test.fail
|
||||
// CHECK: type_test.pass:
|
||||
// CHECK-NEXT: %2 = call i32 %f(i32 %arg)
|
||||
// CHECK-NEXT: {{%.+}} = call i32 %f(i32 %arg)
|
||||
// CHECK-NEXT: br label %bb1
|
||||
// CHECK: type_test.fail:
|
||||
// CHECK-NEXT: call void @llvm.trap()
|
||||
|
@ -8,21 +8,21 @@
|
||||
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}foo
|
||||
// CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]]
|
||||
// CHECK: %1 = call i1 @llvm.type.test(i8* %0, metadata !"_ZTSFu3i32S_E")
|
||||
// CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_E")
|
||||
f(arg)
|
||||
}
|
||||
|
||||
pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}bar
|
||||
// CHECK-SAME: {{.*}}!type ![[TYPE2:[0-9]+]]
|
||||
// CHECK: %1 = call i1 @llvm.type.test(i8* %0, metadata !"_ZTSFu3i32S_S_E")
|
||||
// CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E")
|
||||
f(arg1, arg2)
|
||||
}
|
||||
|
||||
pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 {
|
||||
// CHECK-LABEL: define{{.*}}baz
|
||||
// CHECK-SAME: {{.*}}!type ![[TYPE3:[0-9]+]]
|
||||
// CHECK: %1 = call i1 @llvm.type.test(i8* %0, metadata !"_ZTSFu3i32S_S_S_E")
|
||||
// CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E")
|
||||
f(arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user