Skip to content

Commit 3c1ff4f

Browse files
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.
1 parent dbbb7de commit 3c1ff4f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
9494
}
9595

9696
if let OperandValue::Immediate(v) = cg_elem.val {
97-
let zero = bx.const_usize(0);
98-
let start = dest.project_index(bx, zero).llval;
97+
let start = dest.llval;
9998
let size = bx.const_usize(dest.layout.size.bytes());
10099

101100
// Use llvm.memset.p0i8.* to initialize all zero arrays

0 commit comments

Comments
 (0)