[Object] Convert tests to opaque pointers (NFC)

Link: https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322
This commit is contained in:
Fangrui Song 2024-03-07 16:37:41 -08:00
parent fe84764724
commit 99512b1728
8 changed files with 25 additions and 25 deletions

View File

@ -4,15 +4,15 @@ target triple = "i386-pc-windows"
define i32 @main() nounwind {
entry:
%call = tail call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)) nounwind
tail call void bitcast (void (...)* @SomeOtherFunction to void ()*)() nounwind
%call = tail call i32 @puts(ptr @.str) nounwind
tail call void @SomeOtherFunction() nounwind
ret i32 0
}
declare i32 @puts(i8* nocapture) nounwind
declare i32 @puts(ptr nocapture) nounwind
declare void @SomeOtherFunction(...)
@var = global i32 0
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @var to i8*)], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* null, i8* null }]
@llvm.used = appending global [1 x ptr] [ptr @var], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr null, ptr null }]

View File

@ -5,15 +5,15 @@
define i32 @main() nounwind {
entry:
%call = tail call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)) nounwind
tail call void bitcast (void (...)* @SomeOtherFunction to void ()*)() nounwind
%call = tail call i32 @puts(ptr @.str) nounwind
tail call void @SomeOtherFunction() nounwind
ret i32 0
}
declare i32 @puts(i8* nocapture) nounwind
declare i32 @puts(ptr nocapture) nounwind
declare void @SomeOtherFunction(...)
@var = global i32 0
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @var to i8*)], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* null, i8* null }]
@llvm.used = appending global [1 x ptr] [ptr @var], section "llvm.metadata"
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr null, ptr null }]

View File

@ -11,5 +11,5 @@ target triple = "x86_64-unknown-linux-gnu"
@g1 = global i32 1
@g2 = global i32 2
@a = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
i32 ptrtoint (i32* @g2 to i32)) to i32*)
@a = alias i32, inttoptr(i32 sub (i32 ptrtoint (ptr @g1 to i32),
i32 ptrtoint (ptr @g2 to i32)) to ptr)

View File

@ -29,15 +29,15 @@ module asm ".long undef_asm_sym"
@g3 = common global i32 0
@g4 = private global i32 42
@a1 = alias i32, i32* @g1
@a2 = internal alias i32, i32* @g1
@a1 = alias i32, ptr @g1
@a2 = internal alias i32, ptr @g1
define void ()* @f1() {
define ptr @f1() {
call void @f5()
ret void ()* null
ret ptr null
}
@ifunc_f1 = ifunc void (), void ()* ()* @f1
@ifunc_f1 = ifunc void (), ptr @f1
define internal void @f2() {
ret void

View File

@ -11,4 +11,4 @@ target triple = "x86_64-pc-windows-msvc"
; CHECK: U f
declare dllimport void @f()
@fp = constant void ()* @f
@fp = constant ptr @f

View File

@ -12,6 +12,6 @@ declare dllimport void @f()
define void @g() {
call void @f()
store i32 42, i32* @v
store i32 42, ptr @v
ret void
}

View File

@ -7,8 +7,8 @@ target datalayout = "m:o"
; CHECK-NOT: memcpy
define void @f() {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* null, i8* null, i64 0, i1 false)
tail call void @llvm.memcpy.p0.p0.i64(ptr null, ptr null, i64 0, i1 false)
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)

View File

@ -5,11 +5,11 @@
target triple = "x86_64-apple-macosx10.15.0"
@llvm.used = appending global [1 x i8*] [i8* bitcast (i16* @__swift_reflection_version to i8*)], section "llvm.metadata", align 8
@llvm.used = appending global [1 x ptr] [ptr @__swift_reflection_version], section "llvm.metadata", align 8
@__swift_reflection_version = linkonce_odr hidden constant i16 3
define i32 @main(i32 %0, i8** %1) #0 {
%3 = bitcast i8** %1 to i8*
define i32 @main(i32 %0, ptr %1) #0 {
%3 = bitcast ptr %1 to ptr
ret i32 0
}
@ -25,7 +25,7 @@ attributes #0 = { "frame-pointer"="all" "target-cpu"="penryn" "target-features"=
!1 = !{!"-lswiftSwiftOnoneSupport"}
!2 = !{!"-lswiftCore"}
!3 = !{!"-lobjc"}
!4 = !{[1 x i8*]* @llvm.used, null, null, i1 false, i1 true}
!4 = !{ptr @llvm.used, null, null, i1 false, i1 true}
!5 = !{i32 2, !"SDK Version", [2 x i32] [i32 10, i32 15]}
!6 = !{i32 1, !"Objective-C Version", i32 2}
!7 = !{i32 1, !"Objective-C Image Info Version", i32 0}