Skip to content

Commit

Permalink
feat: allow deduplicating Truncate and Not instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jan 9, 2025
1 parent ae9f2ae commit 9f68fb4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions compiler/noirc_evaluator/src/ssa/ir/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ impl Instruction {
// removed entirely.
Noop => true,

// Cast instructions can always be deduplicated
Cast(_, _) => true,
// These instructions can always be deduplicated
Cast(_, _) | Truncate { .. } | Not(_) => 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
Expand All @@ -486,12 +486,7 @@ impl Instruction {
// Replacing them with a similar instruction potentially enables replacing an instruction
// with one that was disabled. See
// https://github.com/noir-lang/noir/pull/4716#issuecomment-2047846328.
Binary(_)
| Not(_)
| Truncate { .. }
| IfElse { .. }
| ArrayGet { .. }
| ArraySet { .. } => {
Binary(_) | IfElse { .. } | ArrayGet { .. } | ArraySet { .. } => {
deduplicate_with_predicate || !self.requires_acir_gen_predicate(&function.dfg)
}
}
Expand Down

0 comments on commit 9f68fb4

Please sign in to comment.