llvm: fix lowering of non-byte-aligned field pointers

* When a field starts at some bit offset within a byte you need to load
   starting from that byte and shift, not starting from the next byte,
   so a rounded-down divide is required here, not a rounded-up one.
 * Remove paragraph from doc that no longer relates to anything.

Closes #12363
This commit is contained in:
Jacob Young
2022-10-15 03:31:17 -04:00
committed by Andrew Kelley
parent c7f9833238
commit f9192adaba
2 changed files with 1 additions and 6 deletions

View File

@@ -3943,7 +3943,7 @@ pub const DeclGen = struct {
}
break :b b;
};
const byte_offset = llvm_usize.constInt((prev_bits + 7) / 8, .False);
const byte_offset = llvm_usize.constInt(prev_bits / 8, .False);
const field_addr = base_addr.constAdd(byte_offset);
bitcast_needed = false;
const final_llvm_ty = (try dg.lowerType(ptr_child_ty)).pointerType(0);