diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index c92dc54d..8e6e81ef 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -201,10 +201,7 @@ impl<'a> CodeGenerator<'a> { term, }; - // println!("Program: {}", program.to_pretty()); - program = aiken_optimize_and_intern(program); - // println!("Program After: {}", program.to_pretty()); // This is very important to call here. // If this isn't done, re-using the same instance diff --git a/crates/uplc/src/optimize/shrinker.rs b/crates/uplc/src/optimize/shrinker.rs index fcaeabca..e2c9d590 100644 --- a/crates/uplc/src/optimize/shrinker.rs +++ b/crates/uplc/src/optimize/shrinker.rs @@ -401,19 +401,16 @@ fn inline_single_occurrence_reducer( let delays = delayed_execution(body); - let is_recursive_call = false; - if occurrences == 1 { - if !is_recursive_call - && (delays == 0 - || matches!( - &arg_term, - Term::Var(_) - | Term::Constant(_) - | Term::Delay(_) - | Term::Lambda { .. } - | Term::Builtin(_), - )) + if delays == 0 + || matches!( + &arg_term, + Term::Var(_) + | Term::Constant(_) + | Term::Delay(_) + | Term::Lambda { .. } + | Term::Builtin(_), + ) { *body = substitute_term(body, parameter_name.clone(), &arg_term); @@ -447,27 +444,6 @@ fn inline_single_occurrence_reducer( } } -fn contains_recursive_call(body: &Term) -> bool { - match body { - Term::Delay(d) => contains_recursive_call(d.as_ref()), - Term::Lambda { body, .. } => contains_recursive_call(body.as_ref()), - Term::Apply { function, argument } => { - contains_recursive_call(function.as_ref()) - || contains_recursive_call(argument.as_ref()) - || { - let func = function.as_ref(); - let arg = argument.as_ref(); - - matches!(func, Term::Var(_)) && *func == *arg - } - } - Term::Force(f) => contains_recursive_call(f.as_ref()), - Term::Case { .. } => todo!(), - Term::Constr { .. } => todo!(), - _ => false, - } -} - fn cast_data_reducer(term: &mut Term) { match term { Term::Delay(d) => {