Skip to content

Commit

Permalink
chore: run RangeOptimizer after MergeExpressionsOptimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jan 13, 2025
1 parent a1d051d commit b2bdfbb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion acvm-repo/acvm/src/compiler/transformers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ pub use csat::MIN_EXPRESSION_WIDTH;
use tracing::info;

use super::{
optimizers::MergeExpressionsOptimizer, transform_assert_messages, AcirTransformationMap,
optimizers::{MergeExpressionsOptimizer, RangeOptimizer},
transform_assert_messages, AcirTransformationMap,
};

/// We need multiple passes to stabilize the output.
Expand Down Expand Up @@ -227,6 +228,12 @@ fn transform_internal_once<F: AcirField>(
..acir
};

// The `MergeOptimizer` can merge two witnesses which have range opcodes applied to them
// so we run the `RangeOptimizer` afterwards to clear these up.
let range_optimizer = RangeOptimizer::new(acir);
let (acir, new_acir_opcode_positions) =
range_optimizer.replace_redundant_ranges(new_acir_opcode_positions);

(acir, new_acir_opcode_positions)
}

Expand Down

0 comments on commit b2bdfbb

Please sign in to comment.