From fcc90dbb8eaf6b829c937f2934012b427d4c33f1 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Tue, 28 Nov 2023 11:41:32 -0600 Subject: [PATCH] IncrementRC has no side effects? --- compiler/noirc_evaluator/src/ssa/ir/instruction.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction.rs index 63b32766f62..644d801444c 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction.rs @@ -275,10 +275,15 @@ impl Instruction { | ArrayGet { .. } | ArraySet { .. } => false, + // IncrementRc is not counted as having side effects since we still + // want it to be removed by the DIE pass if its parameter is unused. + // At the time of writing has_side_effects is only used by DIE but + // we should keep this in mind (or rename this method?) if it is ever used elsewhere. + IncrementRc { .. } => false, + Constrain(..) | Store { .. } | EnableSideEffects { .. } - | IncrementRc { .. } | RangeCheck { .. } => true, // Some `Intrinsic`s have side effects so we must check what kind of `Call` this is.