about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2024-02-25 00:47:49 -0500
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2024-03-05 19:11:11 -0500
commitefe5a40f2b6b1f748a966a7e1da1903ed1b8cb58 (patch)
tree08666703782fa5bf94e0922394d6d4a81efb257d /compiler
parentb6d2d841bcf4b77343b159f134c7d39c2dd4ceaa (diff)
downloadrust-efe5a40f2b6b1f748a966a7e1da1903ed1b8cb58.tar.gz
rust-efe5a40f2b6b1f748a966a7e1da1903ed1b8cb58.zip
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.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/rvalue.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index f7ff36c0467..9ae82d4845e 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -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