[llvm] 99512b1 - [Object] Convert tests to opaque pointers (NFC)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 16:37:46 PST 2024


Author: Fangrui Song
Date: 2024-03-07T16:37:41-08:00
New Revision: 99512b1728bcf47dbf28f8a4cf5d296109fb0630

URL: https://github.com/llvm/llvm-project/commit/99512b1728bcf47dbf28f8a4cf5d296109fb0630
DIFF: https://github.com/llvm/llvm-project/commit/99512b1728bcf47dbf28f8a4cf5d296109fb0630.diff

LOG: [Object] Convert tests to opaque pointers (NFC)

Link: https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322

Added: 
    

Modified: 
    llvm/test/Object/Inputs/small.ll
    llvm/test/Object/Inputs/trivial.ll
    llvm/test/Object/X86/irsymtab-bad-alias.ll
    llvm/test/Object/X86/nm-ir.ll
    llvm/test/Object/dllimport-globalref.ll
    llvm/test/Object/dllimport.ll
    llvm/test/Object/mangle-ir.ll
    llvm/test/Object/objc-swift-mixed-imageinfo-macho.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Object/Inputs/small.ll b/llvm/test/Object/Inputs/small.ll
index ef68a8c324a32f..677f20ade4c5bf 100644
--- a/llvm/test/Object/Inputs/small.ll
+++ b/llvm/test/Object/Inputs/small.ll
@@ -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
- at llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @var to i8*)], section "llvm.metadata"
- at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* null, i8* null }]
+ at llvm.used = appending global [1 x ptr] [ptr @var], section "llvm.metadata"
+ at llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr null, ptr null }]

diff  --git a/llvm/test/Object/Inputs/trivial.ll b/llvm/test/Object/Inputs/trivial.ll
index 82eabc6389fb84..1a6a76298b23ee 100644
--- a/llvm/test/Object/Inputs/trivial.ll
+++ b/llvm/test/Object/Inputs/trivial.ll
@@ -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
- at llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @var to i8*)], section "llvm.metadata"
- at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* null, i8* null }]
+ at llvm.used = appending global [1 x ptr] [ptr @var], section "llvm.metadata"
+ at llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr null, ptr null }]

diff  --git a/llvm/test/Object/X86/irsymtab-bad-alias.ll b/llvm/test/Object/X86/irsymtab-bad-alias.ll
index c54436d5921929..7f204d1dd15730 100644
--- a/llvm/test/Object/X86/irsymtab-bad-alias.ll
+++ b/llvm/test/Object/X86/irsymtab-bad-alias.ll
@@ -11,5 +11,5 @@ target triple = "x86_64-unknown-linux-gnu"
 @g1 = global i32 1
 @g2 = global i32 2
 
- at a = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
-                                  i32 ptrtoint (i32* @g2 to i32)) to i32*)
+ at a = alias i32, inttoptr(i32 sub (i32 ptrtoint (ptr @g1 to i32),
+                                  i32 ptrtoint (ptr @g2 to i32)) to ptr)

diff  --git a/llvm/test/Object/X86/nm-ir.ll b/llvm/test/Object/X86/nm-ir.ll
index e57c6d9a11c6e4..0324efb2948d17 100644
--- a/llvm/test/Object/X86/nm-ir.ll
+++ b/llvm/test/Object/X86/nm-ir.ll
@@ -29,15 +29,15 @@ module asm ".long undef_asm_sym"
 @g3 = common global i32 0
 @g4 = private global i32 42
 
- at a1 = alias i32, i32* @g1
- at a2 = internal alias i32, i32* @g1
+ at a1 = alias i32, ptr @g1
+ at a2 = internal alias i32, ptr @g1
 
-define void ()* @f1() {
+define ptr @f1() {
   call void @f5()
-  ret void ()* null
+  ret ptr null
 }
 
- at ifunc_f1 = ifunc void (), void ()* ()* @f1
+ at ifunc_f1 = ifunc void (), ptr @f1
 
 define internal void @f2() {
   ret void

diff  --git a/llvm/test/Object/dllimport-globalref.ll b/llvm/test/Object/dllimport-globalref.ll
index dd518bc2266cac..0a95be20a9d175 100644
--- a/llvm/test/Object/dllimport-globalref.ll
+++ b/llvm/test/Object/dllimport-globalref.ll
@@ -11,4 +11,4 @@ target triple = "x86_64-pc-windows-msvc"
 ; CHECK: U f
 
 declare dllimport void @f()
- at fp = constant void ()* @f
+ at fp = constant ptr @f

diff  --git a/llvm/test/Object/dllimport.ll b/llvm/test/Object/dllimport.ll
index afdb4562cc9fb8..52f583fa2487e7 100644
--- a/llvm/test/Object/dllimport.ll
+++ b/llvm/test/Object/dllimport.ll
@@ -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
 }

diff  --git a/llvm/test/Object/mangle-ir.ll b/llvm/test/Object/mangle-ir.ll
index bd7c3d93b7c9a2..76442f070385ec 100644
--- a/llvm/test/Object/mangle-ir.ll
+++ b/llvm/test/Object/mangle-ir.ll
@@ -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)

diff  --git a/llvm/test/Object/objc-swift-mixed-imageinfo-macho.ll b/llvm/test/Object/objc-swift-mixed-imageinfo-macho.ll
index d2518f46cc27a8..c506c9687ec2a4 100644
--- a/llvm/test/Object/objc-swift-mixed-imageinfo-macho.ll
+++ b/llvm/test/Object/objc-swift-mixed-imageinfo-macho.ll
@@ -5,11 +5,11 @@
 
 target triple = "x86_64-apple-macosx10.15.0"
 
- at llvm.used = appending global [1 x i8*] [i8* bitcast (i16* @__swift_reflection_version to i8*)], section "llvm.metadata", align 8
+ at 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}


        


More information about the llvm-commits mailing list