LLVM: fix lowering of structs with underaligned fields
When lowering a struct type to an LLVM struct type, keep track of whether there are any underaligned fields. If so, then make it a packed llvm struct. This works because we already insert manual padding bytes regardless. We could unconditionally use an LLVM packed struct; the reason we bother checking for underaligned fields is that it is a conservative choice, in case LLVM handles packed structs less optimally. A future improvement could simplify this code by unconditionally using packed LLVM structs and then make sure measure perf is unaffected. closes #12190
This commit is contained in:
@@ -3236,7 +3236,10 @@ pub const epoll_event = switch (builtin.zig_backend) {
|
||||
},
|
||||
else => extern struct {
|
||||
events: u32,
|
||||
data: epoll_data align(4),
|
||||
data: epoll_data align(switch (native_arch) {
|
||||
.x86_64 => 4,
|
||||
else => @alignOf(epoll_data),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ pub const Reactor = struct {
|
||||
};
|
||||
|
||||
test "reactor/linux: drive async tcp client/listener pair" {
|
||||
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
|
||||
if (native_os.tag != .linux) return error.SkipZigTest;
|
||||
|
||||
const ip = std.x.net.ip;
|
||||
|
||||
Reference in New Issue
Block a user