Skip to content

Commit

Permalink
Merge 06210b8 into e37798c
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Jan 11, 2024
2 parents e37798c + 06210b8 commit 916ece1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/noirc_evaluator/src/ssa/ir/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@ impl Instruction {
/// that value is returned. Otherwise None is returned.
fn simplify_cast(value: ValueId, dst_typ: &Type, dfg: &mut DataFlowGraph) -> SimplifyResult {
use SimplifyResult::*;
let value = dfg.resolve(value);

if let Value::Instruction { instruction, .. } = &dfg[value] {
if let Instruction::Cast(original_value, _) = &dfg[*instruction] {
return SimplifiedToInstruction(Instruction::Cast(*original_value, dst_typ.clone()));
}
}

if let Some(constant) = dfg.get_numeric_constant(value) {
let src_typ = dfg.type_of_value(value);
match (src_typ, dst_typ) {
Expand Down

0 comments on commit 916ece1

Please sign in to comment.