summaryrefslogtreecommitdiff
path: root/compiler/PureMicroPasses.ml
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/PureMicroPasses.ml')
-rw-r--r--compiler/PureMicroPasses.ml15
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/PureMicroPasses.ml b/compiler/PureMicroPasses.ml
index c5eb3c64..2e4a534e 100644
--- a/compiler/PureMicroPasses.ml
+++ b/compiler/PureMicroPasses.ml
@@ -621,15 +621,16 @@ let inline_useless_var_reassignments (inline_named : bool) (inline_pure : bool)
In this situation, we can remove the call [f@fwd x].
*)
let expression_contains_child_call_in_all_paths (ctx : trans_ctx)
- (id0 : A.fun_id) (rg_id0 : T.RegionGroupId.id option) (tys0 : ty list)
+ (id0 : A.fun_id) (lp_id0 : V.LoopId.id option)
+ (rg_id0 : T.RegionGroupId.id option) (tys0 : ty list)
(args0 : texpression list) (e : texpression) : bool =
let check_call (fun_id1 : fun_or_op_id) (tys1 : ty list)
(args1 : texpression list) : bool =
(* Check the fun_ids, to see if call1's function is a child of call0's function *)
match fun_id1 with
- | Fun (FromLlbc (id1, rg_id1)) ->
+ | Fun (FromLlbc (id1, lp_id1, rg_id1)) ->
(* Both are "regular" calls: check if they come from the same rust function *)
- if id0 = id1 then
+ if id0 = id1 && lp_id0 = lp_id1 then
(* Same rust functions: check the regions hierarchy *)
let call1_is_child =
match (rg_id0, rg_id1) with
@@ -801,13 +802,13 @@ let filter_useless (filter_monadic_calls : bool) (ctx : trans_ctx)
* We can filter if the right-expression is a function call,
* under some conditions. *)
match (filter_monadic_calls, opt_destruct_function_call re) with
- | true, Some (Fun (FromLlbc (fid, rg_id)), tys, args) ->
+ | true, Some (Fun (FromLlbc (fid, lp_id, rg_id)), tys, args) ->
(* We need to check if there is a child call - see
* the comments for:
* [expression_contains_child_call_in_all_paths] *)
let has_child_call =
- expression_contains_child_call_in_all_paths ctx fid rg_id
- tys args e
+ expression_contains_child_call_in_all_paths ctx fid lp_id
+ rg_id tys args e
in
if has_child_call then (* Filter *)
(e.e, fun _ -> used)
@@ -1031,7 +1032,7 @@ let eliminate_box_functions (_ctx : trans_ctx) (def : fun_decl) : fun_decl =
match opt_destruct_function_call e with
| Some (fun_id, _tys, args) -> (
match fun_id with
- | Fun (FromLlbc (A.Assumed aid, rg_id)) -> (
+ | Fun (FromLlbc (A.Assumed aid, _lp_id, rg_id)) -> (
(* Below, when dealing with the arguments: we consider the very
* general case, where functions could be boxed (meaning we
* could have: [box_new f x])