mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 01:15:14 +00:00
stage2: align store for vector-to-array bitcast in LLVM backend
This was causing a very rare segfault when LLVM would emit `vmovdqa` using an unaligned memory operand on the stack.
This commit is contained in:
parent
961248cde3
commit
4e357151a5
@ -5563,7 +5563,8 @@ pub const FuncGen = struct {
|
||||
if (bitcast_ok) {
|
||||
const llvm_vector_ty = try self.dg.llvmType(operand_ty);
|
||||
const casted_ptr = self.builder.buildBitCast(array_ptr, llvm_vector_ty.pointerType(0), "");
|
||||
_ = self.builder.buildStore(operand, casted_ptr);
|
||||
const llvm_store = self.builder.buildStore(operand, casted_ptr);
|
||||
llvm_store.setAlignment(inst_ty.abiAlignment(target));
|
||||
} else {
|
||||
// If the ABI size of the element type is not evenly divisible by size in bits;
|
||||
// a simple bitcast will not work, and we fall back to extractelement.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user