about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-30 00:35:19 +0000
committerbors <bors@rust-lang.org>2023-06-30 00:35:19 +0000
commit8aed93d912ec23819c08e9a89ca1fb461b3cd2e6 (patch)
treecf08613768e315951133c7494e2487cebd22c598 /compiler/rustc_mir_transform/src
parent330727467b8fdf2c43b95095a0efae7012c4f83b (diff)
parent7e786e81b00cf48a664084d30d4f82f408825397 (diff)
downloadrust-8aed93d912ec23819c08e9a89ca1fb461b3cd2e6.tar.gz
rust-8aed93d912ec23819c08e9a89ca1fb461b3cd2e6.zip
Auto merge of #113116 - nnethercote:codegen-opts, r=oli-obk
A mish-mash of micro-optimizations

These were aimed at speeding up LLVM codegen, but ended up affecting other places as well.

r? `@bjorn3`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/deref_separator.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs
index a39026751a7..95898b5b73c 100644
--- a/compiler/rustc_mir_transform/src/deref_separator.rs
+++ b/compiler/rustc_mir_transform/src/deref_separator.rs
@@ -8,13 +8,13 @@ use rustc_middle::ty::TyCtxt;
 
 pub struct Derefer;
 
-pub struct DerefChecker<'tcx> {
+pub struct DerefChecker<'a, 'tcx> {
     tcx: TyCtxt<'tcx>,
     patcher: MirPatch<'tcx>,
-    local_decls: IndexVec<Local, LocalDecl<'tcx>>,
+    local_decls: &'a IndexVec<Local, LocalDecl<'tcx>>,
 }
 
-impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
+impl<'a, 'tcx> MutVisitor<'tcx> for DerefChecker<'a, 'tcx> {
     fn tcx(&self) -> TyCtxt<'tcx> {
         self.tcx
     }
@@ -36,7 +36,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
 
             for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() {
                 if !p_ref.projection.is_empty() && p_elem == ProjectionElem::Deref {
-                    let ty = p_ref.ty(&self.local_decls, self.tcx).ty;
+                    let ty = p_ref.ty(self.local_decls, self.tcx).ty;
                     let temp = self.patcher.new_internal_with_info(
                         ty,
                         self.local_decls[p_ref.local].source_info.span,
@@ -70,7 +70,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
 
 pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
     let patch = MirPatch::new(body);
-    let mut checker = DerefChecker { tcx, patcher: patch, local_decls: body.local_decls.clone() };
+    let mut checker = DerefChecker { tcx, patcher: patch, local_decls: &body.local_decls };
 
     for (bb, data) in body.basic_blocks.as_mut_preserves_cfg().iter_enumerated_mut() {
         checker.visit_basic_block_data(bb, data);