From e8ba63274102a0de17227b46729ca3e22b861a23 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Wed, 27 Apr 2022 13:57:35 +0200 Subject: Fix the filtering of useless backward functions --- src/PureMicroPasses.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PureMicroPasses.ml b/src/PureMicroPasses.ml index 75844345..2c4c667f 100644 --- a/src/PureMicroPasses.ml +++ b/src/PureMicroPasses.ml @@ -959,9 +959,14 @@ let filter_useless (filter_monadic_calls : bool) (ctx : trans_ctx) *) let filter_if_backward_with_no_outputs (config : config) (def : fun_decl) : fun_decl option = + let return_ty = + if config.use_state_monad then + mk_result_ty (mk_simpl_tuple_ty [ mk_state_ty; unit_ty ]) + else mk_result_ty (mk_simpl_tuple_ty [ unit_ty ]) + in if config.filter_useless_functions && Option.is_some def.back_id - && def.signature.outputs = [] + && def.signature.outputs = [ return_ty ] then None else Some def -- cgit v1.2.3