Added bigger test for regression.

This commit is contained in:
Christoffer Lerno
2021-06-01 10:08:51 +02:00
parent 9fd6c06861
commit 9f545c3f89

View File

@@ -0,0 +1,716 @@
module test;
import test2;
import std::array::list;
import std::array::linkedlist;
import hello_world;
extern func int printf(char *, ...);
func void helloWorld()
{
printf("helloWorld!\n");
}
func int test_static()
{
static int x = 1;
x++;
printf("Test static %d\n", x);
return x;
}
struct Bobo { short b; float c; short d; short e; float f; short g; }
struct Blob { int z; int f; }
union Foor
{
long a;
char[12] b;
}
func int helo(double d, Bobo b)
{
int[3] de = { 1, 2, 3 };
Bobo c = b;
helo(1.0, c);
return 1;
}
func int test1(int a, int b)
{
a = a >> b;
if (b > 128) return -1;
return a;
}
struct Foo2
{
int x;
}
func void Foo2.printme(Foo2 *foo)
{
printf("Foo is: %d\n", foo.x);
}
func int Foo2.mutate(Foo2 *foo)
{
printf("Mutating");
return ++foo.x;
}
extern func void test_virtual3(virtual* y);
interface Baz
{
func void open();
func int close();
}
extern func void test_virtual2(virtual Baz* z);
define oopsInt = test2::argh<int>;
define oopsDouble = test2::argh<int>;
define Argh = func int(double, Bobo);
define Argh2 = func int(double, Bobo);
func int sum_us(int... x)
{
int sum = 0;
if (x.len() == 0) return 0;
sum += x[0] + sum_us(...x[1..^1]);
return sum;
}
define Frob = long;
func int sumd(int[] x)
{
int sum = 0;
for (int i = 0; i < x.len(); i++) sum += x[i];
return sum;
}
struct Foo
{
int a;
int b;
}
define getValueInt = test2::getValue<int>;
define getValueDouble = test2::getValue<double>;
define IntBlob = test2::Blob<int>;
define DoubleBlob = Blob<double>;
define getMultInt = getMult<int>;
define getMultDouble = getMult<double>;
define IntArray = List<int>;
define IntList = LinkedList<int>;
enum MyEnum : int
{
HELO = 12,
WORLD = 14,
BYE = -5
}
func void main()
{
test_static();
test_static();
test_static();
hello_world::hello();
IntList list;
list.push(10);
list.push(15);
list.push(30);
for (int i = 0; i < (int)(list.len()); i++)
{
printf("Element[%d]: %d\n", i, list.get(i));
}
list.free();
printf("Min %d Max %d Elements: %d\n", MyEnum.min, MyEnum.max, MyEnum.elements);
int max = MyEnum.max;
int min = MyEnum.min;
int elements = MyEnum.elements;
printf("Hello\n");
IntArray array;
array.append(100);
array.append(200);
array.append(400);
array.push(600);
array.insertAt(2, 300);
for (int i = 0; i < (int)(array.len()); i++)
{
printf("Element[%d]: %d\n", i, array.get(i));
}
array.free();
IntBlob a = { 42 };
DoubleBlob b = { 33.3 };
printf("a was %d\n", getValueInt(a));
printf("b was %f\n", getValueDouble(b));
printf("Mult int was %d\n", getMultInt(25));
printf("Mult double was %f\n", getMultDouble(3.3));
helloWorld();
Foo ddx;
int fro = 3;
int[4] x = { 1, 2, 3, 3 };
fro += printf("1Vararg4unsplatA: %d\n", sum_us(...x));
printf("%d\n", fro);
int[] z = &x;
int[3] de = { 1, 2, 3 };
printf("Vararg4unsplatB: %d\n", sum_us(...&x));
printf("Vararg4unsplatC: %d\n", sum_us(...z));
printf("Vararg4: %d\n", sum_us(1, 2, 4, 5));
printf("Vararg1: %d\n", sum_us(1));
printf("Vararg0: %d\n", sum_us());
Argh a1;
Argh2 b2;
}
module hello_world;
import foo;
extern func int printf(char *, ...);
define doubleMult = check<double>;
func void hello()
{
printf("Hello baby\n");
printf("Mult %f\n", doubleMult(11.1));
}
module foo <Type>;
func Type check(Type i)
{
return i * i;
}
module test2 <Type>;
struct Blob
{
Type a;
}
func Type getMult(Type a)
{
return a * a;
}
Type argh = 234;
error MyErr
{
Type x;
}
enum Hello : int
{
FOO = 3,
BAR = 4,
}
macro Hello wut()
{
return Hello.FOO;
}
define Bye = Hello;
define wat = wut;
define byebye = hello;
func int hello()
{
return 1;
}
func Type getValue(Blob blob)
{
return blob.a;
}
// #expect: test.ll
%Blob = type { i32 }
%Blob.0 = type { double }
%List = type { i64, i64, i32* }
%LinkedList = type { i64, %Node*, %Node* }
%Node = type { %Node*, %Node*, i32 }
%Foo2 = type { i32 }
%Bobo = type { i16, float, i16, i16, float, i16 }
%"int[]" = type { i32*, i64 }
%Foo = type { i32, i32 }
define void @test.Foo2__printme(%Foo2* %0)
entry:
%foo = alloca %Foo2*, align 8
store %Foo2* %0, %Foo2** %foo, align 8
%1 = load %Foo2*, %Foo2** %foo, align 8
%2 = getelementptr inbounds %Foo2, %Foo2* %1, i32 0, i32 0
%3 = load i32, i32* %2, align 8
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i32 0, i32 0), i32 %3)
ret void
}
define i32 @test.Foo2__mutate(%Foo2* %0)
entry:
%foo = alloca %Foo2*, align 8
store %Foo2* %0, %Foo2** %foo, align 8
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0))
%2 = load %Foo2*, %Foo2** %foo, align 8
%3 = getelementptr inbounds %Foo2, %Foo2* %2, i32 0, i32 0
%4 = load i32, i32* %3, align 8
%add = add i32 %4, 1
store i32 %add, i32* %3, align 8
ret i32 %add
}
declare i32 @printf(i8*, ...)
define void @test.helloWorld()
entry:
%0 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0))
ret void
}
define i32 @test.test_static()
entry:
%0 = load i32, i32* @test_static.x, align 4
%add = add i32 %0, 1
store i32 %add, i32* @test_static.x, align 4
%1 = load i32, i32* @test_static.x, align 4
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i32 %1)
%3 = load i32, i32* @test_static.x, align 4
ret i32 %3
}
define i32 @test.helo(double %0, %Bobo* byval align 8 %1)
%d = alloca double, align 8
%b = alloca %Bobo, align 4
%de = alloca [3 x i32], align 4
%c = alloca %Bobo, align 4
%indirectarg = alloca %Bobo, align 8
store double %0, double* %d, align 8
%2 = bitcast %Bobo* %b to i8*
%3 = bitcast %Bobo* %1 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %2, i8* align 8 %3, i32 20, i1 false)
%4 = bitcast [3 x i32]* %de to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %4, i8* align 4 bitcast ([3 x i32]* @.__const to i8*), i32 12, i1 false)
%5 = bitcast %Bobo* %c to i8*
%6 = bitcast %Bobo* %b to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %5, i8* align 4 %6, i32 20, i1 false)
%7 = bitcast %Bobo* %indirectarg to i8*
%8 = bitcast %Bobo* %c to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %7, i8* align 4 %8, i32 20, i1 false)
%9 = call i32 @test.helo(double 1.000000e+00, %Bobo* %indirectarg)
ret i32 1
}
define i32 @test.test1(i32 %0, i32 %1)
%a = alloca i32, align 4
%b = alloca i32, align 4
store i32 %0, i32* %a, align 4
store i32 %1, i32* %b, align 4
%2 = load i32, i32* %a, align 4
%3 = load i32, i32* %b, align 4
%ashr = ashr i32 %2, %3
%4 = freeze i32 %ashr
store i32 %4, i32* %a, align 4
%5 = load i32, i32* %b, align 4
%gt = icmp sgt i32 %5, 128
br i1 %gt, label %if.then, label %if.exit
ret i32 -1
%6 = load i32, i32* %a, align 4
ret i32 %6
}
declare void @test_virtual3(i64, i8*) #1
declare void @test_virtual2(i8*, i8*) #1
define i32 @test.sum_us(i64 %0, i8* %1)
%x = alloca %"int[]", align 8
%sum = alloca i32, align 4
%vararg = alloca %"int[]", align 8
%tempaddr = alloca %"int[]", align 8
%pair = bitcast %"int[]"* %x to { i64, i8* }*
%lo = getelementptr inbounds { i64, i8* }, { i64, i8* }* %pair, i32 0, i32 0
store i64 %0, i64* %lo, align 8
%hi = getelementptr inbounds { i64, i8* }, { i64, i8* }* %pair, i32 0, i32 1
store i8* %1, i8** %hi, align 8
store i32 0, i32* %sum, align 4
%len = getelementptr inbounds %"int[]", %"int[]"* %x, i32 0, i32 1
%2 = load i64, i64* %len, align 8
%eq = icmp eq i64 %2, 0
br i1 %eq, label %if.then, label %if.exit
ret i32 0
%3 = load i32, i32* %sum, align 4
%subarrayptr = getelementptr inbounds %"int[]", %"int[]"* %x, i32 0, i32 0
%saptr = load i32*, i32** %subarrayptr, align 8
%sarridx = getelementptr inbounds i32, i32* %saptr, i64 0
%4 = load i32, i32* %sarridx, align 4
%5 = load %"int[]", %"int[]"* %x, align 8
%6 = extractvalue %"int[]" %5, 0
%7 = extractvalue %"int[]" %5, 1
%sub = sub i64 %7, 1
%8 = add i64 %sub, 1
%size = sub i64 %8, 1
%offsetsub = getelementptr inbounds i32, i32* %6, i64 1
%9 = insertvalue %"int[]" undef, i32* %offsetsub, 0
%10 = insertvalue %"int[]" %9, i64 %size, 1
%11 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 1
%12 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 0
store %"int[]" %10, %"int[]"* %tempaddr, align 8
%casttemp = bitcast %"int[]"* %tempaddr to { i64, i8* }*
%lo1 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp, i32 0, i32 0
%lo2 = load i64, i64* %lo1, align 8
%hi3 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp, i32 0, i32 1
%hi4 = load i8*, i8** %hi3, align 8
%13 = call i32 @test.sum_us(i64 %lo2, i8* %hi4)
%add = add i32 %4, %13
%add5 = add i32 %3, %add
store i32 %add5, i32* %sum, align 4
%14 = load i32, i32* %sum, align 4
ret i32 %14
}
define i32 @test.sumd(i64 %0, i8* %1)
%x = alloca %"int[]", align 8
%sum = alloca i32, align 4
%i = alloca i32, align 4
%pair = bitcast %"int[]"* %x to { i64, i8* }*
%lo = getelementptr inbounds { i64, i8* }, { i64, i8* }* %pair, i32 0, i32 0
store i64 %0, i64* %lo, align 8
%hi = getelementptr inbounds { i64, i8* }, { i64, i8* }* %pair, i32 0, i32 1
store i8* %1, i8** %hi, align 8
store i32 0, i32* %sum, align 4
store i32 0, i32* %i, align 4
br label %for.cond
%2 = load i32, i32* %i, align 4
%sisiext = sext i32 %2 to i64
%len = getelementptr inbounds %"int[]", %"int[]"* %x, i32 0, i32 1
%3 = load i64, i64* %len, align 8
%lt = icmp slt i64 %sisiext, %3
%check = icmp slt i64 %3, 0
%siui-lt = or i1 %check, %lt
br i1 %siui-lt, label %for.body, label %for.exit
%4 = load i32, i32* %sum, align 4
%subarrayptr = getelementptr inbounds %"int[]", %"int[]"* %x, i32 0, i32 0
%saptr = load i32*, i32** %subarrayptr, align 8
%5 = load i32, i32* %i, align 4
%sisiext1 = sext i32 %5 to i64
%sarridx = getelementptr inbounds i32, i32* %saptr, i64 %sisiext1
%6 = load i32, i32* %sarridx, align 4
%add = add i32 %4, %6
store i32 %add, i32* %sum, align 4
br label %for.inc
%7 = load i32, i32* %i, align 4
%add2 = add i32 %7, 1
store i32 %add2, i32* %i, align 4
br label %for.cond
%8 = load i32, i32* %sum, align 4
ret i32 %8
define void @main()
entry:
%list = alloca %LinkedList, align 8
%i = alloca i32, align 4
%max = alloca i32, align 4
%min = alloca i32, align 4
%elements = alloca i32, align 4
%array = alloca %List, align 8
%i1 = alloca i32, align 4
%a = alloca %Blob, align 4
%b = alloca %Blob.0, align 8
%ddx = alloca %Foo, align 4
%fro = alloca i32, align 4
%x = alloca [4 x i32], align 16
%vararg = alloca %"int[]", align 8
%z = alloca %"int[]", align 8
%de = alloca [3 x i32], align 4
%vararg14 = alloca %"int[]", align 8
%vararg20 = alloca %"int[]", align 8
%vararg26 = alloca %"int[]", align 8
%varargslots = alloca [4 x i32], align 16
%vararg32 = alloca %"int[]", align 8
%varargslots33 = alloca [1 x i32], align 4
%vararg39 = alloca %"int[]", align 8
%a1 = alloca i32 (double, %Bobo*)*, align 8
%b2 = alloca i32 (double, %Bobo*)*, align 8
%0 = call i32 @test.test_static()
%1 = call i32 @test.test_static()
%2 = call i32 @test.test_static()
call void @hello_world.hello()
%3 = bitcast %LinkedList* %list to i8*
call void @llvm.memset.p0i8.i64(i8* align 8 %3, i8 0, i64 24, i1 false)
call void @"std::array::linkedlist.int.LinkedList__push"(%LinkedList* %list, i32 10)
call void @"std::array::linkedlist.int.LinkedList__push"(%LinkedList* %list, i32 15)
call void @"std::array::linkedlist.int.LinkedList__push"(%LinkedList* %list, i32 30)
store i32 0, i32* %i, align 4
br label %for.cond
%4 = load i32, i32* %i, align 4
%5 = call i64 @"std::array::linkedlist.int.LinkedList__len"(%LinkedList* %list)
%uisitrunc = trunc i64 %5 to i32
%lt = icmp slt i32 %4, %uisitrunc
br i1 %lt, label %for.body, label %for.exit
%6 = load i32, i32* %i, align 4
%7 = load i32, i32* %i, align 4
%siuiext = zext i32 %7 to i64
%8 = call i32 @"std::array::linkedlist.int.LinkedList__get"(%LinkedList* %list, i64 %siuiext)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i32 %6, i32 %8)
br label %for.inc
%10 = load i32, i32* %i, align 4
%add = add i32 %10, 1
store i32 %add, i32* %i, align 4
br label %for.cond
call void @"std::array::linkedlist.int.LinkedList__free"(%LinkedList* %list)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i32 0, i32 0), i32 -5, i32 14, i32 3)
store i32 14, i32* %max, align 4
store i32 -5, i32* %min, align 4
store i32 3, i32* %elements, align 4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0))
%13 = bitcast %List* %array to i8*
call void @llvm.memset.p0i8.i64(i8* align 8 %13, i8 0, i64 24, i1 false)
call void @"std::array::list.int.List__append"(%List* %array, i32 100)
call void @"std::array::list.int.List__append"(%List* %array, i32 200)
call void @"std::array::list.int.List__append"(%List* %array, i32 400)
call void @"std::array::list.int.List__push"(%List* %array, i32 600)
call void @"std::array::list.int.List__insertAt"(%List* %array, i64 2, i32 300)
store i32 0, i32* %i1, align 4
br label %for.cond2
%14 = load i32, i32* %i1, align 4
%15 = call i64 @"std::array::list.int.List__len"(%List* %array)
%uisitrunc3 = trunc i64 %15 to i32
%lt4 = icmp slt i32 %14, %uisitrunc3
br i1 %lt4, label %for.body5, label %for.exit9
%16 = load i32, i32* %i1, align 4
%17 = load i32, i32* %i1, align 4
%siuiext6 = zext i32 %17 to i64
%18 = call i32 @"std::array::list.int.List__get"(%List* %array, i64 %siuiext6)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i32 0, i32 0), i32 %16, i32 %18)
br label %for.inc7
%20 = load i32, i32* %i1, align 4
%add8 = add i32 %20, 1
store i32 %add8, i32* %i1, align 4
br label %for.cond2
call void @"std::array::list.int.List__free"(%List* %array)
%21 = bitcast %Blob* %a to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %21, i8* align 4 bitcast (%Blob* @.__const.6 to i8*), i32 4, i1 false)
%22 = bitcast %Blob.0* %b to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %22, i8* align 8 bitcast (%Blob.0* @.__const.7 to i8*), i32 8, i1 false)
%23 = bitcast %Blob* %a to i32*
%coerced = load i32, i32* %23, align 4
%24 = call i32 @test2.int.getValue(i32 %coerced)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i32 %24)
%26 = bitcast %Blob.0* %b to double*
%coerced10 = load double, double* %26, align 8
%27 = call double @test2.double.getValue(double %coerced10)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), double %27)
%29 = call i32 @test2.int.getMult(i32 25)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i32 0, i32 0), i32 %29)
%31 = call double @test2.double.getMult(double 3.300000e+00)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i32 0, i32 0), double %31)
call void @test.helloWorld()
%33 = bitcast %Foo* %ddx to i8*
call void @llvm.memset.p0i8.i64(i8* align 4 %33, i8 0, i64 8, i1 false)
store i32 3, i32* %fro, align 4
%34 = bitcast [4 x i32]* %x to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %34, i8* align 16 bitcast ([4 x i32]* @.__const.12 to i8*), i32 16, i1 false)
%35 = load i32, i32* %fro, align 4
%36 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 1
%37 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 0
store i64 4, i64* %36, align 8
%38 = bitcast [4 x i32]* %x to i32*
store i32* %38, i32** %37, align 8
%casttemp = bitcast %"int[]"* %vararg to { i64, i8* }*
%lo = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp, i32 0, i32 0
%lo11 = load i64, i64* %lo, align 8
%hi = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp, i32 0, i32 1
%hi12 = load i8*, i8** %hi, align 8
%39 = call i32 @test.sum_us(i64 %lo11, i8* %hi12)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i32 0, i32 0), i32 %39)
%add13 = add i32 %35, %40
store i32 %add13, i32* %fro, align 4
%41 = load i32, i32* %fro, align 4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i32 %41)
%43 = bitcast [4 x i32]* %x to i32*
%44 = insertvalue %"int[]" undef, i32* %43, 0
%45 = insertvalue %"int[]" %44, i64 4, 1
store %"int[]" %45, %"int[]"* %z, align 8
%46 = bitcast [3 x i32]* %de to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %46, i8* align 4 bitcast ([3 x i32]* @.__const.15 to i8*), i32 12, i1 false)
%47 = getelementptr inbounds %"int[]", %"int[]"* %vararg14, i32 0, i32 1
%48 = getelementptr inbounds %"int[]", %"int[]"* %vararg14, i32 0, i32 0
store i64 4, i64* %47, align 8
%49 = bitcast [4 x i32]* %x to i32*
store i32* %49, i32** %48, align 8
%casttemp15 = bitcast %"int[]"* %vararg14 to { i64, i8* }*
%lo16 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp15, i32 0, i32 0
%lo17 = load i64, i64* %lo16, align 8
%hi18 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp15, i32 0, i32 1
%hi19 = load i8*, i8** %hi18, align 8
%50 = call i32 @test.sum_us(i64 %lo17, i8* %hi19)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i32 0, i32 0), i32 %50)
%52 = getelementptr inbounds %"int[]", %"int[]"* %vararg20, i32 0, i32 1
%53 = getelementptr inbounds %"int[]", %"int[]"* %vararg20, i32 0, i32 0
%casttemp21 = bitcast %"int[]"* %z to { i64, i8* }*
%lo22 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp21, i32 0, i32 0
%lo23 = load i64, i64* %lo22, align 8
%hi24 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp21, i32 0, i32 1
%hi25 = load i8*, i8** %hi24, align 8
%54 = call i32 @test.sum_us(i64 %lo23, i8* %hi25)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i32 0, i32 0), i32 %54)
%56 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 0
store i32 1, i32* %56, align 4
%57 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 1
store i32 2, i32* %57, align 4
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 2
store i32 4, i32* %58, align 4
%59 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 3
store i32 5, i32* %59, align 4
%60 = getelementptr inbounds %"int[]", %"int[]"* %vararg26, i32 0, i32 1
store i64 4, i64* %60, align 8
%61 = getelementptr inbounds %"int[]", %"int[]"* %vararg26, i32 0, i32 0
%62 = bitcast [4 x i32]* %varargslots to i32*
store i32* %62, i32** %61, align 8
%casttemp27 = bitcast %"int[]"* %vararg26 to { i64, i8* }*
%lo28 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp27, i32 0, i32 0
%lo29 = load i64, i64* %lo28, align 8
%hi30 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp27, i32 0, i32 1
%hi31 = load i8*, i8** %hi30, align 8
%63 = call i32 @test.sum_us(i64 %lo29, i8* %hi31)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i32 0, i32 0), i32 %63)
%65 = getelementptr inbounds [1 x i32], [1 x i32]* %varargslots33, i64 0, i64 0
store i32 1, i32* %65, align 4
%66 = getelementptr inbounds %"int[]", %"int[]"* %vararg32, i32 0, i32 1
store i64 1, i64* %66, align 8
%67 = getelementptr inbounds %"int[]", %"int[]"* %vararg32, i32 0, i32 0
%68 = bitcast [1 x i32]* %varargslots33 to i32*
store i32* %68, i32** %67, align 8
%casttemp34 = bitcast %"int[]"* %vararg32 to { i64, i8* }*
%lo35 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp34, i32 0, i32 0
%lo36 = load i64, i64* %lo35, align 8
%hi37 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp34, i32 0, i32 1
%hi38 = load i8*, i8** %hi37, align 8
%69 = call i32 @test.sum_us(i64 %lo36, i8* %hi38)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i32 0, i32 0), i32 %69)
%71 = getelementptr inbounds %"int[]", %"int[]"* %vararg39, i32 0, i32 1
store i64 0, i64* %71, align 8
%casttemp40 = bitcast %"int[]"* %vararg39 to { i64, i8* }*
%lo41 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp40, i32 0, i32 0
%lo42 = load i64, i64* %lo41, align 8
%hi43 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %casttemp40, i32 0, i32 1
%hi44 = load i8*, i8** %hi43, align 8
%72 = call i32 @test.sum_us(i64 %lo42, i8* %hi44)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i32 0, i32 0), i32 %72)
store i32 (double, %Bobo*)* null, i32 (double, %Bobo*)** %a1, align 8
store i32 (double, %Bobo*)* null, i32 (double, %Bobo*)** %b2, align 8
ret void
}
// #expect: hello_world.ll
define void @hello_world.hello()
entry:
%0 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0))
%1 = call double @foo.double.check(double 1.110000e+01)
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), double %1)
ret void
// #expect: foo.double.ll
define double @foo.double.check(double %0)
entry:
%i = alloca double, align 8
store double %0, double* %i, align 8
%1 = load double, double* %i, align 8
%2 = load double, double* %i, align 8
%fmul = fmul double %1, %2
ret double %fmul
// #expect: test2.int.ll
%Blob = type { i32 }
@test2.int.argh = global i32 234, align 4
define i32 @test2.int.getMult(i32 %0)
entry:
%a = alloca i32, align 4
store i32 %0, i32* %a, align 4
%1 = load i32, i32* %a, align 4
%2 = load i32, i32* %a, align 4
%mul = mul i32 %1, %2
ret i32 %mul
define i32 @test2.int.hello()
entry:
ret i32 1
}
define i32 @test2.int.getValue(i32 %0)
entry:
%blob = alloca %Blob, align 4
%coerce = bitcast %Blob* %blob to i32*
store i32 %0, i32* %coerce, align 4
%1 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
%2 = load i32, i32* %1, align 4
ret i32 %2
// #expect: test2.double.ll
%Blob = type { double }
@test2.double.argh = global double 2.340000e+02, align 8
define double @test2.double.getMult(double %0)
entry:
%a = alloca double, align 8
store double %0, double* %a, align 8
%1 = load double, double* %a, align 8
%2 = load double, double* %a, align 8
%fmul = fmul double %1, %2
ret double %fmul
define i32 @test2.double.hello()
entry:
ret i32 1
define double @test2.double.getValue(double %0)
entry:
%blob = alloca %Blob, align 8
%coerce = bitcast %Blob* %blob to double*
store double %0, double* %coerce, align 8
%1 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
%2 = load double, double* %1, align 8
ret double %2