about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJannis Christopher Köhl <mail@koehl.dev>2022-10-25 00:28:41 +0200
committerJannis Christopher Köhl <mail@koehl.dev>2022-11-07 10:35:25 +0100
commitf29533b4e031771dae471bff534e3cc03ab48cd4 (patch)
treeb7e51e9523dca9c7d92091b0c9e6e6e3a9707bb1
parentefc7ca8c7d7db6a14b04e9931c75ee3e61ca718f (diff)
downloadrust-f29533b4e031771dae471bff534e3cc03ab48cd4.tar.gz
rust-f29533b4e031771dae471bff534e3cc03ab48cd4.zip
Small documentation changes
-rw-r--r--compiler/rustc_mir_transform/src/dataflow_const_prop.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
index aae7fefd112..62b0902e60a 100644
--- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
+++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
@@ -1,6 +1,6 @@
 //! A constant propagation optimization pass based on dataflow analysis.
 //!
-//! Tracks places that have a scalar type.
+//! Currently, this pass only propagates scalar values.
 
 use rustc_const_eval::interpret::{ConstValue, ImmTy, Immediate, InterpCx, Scalar};
 use rustc_data_structures::fx::FxHashMap;
@@ -289,7 +289,13 @@ impl<'tcx> ConstAnalysis<'tcx> {
 struct CollectAndPatch<'tcx, 'map> {
     tcx: TyCtxt<'tcx>,
     map: &'map Map,
+
+    /// For a given MIR location, this stores the values of the operands used by that location. In
+    /// particular, this is before the effect, such that the operands of `_1 = _1 + _2` are
+    /// properly captured.
     before_effect: FxHashMap<(Location, Place<'tcx>), ScalarTy<'tcx>>,
+
+    /// Stores the assigned values for assignments where the Rvalue is constant.
     assignments: FxHashMap<Location, ScalarTy<'tcx>>,
 }