From 39af02fc618822fe0bca7df8ddb95f96413b2299 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Thu, 23 Jan 2025 13:59:47 -0500 Subject: [PATCH] fix(ssa): Resolve value before fetching from DFG in a couple cases (#7169) --- .../noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs | 4 ++-- compiler/noirc_evaluator/src/ssa/ir/dfg.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs index ec288a5cfd..97de1aea8c 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs @@ -1344,8 +1344,8 @@ impl<'block, Registers: RegisterAllocator> BrilligBlock<'block, Registers> { result_variable: SingleAddrVariable, ) { let binary_type = type_of_binary_operation( - dfg[binary.lhs].get_type().as_ref(), - dfg[binary.rhs].get_type().as_ref(), + dfg[dfg.resolve(binary.lhs)].get_type().as_ref(), + dfg[dfg.resolve(binary.rhs)].get_type().as_ref(), binary.operator, ); diff --git a/compiler/noirc_evaluator/src/ssa/ir/dfg.rs b/compiler/noirc_evaluator/src/ssa/ir/dfg.rs index 6b6740c4d2..8e87db15ca 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/dfg.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/dfg.rs @@ -508,7 +508,7 @@ impl DataFlowGraph { /// Should `value` be a numeric constant then this function will return the exact number of bits required, /// otherwise it will return the minimum number of bits based on type information. pub(crate) fn get_value_max_num_bits(&self, value: ValueId) -> u32 { - match self[value] { + match self[self.resolve(value)] { Value::Instruction { instruction, .. } => { let value_bit_size = self.type_of_value(value).bit_size(); if let Instruction::Cast(original_value, _) = self[instruction] {