diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-04-04 17:14:53 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-04-05 19:34:38 +0000 |
| commit | 98255cc2424b8ad3de462dc4241e14e23b1aa5c5 (patch) | |
| tree | 2820fffabc80d3c95e1bcbb66907c968dac6642a /compiler/rustc_mir_transform/src | |
| parent | 7d47a910eba199e321a908cec62ee35bc41535e1 (diff) | |
| download | rust-98255cc2424b8ad3de462dc4241e14e23b1aa5c5.tar.gz rust-98255cc2424b8ad3de462dc4241e14e23b1aa5c5.zip | |
Comment logic around worklist.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop_lint.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index 99bdb831c75..942ccd5a9d1 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -675,10 +675,13 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> { && let Ok(constant) = value_const.try_to_int() && let Ok(constant) = constant.to_bits(constant.size()) { + // We managed to evaluate the discriminant, so we know we only need to visit + // one target. let target = targets.target_for_value(constant); self.worklist.push(target); return; } + // We failed to evaluate the discriminant, fallback to visiting all successors. } // None of these have Operands to const-propagate. TerminatorKind::Goto { .. } |
