| ... | @@ -1408,11 +1408,7 @@ pub const Object = struct { | ... | @@ -1408,11 +1408,7 @@ pub const Object = struct { |
| 1408 | llvm_arg_i += 1; | 1408 | llvm_arg_i += 1; |
| 1409 | | 1409 | |
| 1410 | const param_llvm_ty = try o.lowerType(param_ty); | 1410 | const param_llvm_ty = try o.lowerType(param_ty); |
| 1411 | const int_llvm_ty = try o.builder.intType(@intCast(param_ty.abiSize(mod) * 8)); | 1411 | const alignment = Builder.Alignment.fromByteUnits(param_ty.abiAlignment(mod)); |
| 1412 | const alignment = Builder.Alignment.fromByteUnits(@max( | | |
| 1413 | param_ty.abiAlignment(mod), | | |
| 1414 | o.target_data.abiAlignmentOfType(int_llvm_ty.toLlvm(&o.builder)), | | |
| 1415 | )); | | |
| 1416 | const arg_ptr = try buildAllocaInner(&wip, false, param_llvm_ty, alignment, target); | 1412 | const arg_ptr = try buildAllocaInner(&wip, false, param_llvm_ty, alignment, target); |
| 1417 | _ = try wip.store(.normal, param, arg_ptr, alignment); | 1413 | _ = try wip.store(.normal, param, arg_ptr, alignment); |
| 1418 | | 1414 | |
| ... | @@ -4938,10 +4934,7 @@ pub const FuncGen = struct { | ... | @@ -4938,10 +4934,7 @@ pub const FuncGen = struct { |
| 4938 | } else { | 4934 | } else { |
| 4939 | // LLVM does not allow bitcasting structs so we must allocate | 4935 | // LLVM does not allow bitcasting structs so we must allocate |
| 4940 | // a local, store as one type, and then load as another type. | 4936 | // a local, store as one type, and then load as another type. |
| 4941 | const alignment = Builder.Alignment.fromByteUnits(@max( | 4937 | const alignment = Builder.Alignment.fromByteUnits(param_ty.abiAlignment(mod)); |
| 4942 | param_ty.abiAlignment(mod), | | |
| 4943 | o.target_data.abiAlignmentOfType(int_llvm_ty.toLlvm(&o.builder)), | | |
| 4944 | )); | | |
| 4945 | const int_ptr = try self.buildAlloca(int_llvm_ty, alignment); | 4938 | const int_ptr = try self.buildAlloca(int_llvm_ty, alignment); |
| 4946 | _ = try self.wip.store(.normal, llvm_arg, int_ptr, alignment); | 4939 | _ = try self.wip.store(.normal, llvm_arg, int_ptr, alignment); |
| 4947 | const loaded = try self.wip.load(.normal, int_llvm_ty, int_ptr, alignment, ""); | 4940 | const loaded = try self.wip.load(.normal, int_llvm_ty, int_ptr, alignment, ""); |
| ... | @@ -5117,12 +5110,10 @@ pub const FuncGen = struct { | ... | @@ -5117,12 +5110,10 @@ pub const FuncGen = struct { |
| 5117 | // In this case the function return type is honoring the calling convention by having | 5110 | // In this case the function return type is honoring the calling convention by having |
| 5118 | // a different LLVM type than the usual one. We solve this here at the callsite | 5111 | // a different LLVM type than the usual one. We solve this here at the callsite |
| 5119 | // by using our canonical type, then loading it if necessary. | 5112 | // by using our canonical type, then loading it if necessary. |
| 5120 | const alignment = Builder.Alignment.fromByteUnits(@max( | 5113 | const alignment = Builder.Alignment.fromByteUnits(return_type.abiAlignment(mod)); |
| 5121 | o.target_data.abiAlignmentOfType(abi_ret_ty.toLlvm(&o.builder)), | 5114 | if (o.builder.useLibLlvm()) |
| 5122 | return_type.abiAlignment(mod), | 5115 | assert(o.target_data.abiSizeOfType(abi_ret_ty.toLlvm(&o.builder)) >= |
| 5123 | )); | 5116 | o.target_data.abiSizeOfType(llvm_ret_ty.toLlvm(&o.builder))); |
| 5124 | assert(o.target_data.abiSizeOfType(abi_ret_ty.toLlvm(&o.builder)) >= | | |
| 5125 | o.target_data.abiSizeOfType(llvm_ret_ty.toLlvm(&o.builder))); | | |
| 5126 | const rp = try self.buildAlloca(abi_ret_ty, alignment); | 5117 | const rp = try self.buildAlloca(abi_ret_ty, alignment); |
| 5127 | _ = try self.wip.store(.normal, call, rp, alignment); | 5118 | _ = try self.wip.store(.normal, call, rp, alignment); |
| 5128 | return if (isByRef(return_type, mod)) | 5119 | return if (isByRef(return_type, mod)) |