about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/points.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-07 18:19:04 +0200
committerGitHub <noreply@github.com>2025-05-07 18:19:04 +0200
commit82c99c41c0dc8692bb2261f16962ccf65b38c7ad (patch)
tree72b1b6213908af945a1c5ff8c36e4d9c89f96bd0 /compiler/rustc_mir_dataflow/src/points.rs
parent3ef8e64ce9f72ee8d600d55bc43b36eed069b252 (diff)
parent92799b6f89d2d9bbfcb9b11d1bac57899d0bc435 (diff)
downloadrust-82c99c41c0dc8692bb2261f16962ccf65b38c7ad.tar.gz
rust-82c99c41c0dc8692bb2261f16962ccf65b38c7ad.zip
Rollup merge of #140234 - nnethercote:separate-Analysis-and-Results, r=davidtwco
Separate dataflow analysis and results

`Analysis` gets put into `Results` with `EntryStates`, by `iterate_to_fixpoint`. This has two problems:
- `Results` is passed various places where only `Analysis` is needed.
- `EntryStates` is passed around mutably everywhere even though it is immutable.

This commit mostly separates `Analysis` from `Results` and fixes these two problems.

r? `@davidtwco`
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/points.rs')
-rw-r--r--compiler/rustc_mir_dataflow/src/points.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_dataflow/src/points.rs b/compiler/rustc_mir_dataflow/src/points.rs
index 21590ff1bba..70d1a34b5fb 100644
--- a/compiler/rustc_mir_dataflow/src/points.rs
+++ b/compiler/rustc_mir_dataflow/src/points.rs
@@ -98,7 +98,8 @@ rustc_index::newtype_index! {
 pub fn save_as_intervals<'tcx, N, A>(
     elements: &DenseLocationMap,
     body: &mir::Body<'tcx>,
-    mut results: Results<'tcx, A>,
+    mut analysis: A,
+    results: Results<A::Domain>,
 ) -> SparseIntervalMatrix<N, PointIndex>
 where
     N: Idx,
@@ -109,7 +110,8 @@ where
     visit_results(
         body,
         body.basic_blocks.reverse_postorder().iter().copied(),
-        &mut results,
+        &mut analysis,
+        &results,
         &mut visitor,
     );
     visitor.values
@@ -127,7 +129,7 @@ where
 {
     fn visit_after_primary_statement_effect<'mir>(
         &mut self,
-        _results: &mut Results<'tcx, A>,
+        _analysis: &mut A,
         state: &A::Domain,
         _statement: &'mir mir::Statement<'tcx>,
         location: Location,
@@ -141,7 +143,7 @@ where
 
     fn visit_after_primary_terminator_effect<'mir>(
         &mut self,
-        _results: &mut Results<'tcx, A>,
+        _analysis: &mut A,
         state: &A::Domain,
         _terminator: &'mir mir::Terminator<'tcx>,
         location: Location,