From 526c84eb8bfa61d9a218c3c0bd623aff8a48f25f Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:28:25 +0000 Subject: [PATCH] chore: mark casts as able to be deduplicated (#6996) --- compiler/noirc_evaluator/src/ssa.rs | 2 +- compiler/noirc_evaluator/src/ssa/ir/instruction.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa.rs b/compiler/noirc_evaluator/src/ssa.rs index 2500b8685a1..4f0a5b72840 100644 --- a/compiler/noirc_evaluator/src/ssa.rs +++ b/compiler/noirc_evaluator/src/ssa.rs @@ -171,7 +171,7 @@ fn optimize_all(builder: SsaBuilder, options: &SsaEvaluatorOptions) -> Result true, + // Cast instructions can always be deduplicated + Cast(_, _) => true, + // Arrays can be mutated in unconstrained code so code that handles this case must // take care to track whether the array was possibly mutated or not before // deduplicating. Since we don't know if the containing pass checks for this, we @@ -484,7 +487,6 @@ impl Instruction { // with one that was disabled. See // https://github.com/noir-lang/noir/pull/4716#issuecomment-2047846328. Binary(_) - | Cast(_, _) | Not(_) | Truncate { .. } | IfElse { .. }