From 4f641540d89bf10a31725aad239e5fed33a1a18c Mon Sep 17 00:00:00 2001 From: Joss Date: Fri, 21 Apr 2023 12:20:27 +0100 Subject: [PATCH 1/4] chore(ssa): Replace JmpIf with BrIf --- .../src/ssa_refactor/ir/instruction.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs index 33715b67293..ac9559ee5fa 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs @@ -126,12 +126,16 @@ impl Instruction { pub(crate) enum TerminatorInstruction { /// Control flow /// - /// Jump If + /// Branch If /// - /// Jumps to the specified `destination` with - /// arguments, if the condition - /// if the condition is true. - JmpIf { condition: ValueId, destination: BasicBlockId, arguments: BlockArguments }, + /// Branches to the specified `then_destination` with `arguments` if the condition is true, + /// otherwise branches to the `else_destination` with `arguments`. + BrIf { + condition: ValueId, + then_destination: BasicBlockId, + else_destination: BasicBlockId, + arguments: BlockArguments, + }, /// Unconditional Jump /// /// Jumps to specified `destination` with `arguments` From c7e1c774ddd4a4b8080231e4cd0a7892ffebad1b Mon Sep 17 00:00:00 2001 From: joss-aztec <94053499+joss-aztec@users.noreply.github.com> Date: Fri, 21 Apr 2023 12:33:49 +0100 Subject: [PATCH 2/4] chore(ssa): doc tweak Co-authored-by: kevaundray --- crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs index ac9559ee5fa..20561c8bbf1 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs @@ -128,8 +128,8 @@ pub(crate) enum TerminatorInstruction { /// /// Branch If /// - /// Branches to the specified `then_destination` with `arguments` if the condition is true, - /// otherwise branches to the `else_destination` with `arguments`. + /// If the condition is true: jump to the specified `then_destination` with `arguments`. + /// Otherwise, jump to the specified `else_destination` with `arguments`. BrIf { condition: ValueId, then_destination: BasicBlockId, From ad4226421a4c25da9c63195ee033a64b9a18f480 Mon Sep 17 00:00:00 2001 From: Joss Date: Fri, 21 Apr 2023 12:37:25 +0100 Subject: [PATCH 3/4] chore(ssa): cargo fmt --- crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs index 20561c8bbf1..7bb7fcbb111 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs @@ -128,8 +128,8 @@ pub(crate) enum TerminatorInstruction { /// /// Branch If /// - /// If the condition is true: jump to the specified `then_destination` with `arguments`. - /// Otherwise, jump to the specified `else_destination` with `arguments`. + /// If the condition is true: jump to the specified `then_destination` with `arguments`. + /// Otherwise, jump to the specified `else_destination` with `arguments`. BrIf { condition: ValueId, then_destination: BasicBlockId, From d99342458b320895c6abfbcc38b22501aa4d0068 Mon Sep 17 00:00:00 2001 From: Joss Date: Fri, 21 Apr 2023 16:27:34 +0100 Subject: [PATCH 4/4] chore(ssa): rename BrIf -> JmpIf --- crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs index 7bb7fcbb111..e3298532ce0 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs @@ -126,11 +126,11 @@ impl Instruction { pub(crate) enum TerminatorInstruction { /// Control flow /// - /// Branch If + /// Jump If /// /// If the condition is true: jump to the specified `then_destination` with `arguments`. /// Otherwise, jump to the specified `else_destination` with `arguments`. - BrIf { + JmpIf { condition: ValueId, then_destination: BasicBlockId, else_destination: BasicBlockId,