|
68 | 68 | //! |
69 | 69 | //! # Interaction with Other Passes |
70 | 70 | //! |
71 | | -//! This pass runs after [`Sroa`], which resolves places through the data dependency graph. SROA |
72 | | -//! ensures that operands are simplified to their canonical forms before [`InstSimplify`] runs, so |
73 | | -//! constants that flow through assignments or block parameters are already exposed. |
| 71 | +//! This pass runs after [`ForwardSubstitution`], which resolves places through the data dependency |
| 72 | +//! graph. Forward substitution ensures that operands are simplified to their canonical forms before |
| 73 | +//! [`InstSimplify`] runs, so constants that flow through assignments or block parameters are |
| 74 | +//! already exposed. |
74 | 75 | //! |
75 | | -//! Block parameter propagation in this pass complements SROA: while SROA resolves structural |
76 | | -//! dependencies at the operand level, [`InstSimplify`] propagates constants discovered through |
77 | | -//! folding across block boundaries. |
| 76 | +//! Block parameter propagation in this pass complements forward substitution: while forward |
| 77 | +//! substitution resolves structural dependencies at the operand level, [`InstSimplify`] propagates |
| 78 | +//! constants discovered through folding across block boundaries. |
78 | 79 | //! |
79 | 80 | //! # Limitations |
80 | 81 | //! |
|
84 | 85 | //! iterating until the `evaluated` map stabilizes, which is not implemented as the expected |
85 | 86 | //! benefit is low. |
86 | 87 | //! |
87 | | -//! [`Sroa`]: super::Sroa |
| 88 | +//! [`ForwardSubstitution`]: super::ForwardSubstitution |
88 | 89 | #[cfg(test)] |
89 | 90 | mod tests; |
90 | 91 |
|
@@ -460,7 +461,8 @@ impl<'heap, A: Allocator> VisitorMut<'heap> for InstSimplifyVisitor<'_, 'heap, A |
460 | 461 | Binary { op, left, right }: &mut Binary<'heap>, |
461 | 462 | ) -> Self::Result<()> { |
462 | 463 | // Dispatch to the appropriate simplification based on operand classification. |
463 | | - // SROA has already resolved structural dependencies, so constants are directly visible. |
| 464 | + // Forward substitution has already resolved structural dependencies, so constants are |
| 465 | + // directly visible. |
464 | 466 | match (self.try_eval(*left), self.try_eval(*right)) { |
465 | 467 | (OperandKind::Int(lhs), OperandKind::Int(rhs)) => { |
466 | 468 | let result = Self::eval_bin_op(lhs, *op, rhs); |
|
0 commit comments