aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-20 00:15:03 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-20 20:25:12 +0200
commit08a00f0d1ce477c2c57072b9b0e27eb36a73092a (patch)
tree95fa6b00950afd6c288c07e9c3eea508756f2dd7 /src/codegen/llvm.zig
parent835a1f7f0cfb6fdefdb7a6a3d3a6e04eafeb96d0 (diff)
downloadzig-08a00f0d1ce477c2c57072b9b0e27eb36a73092a.tar.gz
zig-08a00f0d1ce477c2c57072b9b0e27eb36a73092a.zip
llvm: use alignment of ABI return type when it differs from raw return type
This would previously cause miscompilations when the ABI type had bigger alignment than the raw type.
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index afafda36a6..0da0ef18e2 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -4876,7 +4876,7 @@ pub const FuncGen = struct {
// In this case the function return type is honoring the calling convention by having
// a different LLVM type than the usual one. We solve this here at the callsite
// by bitcasting a pointer to our canonical type, then loading it if necessary.
- const alignment = return_type.abiAlignment(target);
+ const alignment = self.dg.object.target_data.abiAlignmentOfType(abi_ret_ty);
const rp = self.buildAlloca(llvm_ret_ty, alignment);
const ptr_abi_ty = abi_ret_ty.pointerType(0);
const casted_ptr = self.builder.buildBitCast(rp, ptr_abi_ty, "");