From 9c4c47778101b09d28b4a782f8035f871d4a4261 Mon Sep 17 00:00:00 2001 From: Tom French Date: Wed, 8 Jan 2025 23:25:10 +0000 Subject: [PATCH] chore: mark casts as able to be deduplicated --- 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 { .. }