remove all-zero GEP

This always produces zero offset, regardless of what the struct layout
is.

Originally, this may have been necessary in order to change the pointer type,
but with opaque pointers, it is no longer necessary.
This commit is contained in:
Erik Desjardins 2024-02-25 00:47:49 -05:00
parent b6d2d841bc
commit efe5a40f2b

View File

@ -94,8 +94,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
if let OperandValue::Immediate(v) = cg_elem.val {
let zero = bx.const_usize(0);
let start = dest.project_index(bx, zero).llval;
let start = dest.llval;
let size = bx.const_usize(dest.layout.size.bytes());
// Use llvm.memset.p0i8.* to initialize all zero arrays