From 3268f2e61dcf2132570f5e36147a67bc25355a40 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 30 Apr 2023 09:55:24 +0000 Subject: [PATCH] Only check that StorageLive dominates address-taking. --- compiler/rustc_mir_transform/src/ssa.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index d7fc6e2f6c3..fe2e79a4fc1 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -7,7 +7,7 @@ //! //! We say a local has a stable address if its address has SSA-like properties: //! 1/ It has a single `StorageLive` statement, or none at all (always-live); -//! 2/ All its uses dominate this `StorageLive` statement. +//! 2/ This `StorageLive` statement dominates all statements that take this local's address. //! //! We do not discard borrowed locals from this analysis, as we cannot take their address' address. @@ -247,7 +247,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { // Only record if SSA-like, to avoid growing the vector needlessly. self.assignment_order.push(local); } - self.dominators.check_dominates(&mut self.storage_live[local], loc); } // Anything can happen with raw pointers, so remove them. // We do not verify that all uses of the borrow dominate the assignment to `local`, @@ -264,7 +263,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { } PlaceContext::NonMutatingUse(_) => { self.dominators.check_dominates(&mut self.assignments[local], loc); - self.dominators.check_dominates(&mut self.storage_live[local], loc); self.direct_uses[local] += 1; } PlaceContext::NonUse(NonUseContext::StorageLive) => { @@ -283,7 +281,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { self.visit_projection(place.as_ref(), new_ctxt, loc); self.dominators.check_dominates(&mut self.assignments[place.local], loc); - self.dominators.check_dominates(&mut self.storage_live[place.local], loc); } return; } else {