Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
//! ```text
//! Let G be a control flow graph. Let X and Y be nodes in G. Y is
//! control dependent on X iff
//! (1) there exists a directed path P from X to Y with any 2 in P (excluding X
//! and Y) post-dominated by Y and
//! (1) there exists a directed path P from X to Y with any Z in P (excluding X and Y) post-dominated by Y, and
//! (2) X is not post-dominated by Y.
//!
//! If Y is control dependent on X then X must have two exits. Following one of the
Expand Down
22 changes: 11 additions & 11 deletions compiler/noirc_evaluator/src/ssa/opt/unrolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ impl Loop {
/// ```text
/// brillig(inline) predicate_pure fn main f0 {
/// b0():
/// jmp b1(u32 10) // Pre-header
/// jmp b1(u32 1) // Pre-header
/// b1(v0: u32): // Header
/// v3 = lt v0, u32 20
/// jmpif v3 then: b2, else: b3
Expand Down Expand Up @@ -520,7 +520,7 @@ impl Loop {
/// v1 = 2
/// jmp loop_entry(v0)
/// loop_entry(i: Field):
/// v2 = lt i v1
/// v2 = lt i, v1
/// jmpif v2, then: loop_body, else: loop_end
/// ```
///
Expand All @@ -530,7 +530,7 @@ impl Loop {
/// main():
/// v0 = 0
/// v1 = 2
/// v2 = lt v0 v1
/// v2 = lt v0, v1
/// // jmpif v2, then: loop_body, else: loop_end
/// jmp dest: loop_body
/// ```
Expand All @@ -542,9 +542,9 @@ impl Loop {
/// main():
/// v0 = 0
/// v1 = 2
/// v2 = lt v0 v1
/// v2 = lt v0, v1
/// v3 = ... body ...
/// v4 = add 1, 0
/// v4 = add v0, u32 1
/// jmp loop_entry(v4)
/// ```
///
Expand All @@ -553,17 +553,17 @@ impl Loop {
/// main():
/// v0 = 0
/// v1 = 2
/// v2 = lt 0
/// v2 = lt v0, v1
/// v3 = ... body ...
/// v4 = add 1, v0
/// v5 = lt v4 v1
/// v4 = add u32 1, v0
/// v5 = lt v4, v1
/// v6 = ... body ...
/// v7 = add v4, 1
/// v8 = lt v5 v1
/// v7 = add v4, u32 1
/// v8 = lt v7, v1
/// jmp loop_end
/// ```
///
/// When e.g. `v8 = lt v5 v1` cannot be evaluated to a constant, the loop signals by returning `Err`
/// When e.g. `v8 = lt v7, v1` cannot be evaluated to a constant, the loop signals by returning `Err`
/// that a few SSA passes are required to evaluate and simplify these values.
fn unroll(&self, function: &mut Function, cfg: &ControlFlowGraph) -> Result<(), CallStack> {
let mut unroll_into = self.get_pre_header(function, cfg)?;
Expand Down
Loading