// #target: x64-darwin module foo; struct Bar { int x; struct { struct { int y; } } bitstruct : uint { int ww : 2..10; } } struct Foo { struct { struct { int x; } struct { int y; } int z; } int w; } extern fn void printf(char*, ...); fn void main() { Bar b = { 1, 2, -5 }; printf("%d %d\n", b.y, b.ww); Foo f = { 5, 6, 7, 8 }; printf("%d %d %d %d\n", f.x, f.y, f.z, f.w); } /* #expect: foo.ll define void @main() #0 { entry: %b = alloca %Bar, align 4 %f = alloca %Foo, align 4 %0 = bitcast %Bar* %b to i8* call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 bitcast (%Bar* @.__const to i8*), i32 12, i1 false) %1 = getelementptr inbounds %Bar, %Bar* %b, i32 0, i32 1 %2 = getelementptr inbounds %anon, %anon* %1, i32 0, i32 0 %3 = getelementptr inbounds %anon.0, %anon.0* %2, i32 0, i32 0 %4 = load i32, i32* %3, align 4 %5 = getelementptr inbounds %Bar, %Bar* %b, i32 0, i32 2 %6 = load i32, i32* %5, align 4 %7 = shl i32 %6, 21 %8 = ashr i32 %7, 23 call void (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i32 %4, i32 %8) %9 = bitcast %Foo* %f to i8* call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %9, i8* align 4 bitcast (%Foo* @.__const.5 to i8*), i32 16, i1 false) %10 = getelementptr inbounds %Foo, %Foo* %f, i32 0, i32 0 %11 = getelementptr inbounds %anon.1, %anon.1* %10, i32 0, i32 0 %12 = getelementptr inbounds %anon.2, %anon.2* %11, i32 0, i32 0 %13 = load i32, i32* %12, align 4 %14 = getelementptr inbounds %Foo, %Foo* %f, i32 0, i32 0 %15 = getelementptr inbounds %anon.1, %anon.1* %14, i32 0, i32 1 %16 = getelementptr inbounds %anon.3, %anon.3* %15, i32 0, i32 0 %17 = load i32, i32* %16, align 4 %18 = getelementptr inbounds %Foo, %Foo* %f, i32 0, i32 0 %19 = getelementptr inbounds %anon.1, %anon.1* %18, i32 0, i32 2 %20 = load i32, i32* %19, align 4 %21 = getelementptr inbounds %Foo, %Foo* %f, i32 0, i32 1 %22 = load i32, i32* %21, align 4 call void (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i32 %13, i32 %17, i32 %20, i32 %22) ret void }