summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-05-07 14:58:40 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-05-13 10:17:28 +0000
commit19652377c3f056aa0db32b8586e5a707b965a90d (patch)
tree1e68400801debbf1d36da6817ad501678033fe3b /compiler
parent25ef27759442b84c90af08dba348611b04d10654 (diff)
downloadrust-19652377c3f056aa0db32b8586e5a707b965a90d.tar.gz
Iterate ReferencePropagation to fixpoint.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir_transform/src/ref_prop.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs
index 0c5e7348e04..b0f89393989 100644
--- a/compiler/rustc_mir_transform/src/ref_prop.rs
+++ b/compiler/rustc_mir_transform/src/ref_prop.rs
@@ -77,11 +77,11 @@ impl<'tcx> MirPass<'tcx> for ReferencePropagation {
#[instrument(level = "trace", skip(self, tcx, body))]
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
debug!(def_id = ?body.source.def_id());
- propagate_ssa(tcx, body);
+ while propagate_ssa(tcx, body) {}
}
}
-fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
let ssa = SsaLocals::new(body);
let mut replacer = compute_replacement(tcx, body, &ssa);
@@ -94,6 +94,8 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
if replacer.any_replacement {
crate::simplify::remove_unused_definitions(body);
}
+
+ replacer.any_replacement
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]