[llvm] 1c22d3f - [ARC] Convert tests to opaque pointers (NFC)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 6 12:55:19 PST 2024
Author: Fangrui Song
Date: 2024-02-06T12:55:16-08:00
New Revision: 1c22d3f55df852985c155742bbe96ab5e86aa6f0
URL: https://github.com/llvm/llvm-project/commit/1c22d3f55df852985c155742bbe96ab5e86aa6f0
DIFF: https://github.com/llvm/llvm-project/commit/1c22d3f55df852985c155742bbe96ab5e86aa6f0.diff
LOG: [ARC] Convert tests to opaque pointers (NFC)
Added:
Modified:
llvm/test/CodeGen/ARC/addrmode.ll
llvm/test/CodeGen/ARC/call.ll
llvm/test/CodeGen/ARC/ldst.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/ARC/addrmode.ll b/llvm/test/CodeGen/ARC/addrmode.ll
index 8ca3749025e90..248ec7d4238f1 100644
--- a/llvm/test/CodeGen/ARC/addrmode.ll
+++ b/llvm/test/CodeGen/ARC/addrmode.ll
@@ -2,17 +2,17 @@
; CHECK-LABEL: copy
; CHECK-NOT: add
-define void @copy(i8* inreg nocapture %p, i8* inreg nocapture readonly %q) {
+define void @copy(ptr inreg nocapture %p, ptr inreg nocapture readonly %q) {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
- %p.addr.0 = phi i8* [ %p, %entry ], [ %incdec.ptr1, %while.cond ]
- %q.addr.0 = phi i8* [ %q, %entry ], [ %incdec.ptr, %while.cond ]
- %incdec.ptr = getelementptr inbounds i8, i8* %q.addr.0, i32 1
- %0 = load i8, i8* %q.addr.0, align 1
- %incdec.ptr1 = getelementptr inbounds i8, i8* %p.addr.0, i32 1
- store i8 %0, i8* %p.addr.0, align 1
+ %p.addr.0 = phi ptr [ %p, %entry ], [ %incdec.ptr1, %while.cond ]
+ %q.addr.0 = phi ptr [ %q, %entry ], [ %incdec.ptr, %while.cond ]
+ %incdec.ptr = getelementptr inbounds i8, ptr %q.addr.0, i32 1
+ %0 = load i8, ptr %q.addr.0, align 1
+ %incdec.ptr1 = getelementptr inbounds i8, ptr %p.addr.0, i32 1
+ store i8 %0, ptr %p.addr.0, align 1
%tobool = icmp eq i8 %0, 0
br i1 %tobool, label %while.end, label %while.cond
@@ -21,11 +21,11 @@ while.end: ; preds = %while.cond
}
-%struct._llist = type { %struct._llist*, %struct._llist*, i32 }
+%struct._llist = type { ptr, ptr, i32 }
; CHECK-LABEL: neg1
; CHECK-NOT: std.ab
-define void @neg1(i8* inreg nocapture %a, i8* inreg nocapture readonly %b, i32 inreg %n) {
+define void @neg1(ptr inreg nocapture %a, ptr inreg nocapture readonly %b, i32 inreg %n) {
entry:
%cmp6 = icmp sgt i32 %n, 0
br i1 %cmp6, label %for.body, label %for.cond.cleanup
@@ -35,11 +35,11 @@ for.cond.cleanup:
for.body:
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i8, i8* %b, i32 %i.07
- %0 = load i8, i8* %arrayidx, align 1
+ %arrayidx = getelementptr inbounds i8, ptr %b, i32 %i.07
+ %0 = load i8, ptr %arrayidx, align 1
%mul = mul nuw nsw i32 %i.07, 257
- %arrayidx1 = getelementptr inbounds i8, i8* %a, i32 %mul
- store i8 %0, i8* %arrayidx1, align 1
+ %arrayidx1 = getelementptr inbounds i8, ptr %a, i32 %mul
+ store i8 %0, ptr %arrayidx1, align 1
%inc = add nuw nsw i32 %i.07, 1
%exitcond = icmp eq i32 %inc, %n
br i1 %exitcond, label %for.cond.cleanup, label %for.body
@@ -47,7 +47,7 @@ for.body:
; CHECK-LABEL: neg2
; CHECK-NOT: st.ab
-define void @neg2(%struct._llist* inreg %a, i32 inreg %n) {
+define void @neg2(ptr inreg %a, i32 inreg %n) {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body, label %for.cond.cleanup
@@ -57,11 +57,11 @@ for.cond.cleanup:
for.body:
%i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds %struct._llist, %struct._llist* %a, i32 %i.014
- %next = getelementptr inbounds %struct._llist, %struct._llist* %arrayidx, i32 0, i32 0
- store %struct._llist* %arrayidx, %struct._llist** %next, align 4
- %prev = getelementptr inbounds %struct._llist, %struct._llist* %a, i32 %i.014, i32 1
- store %struct._llist* %arrayidx, %struct._llist** %prev, align 4
+ %arrayidx = getelementptr inbounds %struct._llist, ptr %a, i32 %i.014
+ %next = getelementptr inbounds %struct._llist, ptr %arrayidx, i32 0, i32 0
+ store ptr %arrayidx, ptr %next, align 4
+ %prev = getelementptr inbounds %struct._llist, ptr %a, i32 %i.014, i32 1
+ store ptr %arrayidx, ptr %prev, align 4
%inc = add nuw nsw i32 %i.014, 1
%exitcond = icmp eq i32 %inc, %n
br i1 %exitcond, label %for.cond.cleanup, label %for.body
diff --git a/llvm/test/CodeGen/ARC/call.ll b/llvm/test/CodeGen/ARC/call.ll
index 2985439b5f10d..d74b35a35f65e 100644
--- a/llvm/test/CodeGen/ARC/call.ll
+++ b/llvm/test/CodeGen/ARC/call.ll
@@ -73,14 +73,14 @@ define i64 @ret1() nounwind {
ret i64 281470698455295
}
- at funcptr = external global i32 (i32)*, align 4
+ at funcptr = external global ptr, align 4
; Indirect calls use JL
; CHECK-LABEL: call_indirect
; CHECK-DAG: ld %r[[REG:[0-9]+]], [@funcptr]
; CHECK-DAG: mov %r0, 12
; CHECK: jl [%r[[REG]]]
define i32 @call_indirect(i32 %x) nounwind {
- %f = load i32 (i32)*, i32 (i32)** @funcptr, align 4
+ %f = load ptr, ptr @funcptr, align 4
%call = call i32 %f(i32 12)
%add = add nsw i32 %call, %x
ret i32 %add
diff --git a/llvm/test/CodeGen/ARC/ldst.ll b/llvm/test/CodeGen/ARC/ldst.ll
index dd1529875a667..99b43de71cb4d 100644
--- a/llvm/test/CodeGen/ARC/ldst.ll
+++ b/llvm/test/CodeGen/ARC/ldst.ll
@@ -3,40 +3,40 @@
; CHECK-LABEL: load32
; CHECK: ld %r0, [%r0,16000]
-define i32 @load32(i32* %bp) nounwind {
+define i32 @load32(ptr %bp) nounwind {
entry:
- %gep = getelementptr i32, i32* %bp, i32 4000
- %v = load i32, i32* %gep, align 4
+ %gep = getelementptr i32, ptr %bp, i32 4000
+ %v = load i32, ptr %gep, align 4
ret i32 %v
}
; CHECK-LABEL: load16
; CHECK: ldh %r0, [%r0,8000]
-define i16 @load16(i16* %bp) nounwind {
+define i16 @load16(ptr %bp) nounwind {
entry:
- %gep = getelementptr i16, i16* %bp, i32 4000
- %v = load i16, i16* %gep, align 2
+ %gep = getelementptr i16, ptr %bp, i32 4000
+ %v = load i16, ptr %gep, align 2
ret i16 %v
}
; CHECK-LABEL: load8
; CHECK: ldb %r0, [%r0,4000]
-define i8 @load8(i8* %bp) nounwind {
+define i8 @load8(ptr %bp) nounwind {
entry:
- %gep = getelementptr i8, i8* %bp, i32 4000
- %v = load i8, i8* %gep, align 1
+ %gep = getelementptr i8, ptr %bp, i32 4000
+ %v = load i8, ptr %gep, align 1
ret i8 %v
}
; CHECK-LABEL: sextload16
; CHECK: ldh.x %r0, [%r0,8000]
-define i32 @sextload16(i16* %bp) nounwind {
+define i32 @sextload16(ptr %bp) nounwind {
entry:
- %gep = getelementptr i16, i16* %bp, i32 4000
- %vl = load i16, i16* %gep, align 2
+ %gep = getelementptr i16, ptr %bp, i32 4000
+ %vl = load i16, ptr %gep, align 2
%v = sext i16 %vl to i32
ret i32 %v
}
@@ -44,10 +44,10 @@ entry:
; CHECK-LABEL: sextload8
; CHECK: ldb.x %r0, [%r0,4000]
-define i32 @sextload8(i8* %bp) nounwind {
+define i32 @sextload8(ptr %bp) nounwind {
entry:
- %gep = getelementptr i8, i8* %bp, i32 4000
- %vl = load i8, i8* %gep, align 1
+ %gep = getelementptr i8, ptr %bp, i32 4000
+ %vl = load i8, ptr %gep, align 1
%v = sext i8 %vl to i32
ret i32 %v
}
@@ -55,10 +55,10 @@ entry:
; CHECK-LABEL: s_sextload16
; CHECK: ldh.x %r0, [%r0,32]
-define i32 @s_sextload16(i16* %bp) nounwind {
+define i32 @s_sextload16(ptr %bp) nounwind {
entry:
- %gep = getelementptr i16, i16* %bp, i32 16
- %vl = load i16, i16* %gep, align 2
+ %gep = getelementptr i16, ptr %bp, i32 16
+ %vl = load i16, ptr %gep, align 2
%v = sext i16 %vl to i32
ret i32 %v
}
@@ -66,10 +66,10 @@ entry:
; CHECK-LABEL: s_sextload8
; CHECK: ldb.x %r0, [%r0,16]
-define i32 @s_sextload8(i8* %bp) nounwind {
+define i32 @s_sextload8(ptr %bp) nounwind {
entry:
- %gep = getelementptr i8, i8* %bp, i32 16
- %vl = load i8, i8* %gep, align 1
+ %gep = getelementptr i8, ptr %bp, i32 16
+ %vl = load i8, ptr %gep, align 1
%v = sext i8 %vl to i32
ret i32 %v
}
@@ -79,10 +79,10 @@ entry:
; CHECK: st %r0, [%r[[REG]],0]
; Long range stores (offset does not fit in s9) must be add followed by st.
-define void @store32(i32 %val, i32* %bp) nounwind {
+define void @store32(i32 %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i32, i32* %bp, i32 4000
- store i32 %val, i32* %gep, align 4
+ %gep = getelementptr i32, ptr %bp, i32 4000
+ store i32 %val, ptr %gep, align 4
ret void
}
@@ -90,10 +90,10 @@ entry:
; CHECK: add %r[[REG:[0-9]+]], %r1, 8000
; CHECK: sth %r0, [%r[[REG]],0]
-define void @store16(i16 zeroext %val, i16* %bp) nounwind {
+define void @store16(i16 zeroext %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i16, i16* %bp, i32 4000
- store i16 %val, i16* %gep, align 2
+ %gep = getelementptr i16, ptr %bp, i32 4000
+ store i16 %val, ptr %gep, align 2
ret void
}
@@ -101,10 +101,10 @@ entry:
; CHECK: add %r[[REG:[0-9]+]], %r1, 4000
; CHECK: stb %r0, [%r[[REG]],0]
-define void @store8(i8 zeroext %val, i8* %bp) nounwind {
+define void @store8(i8 zeroext %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i8, i8* %bp, i32 4000
- store i8 %val, i8* %gep, align 1
+ %gep = getelementptr i8, ptr %bp, i32 4000
+ store i8 %val, ptr %gep, align 1
ret void
}
@@ -112,30 +112,30 @@ entry:
; CHECK-LABEL: s_store32
; CHECK-NOT: add
; CHECK: st %r0, [%r1,64]
-define void @s_store32(i32 %val, i32* %bp) nounwind {
+define void @s_store32(i32 %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i32, i32* %bp, i32 16
- store i32 %val, i32* %gep, align 4
+ %gep = getelementptr i32, ptr %bp, i32 16
+ store i32 %val, ptr %gep, align 4
ret void
}
; CHECK-LABEL: s_store16
; CHECK-NOT: add
; CHECK: sth %r0, [%r1,32]
-define void @s_store16(i16 zeroext %val, i16* %bp) nounwind {
+define void @s_store16(i16 zeroext %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i16, i16* %bp, i32 16
- store i16 %val, i16* %gep, align 2
+ %gep = getelementptr i16, ptr %bp, i32 16
+ store i16 %val, ptr %gep, align 2
ret void
}
; CHECK-LABEL: s_store8
; CHECK-NOT: add
; CHECK: stb %r0, [%r1,16]
-define void @s_store8(i8 zeroext %val, i8* %bp) nounwind {
+define void @s_store8(i8 zeroext %val, ptr %bp) nounwind {
entry:
- %gep = getelementptr i8, i8* %bp, i32 16
- store i8 %val, i8* %gep, align 1
+ %gep = getelementptr i8, ptr %bp, i32 16
+ store i8 %val, ptr %gep, align 1
ret void
}
@@ -149,7 +149,7 @@ entry:
; CHECK: st %r0, [@aaaa+64]
define void @g_store32(i32 %val) nounwind {
entry:
- store i32 %val, i32* getelementptr inbounds ([128 x i32], [128 x i32]* @aaaa, i32 0, i32 16), align 4
+ store i32 %val, ptr getelementptr inbounds ([128 x i32], ptr @aaaa, i32 0, i32 16), align 4
ret void
}
@@ -157,8 +157,8 @@ entry:
; CHECK-NOT: add
; CHECK: ld %r0, [@aaaa+64]
define i32 @g_load32() nounwind {
- %gep = getelementptr inbounds [128 x i32], [128 x i32]* @aaaa, i32 0, i32 16
- %v = load i32, i32* %gep, align 4
+ %gep = getelementptr inbounds [128 x i32], ptr @aaaa, i32 0, i32 16
+ %v = load i32, ptr %gep, align 4
ret i32 %v
}
@@ -167,7 +167,7 @@ define i32 @g_load32() nounwind {
; CHECK: sth %r0, [@bbbb+32]
define void @g_store16(i16 %val) nounwind {
entry:
- store i16 %val, i16* getelementptr inbounds ([128 x i16], [128 x i16]* @bbbb, i16 0, i16 16), align 2
+ store i16 %val, ptr getelementptr inbounds ([128 x i16], ptr @bbbb, i16 0, i16 16), align 2
ret void
}
@@ -175,8 +175,8 @@ entry:
; CHECK-NOT: add
; CHECK: ldh %r0, [@bbbb+32]
define i16 @g_load16() nounwind {
- %gep = getelementptr inbounds [128 x i16], [128 x i16]* @bbbb, i16 0, i16 16
- %v = load i16, i16* %gep, align 2
+ %gep = getelementptr inbounds [128 x i16], ptr @bbbb, i16 0, i16 16
+ %v = load i16, ptr %gep, align 2
ret i16 %v
}
@@ -185,7 +185,7 @@ define i16 @g_load16() nounwind {
; CHECK: stb %r0, [@cccc+16]
define void @g_store8(i8 %val) nounwind {
entry:
- store i8 %val, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cccc, i8 0, i8 16), align 1
+ store i8 %val, ptr getelementptr inbounds ([128 x i8], ptr @cccc, i8 0, i8 16), align 1
ret void
}
@@ -193,8 +193,8 @@ entry:
; CHECK-NOT: add
; CHECK: ldb %r0, [@cccc+16]
define i8 @g_load8() nounwind {
- %gep = getelementptr inbounds [128 x i8], [128 x i8]* @cccc, i8 0, i8 16
- %v = load i8, i8* %gep, align 1
+ %gep = getelementptr inbounds [128 x i8], ptr @cccc, i8 0, i8 16
+ %v = load i8, ptr %gep, align 1
ret i8 %v
}
@@ -202,10 +202,10 @@ define i8 @g_load8() nounwind {
; CHECK-DAG: ldh %r[[REG0:[0-9]+]], [%r0,0]
; CHECK-DAG: ldh %r[[REG1:[0-9]+]], [%r0,2]
; CHECK-DAG: asl %r[[REG2:[0-9]+]], %r[[REG1]], 16
-define i32 @align2_load32(i8* %p) nounwind {
+define i32 @align2_load32(ptr %p) nounwind {
entry:
- %bp = bitcast i8* %p to i32*
- %v = load i32, i32* %bp, align 2
+ %bp = bitcast ptr %p to ptr
+ %v = load i32, ptr %bp, align 2
ret i32 %v
}
@@ -220,10 +220,10 @@ entry:
; CHECK-DAG: or %r[[AREG01:[0-9]+]], %r[[AREG1]], %r[[REG0]]
; CHECK-DAG: or %r[[AREG23:[0-9]+]], %r[[AREG3]], %r[[AREG2]]
; CHECK-DAG: or %r0, %r[[AREG23]], %r[[AREG01]]
-define i32 @align1_load32(i8* %p) nounwind {
+define i32 @align1_load32(ptr %p) nounwind {
entry:
- %bp = bitcast i8* %p to i32*
- %v = load i32, i32* %bp, align 1
+ %bp = bitcast ptr %p to ptr
+ %v = load i32, ptr %bp, align 1
ret i32 %v
}
@@ -231,10 +231,10 @@ entry:
; CHECK-DAG: ldb %r[[REG0:[0-9]+]], [%r0,0]
; CHECK-DAG: ldb %r[[REG1:[0-9]+]], [%r0,1]
; CHECK-DAG: asl %r[[REG2:[0-9]+]], %r[[REG1]], 8
-define i16 @align1_load16(i8* %p) nounwind {
+define i16 @align1_load16(ptr %p) nounwind {
entry:
- %bp = bitcast i8* %p to i16*
- %v = load i16, i16* %bp, align 1
+ %bp = bitcast ptr %p to ptr
+ %v = load i16, ptr %bp, align 1
ret i16 %v
}
@@ -242,10 +242,10 @@ entry:
; CHECK-DAG: lsr %r[[REG:[0-9]+]], %r1, 16
; CHECK-DAG: sth %r1, [%r0,0]
; CHECK-DAG: sth %r[[REG:[0-9]+]], [%r0,2]
-define void @align2_store32(i8* %p, i32 %v) nounwind {
+define void @align2_store32(ptr %p, i32 %v) nounwind {
entry:
- %bp = bitcast i8* %p to i32*
- store i32 %v, i32* %bp, align 2
+ %bp = bitcast ptr %p to ptr
+ store i32 %v, ptr %bp, align 2
ret void
}
@@ -253,10 +253,10 @@ entry:
; CHECK-DAG: lsr %r[[REG:[0-9]+]], %r1, 8
; CHECK-DAG: stb %r1, [%r0,0]
; CHECK-DAG: stb %r[[REG:[0-9]+]], [%r0,1]
-define void @align1_store16(i8* %p, i16 %v) nounwind {
+define void @align1_store16(ptr %p, i16 %v) nounwind {
entry:
- %bp = bitcast i8* %p to i16*
- store i16 %v, i16* %bp, align 1
+ %bp = bitcast ptr %p to ptr
+ store i16 %v, ptr %bp, align 1
ret void
}
@@ -268,9 +268,9 @@ entry:
; CHECK-DAG: stb %r[[REG0]], [%r0,1]
; CHECK-DAG: stb %r[[REG1]], [%r0,2]
; CHECK-DAG: stb %r[[REG2]], [%r0,3]
-define void @align1_store32(i8* %p, i32 %v) nounwind {
+define void @align1_store32(ptr %p, i32 %v) nounwind {
entry:
- %bp = bitcast i8* %p to i32*
- store i32 %v, i32* %bp, align 1
+ %bp = bitcast ptr %p to ptr
+ store i32 %v, ptr %bp, align 1
ret void
}
More information about the llvm-commits
mailing list