Optimize sret / byval. Fixes to types and failables.

This commit is contained in:
Christoffer Lerno
2022-10-15 02:36:07 +02:00
committed by Christoffer Lerno
parent dfe3128b16
commit 160659c4e3
44 changed files with 520 additions and 618 deletions

View File

@@ -24,11 +24,7 @@ fn void test(Bar b)
define void @foo_test(%Bar* byval(%Bar) align 8 %0) #0 {
entry:
%b = alloca %Bar, align 4
%1 = bitcast %Bar* %b to i8*
%2 = bitcast %Bar* %0 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 8 %2, i32 8, i1 false)
%3 = getelementptr inbounds %Bar, %Bar* %b, i32 0, i32 2
%4 = getelementptr inbounds [0 x i32], [0 x i32]* %3, i64 0, i64 1
%1 = getelementptr inbounds %Bar, %Bar* %0, i32 0, i32 2
%2 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 1
ret void
}

View File

@@ -1,7 +1,7 @@
define Foo = int[0];
define Foo = int[0]; // #error: An array may not have zero
struct Bar
{
Foo x; // #error: Zero length arrays are not valid members.
Foo x;
int b;
}