Skip to content

Commit

Permalink
port all tests to LLVM's new ptr syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Oct 10, 2023
1 parent f95e321 commit 5409b46
Show file tree
Hide file tree
Showing 259 changed files with 1,126 additions and 1,276 deletions.
5 changes: 2 additions & 3 deletions tests/alive-tv/cast.src.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
define i16 @f1(half %x) {
%a = alloca half
store half %x, half* %a
%p = bitcast half* %a to i16*
%i = load i16, i16* %p
store half %x, ptr %a
%i = load i16, ptr %a
ret i16 %i
}
4 changes: 2 additions & 2 deletions tests/alive-tv/issue476.srctgt.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; ERROR: Parameter attributes not refined

define i32 @src(i8* dereferenceable(4) %p) {
define i32 @src(ptr dereferenceable(4) %p) {
ret i32 0
}

define i32 @tgt(i8* dereferenceable(8) %p) {
define i32 @tgt(ptr dereferenceable(8) %p) {
ret i32 0
}
35 changes: 17 additions & 18 deletions tests/alive-tv/memory/aggregate-bigendian.src.ll
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
target datalayout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test1({{i32,i8},i32}* %x) {
define i32 @test1(ptr %x) {
; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE}
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 0, i32 0
%r = load i32, i32* %y
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 0, i32 0
%r = load i32, ptr %y
ret i32 %r
}

define i8 @test2({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 0, i32 1
%r = load i8, i8* %y
define i8 @test2(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 0, i32 1
%r = load i8, ptr %y
ret i8 %r
}

define i32 @test3({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 1
%r = load i32, i32* %y
define i32 @test3(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 1
%r = load i32, ptr %y
ret i32 %r
}

define i16 @test4({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 0, i32 0
%z = bitcast i32* %y to i16*
%w = getelementptr i16, i16* %z, i32 2
%r = load i16, i16* %w
define i16 @test4(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 0, i32 0
%w = getelementptr i16, ptr %y, i32 2
%r = load i16, ptr %w
ret i16 %r
}
16 changes: 8 additions & 8 deletions tests/alive-tv/memory/aggregate-bigendian.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
target datalayout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test1({{i32,i8},i32}* %x) {
define i32 @test1(ptr %x) {
; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE}
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
; 0xDEADBEEF
ret i32 -559038737
}

define i8 @test2({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
define i8 @test2(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
; 0xBA
ret i8 186
}

define i32 @test3({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
define i32 @test3(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
; 0xCAFEBABE
ret i32 -889275714
}

define i16 @test4({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
define i16 @test4(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
; 0xBA00
ret i16 47616
}
Expand Down
8 changes: 4 additions & 4 deletions tests/alive-tv/memory/aggregate-empty.src.ll
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@g7 = constant {[0 x i32], [0 x i8], {}*} { [0 x i32] undef, [0 x i8] undef, {}* null }
@g7 = constant {[0 x i32], [0 x i8], ptr} { [0 x i32] poison, [0 x i8] poison, ptr null }

define i64* @test_leading_zero_size_elems() {
%v = load i64*, i64** bitcast ({[0 x i32], [0 x i8], {}*}* @g7 to i64**)
ret i64* %v
define ptr @test_leading_zero_size_elems() {
%v = load ptr, ptr @g7
ret ptr %v
}


6 changes: 3 additions & 3 deletions tests/alive-tv/memory/aggregate-empty.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@g7 = constant {[0 x i32], [0 x i8], {}*} { [0 x i32] undef, [0 x i8] undef, {}* null }
@g7 = constant {[0 x i32], [0 x i8], ptr} { [0 x i32] poison, [0 x i8] poison, ptr null }

define i64* @test_leading_zero_size_elems() {
ret i64* null
define ptr @test_leading_zero_size_elems() {
ret ptr null
}
8 changes: 4 additions & 4 deletions tests/alive-tv/memory/aggregate-fail-1.src.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test1({{i32,i8},i32}* %x) {
define i32 @test1(ptr %x) {
; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE}
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 0, i32 0
%r = load i32, i32* %y
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 0, i32 0
%r = load i32, ptr %y
ret i32 %r
}

Expand Down
5 changes: 2 additions & 3 deletions tests/alive-tv/memory/aggregate-fail-1.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test1({{i32,i8},i32}* %x) {
define i32 @test1(ptr %x) {
; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE}
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
ret i32 -889275714
}

8 changes: 4 additions & 4 deletions tests/alive-tv/memory/aggregate-fail-2.src.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i8 @test2({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 0, i32 1
%r = load i8, i8* %y
define i8 @test2(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 0, i32 1
%r = load i8, ptr %y
ret i8 %r
}

Expand Down
5 changes: 2 additions & 3 deletions tests/alive-tv/memory/aggregate-fail-2.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i8 @test2({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
define i8 @test2(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
ret i8 187
}

8 changes: 4 additions & 4 deletions tests/alive-tv/memory/aggregate-fail-3.src.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test3({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
%y = getelementptr {{i32,i8},i32}, {{i32,i8},i32}* %x, i32 0, i32 1
%r = load i32, i32* %y
define i32 @test3(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
%y = getelementptr {{i32,i8},i32}, ptr %x, i32 0, i32 1
%r = load i32, ptr %y
ret i32 %r
}

Expand Down
4 changes: 2 additions & 2 deletions tests/alive-tv/memory/aggregate-fail-3.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"

define i32 @test3({{i32,i8},i32}* %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, {{i32,i8},i32}* %x
define i32 @test3(ptr %x) {
store {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 }, ptr %x
ret i32 -559038737
}
7 changes: 3 additions & 4 deletions tests/alive-tv/memory/aggregate-i2.src.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
define i2 @f({i2, i2}* %x) {
store {i2, i2} {i2 1, i2 2}, {i2, i2}* %x
%y = load {i2, i2}, {i2, i2}* %x
define i2 @f(ptr %x) {
store {i2, i2} {i2 1, i2 2}, ptr %x
%y = load {i2, i2}, ptr %x
%w1 = extractvalue {i2, i2} %y, 0
%w2 = extractvalue {i2, i2} %y, 1
%t = add i2 %w1, %w2
ret i2 %t
}

5 changes: 2 additions & 3 deletions tests/alive-tv/memory/aggregate-i2.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
define i2 @f({i2, i2}* %x) {
store {i2, i2} {i2 1, i2 2}, {i2, i2}* %x
define i2 @f(ptr %x) {
store {i2, i2} {i2 1, i2 2}, ptr %x
ret i2 3
}

20 changes: 8 additions & 12 deletions tests/alive-tv/memory/aggregate-padding.srctgt.ll
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
@glb = global {i8, i32} undef, align 4
@glb = global {i8, i32} poison, align 4

define i8 @src() {
%p = bitcast {i8, i32}* @glb to i32*
store i32 0, i32* %p, align 4 ; fill padding with 0
store i32 0, ptr @glb, align 4 ; fill padding with 0

%v = load {i8, i32}, {i8, i32}* @glb ;padding should be poison
store {i8, i32} %v, {i8, i32}* @glb, align 4
%v = load {i8, i32}, ptr @glb ;padding should be poison
store {i8, i32} %v, ptr @glb, align 4

%p2 = bitcast {i8, i32}* @glb to i8*
%p3 = getelementptr i8, i8* %p2, i64 1
%padding = load i8, i8* %p3
%p3 = getelementptr i8, ptr @glb, i64 1
%padding = load i8, ptr %p3
ret i8 %padding
}

define i8 @tgt() {
%p = bitcast {i8, i32}* @glb to i32*
store i32 0, i32* %p, align 4

ret i8 undef
store i32 0, ptr @glb, align 4
ret i8 poison
}
2 changes: 1 addition & 1 deletion tests/alive-tv/memory/aggregate-vector-bigendian.src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ target datalayout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i6
@g = constant {i64, i64} { i64 123, i64 112312312 }

define <2 x i64> @test() {
%r = load <2 x i64>, <2 x i64>* bitcast({i64, i64}* @g to <2 x i64>*)
%r = load <2 x i64>, ptr @g
ret <2 x i64> %r
}
2 changes: 1 addition & 1 deletion tests/alive-tv/memory/aggregate-vector.src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ target datalayout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i6
@g = constant {i64, i64} { i64 123, i64 112312312 }

define <2 x i64> @test() {
%r = load <2 x i64>, <2 x i64>* bitcast({i64, i64}* @g to <2 x i64>*)
%r = load <2 x i64>, ptr @g
ret <2 x i64> %r
}
6 changes: 3 additions & 3 deletions tests/alive-tv/memory/align.src.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define i32 @foo1(i32* %a) {
%v = load i32, i32* %a, align 4
%ptrint = ptrtoint i32* %a to i64
define i32 @foo1(ptr %a) {
%v = load i32, ptr %a, align 4
%ptrint = ptrtoint ptr %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
Expand Down
6 changes: 3 additions & 3 deletions tests/alive-tv/memory/align.tgt.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define i32 @foo1(i32* %a) {
%v = load i32, i32* %a, align 32
%ptrint = ptrtoint i32* %a to i64
define i32 @foo1(ptr %a) {
%v = load i32, ptr %a, align 32
%ptrint = ptrtoint ptr %a to i64
%maskedptr = and i64 %ptrint, 31
%maskcond = icmp eq i64 %maskedptr, 0
tail call void @llvm.assume(i1 %maskcond)
Expand Down
14 changes: 7 additions & 7 deletions tests/alive-tv/memory/align2.srctgt.ll
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
; ERROR: Value mismatch

define i32 @src(i32* align(4) %p) {
call void @g(i32* align(2) %p)
%v = load i32, i32* %p, align 4
define i32 @src(ptr align(4) %p) {
call void @g(ptr align(2) %p)
%v = load i32, ptr %p, align 4
ret i32 %v
}

define i32 @tgt(i32* align(4) %p) {
call void @g(i32* align(2) %p)
%v = load i32, i32* %p, align 4
define i32 @tgt(ptr align(4) %p) {
call void @g(ptr align(2) %p)
%v = load i32, ptr %p, align 4
ret i32 0
}

declare void @g(i32*)
declare void @g(ptr)
10 changes: 5 additions & 5 deletions tests/alive-tv/memory/align3.srctgt.ll
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; ERROR: Value mismatch

define i16 @src(i16* align(4) %p) {
%a = load i16, i16* %p, align 1
%p2 = getelementptr i16, i16* %p, i32 1
%b = load i16, i16* %p2, align 1
define i16 @src(ptr align(4) %p) {
%a = load i16, ptr %p, align 1
%p2 = getelementptr i16, ptr %p, i32 1
%b = load i16, ptr %p2, align 1
%x = xor i16 %a, %b
ret i16 %x
}

define i16 @tgt(i16* align(4) %p) {
define i16 @tgt(ptr align(4) %p) {
ret i16 0
}
2 changes: 1 addition & 1 deletion tests/alive-tv/memory/alloca-address-nonnull.src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

define i1 @f() {
%ptr = alloca i8
%i = ptrtoint i8* %ptr to i64
%i = ptrtoint ptr %ptr to i64
%x = icmp eq i64 %i, 0
ret i1 %x
}
14 changes: 6 additions & 8 deletions tests/alive-tv/memory/alloca-align.src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ define void @f1() {

define void @f2() {
%p = alloca i32, align 1
%p0 = bitcast i32* %p to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.start.p0i8(i64 4, ptr %p)
call void @llvm.lifetime.end.p0i8(i64 4, ptr %p)
ret void
}

Expand All @@ -18,12 +17,11 @@ define void @f3() {

define void @f4() {
%p = alloca i32, align 1
%p0 = bitcast i32* %p to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.start.p0i8(i64 4, ptr %p)
call void @llvm.lifetime.end.p0i8(i64 4, ptr %p)
ret void
}


declare void @llvm.lifetime.start.p0i8(i64, i8*)
declare void @llvm.lifetime.end.p0i8(i64, i8*)
declare void @llvm.lifetime.start.p0i8(i64, ptr)
declare void @llvm.lifetime.end.p0i8(i64, ptr)
15 changes: 6 additions & 9 deletions tests/alive-tv/memory/alloca-align.tgt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ define void @f1() {

define void @f2() {
%p = alloca i32, align 4
%p0 = bitcast i32* %p to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.start.p0i8(i64 4, ptr %p)
call void @llvm.lifetime.end.p0i8(i64 4, ptr %p)
ret void
}

define void @f3() {
%p = alloca i32, align 4
%p0 = bitcast i32* %p to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %p0)
call void @llvm.lifetime.start.p0i8(i64 4, ptr %p)
call void @llvm.lifetime.end.p0i8(i64 4, ptr %p)
ret void
}

Expand All @@ -24,6 +22,5 @@ define void @f4() {
ret void
}


declare void @llvm.lifetime.start.p0i8(i64, i8*)
declare void @llvm.lifetime.end.p0i8(i64, i8*)
declare void @llvm.lifetime.start.p0i8(i64, ptr)
declare void @llvm.lifetime.end.p0i8(i64, ptr)
Loading

0 comments on commit 5409b46

Please sign in to comment.