summaryrefslogtreecommitdiff
path: root/compiler/SymbolicToPure.ml
diff options
context:
space:
mode:
authorSon Ho2024-03-08 23:54:06 +0100
committerSon Ho2024-03-08 23:54:06 +0100
commit39f7598a1dc26075899a4b9a53c30577ee699b02 (patch)
treef307c3241889ad5b8d88df669e6a7dc6dbd768ca /compiler/SymbolicToPure.ml
parent8f1972dddbd25ff2153bdf3dabd743256fec03a4 (diff)
Fix some issues
Diffstat (limited to 'compiler/SymbolicToPure.ml')
-rw-r--r--compiler/SymbolicToPure.ml18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/SymbolicToPure.ml b/compiler/SymbolicToPure.ml
index 8b4362a2..922f0375 100644
--- a/compiler/SymbolicToPure.ml
+++ b/compiler/SymbolicToPure.ml
@@ -3044,16 +3044,19 @@ and translate_forward_end (ectx : C.eval_ctx)
let ctx, pure_fwd_var = fresh_var None ctx.sg.fwd_output ctx in
let fwd_e = translate_one_end ctx None in
- (* If we are translating a loop, we need to ignore the backward functions
- which are not associated to region abstractions of the loop. *)
+ (* If we reached a loop: if we are *inside* a loop, we need to ignore the
+ backward functions which are not associated to region abstractions.
+ *)
let keep_rg_ids =
match ctx.loop_id with
| None -> None
| Some loop_id ->
- let loop_info = LoopId.Map.find loop_id ctx.loops in
- Some
- (RegionGroupId.Set.of_list
- (RegionGroupId.Map.keys loop_info.back_outputs))
+ if ctx.inside_loop then
+ let loop_info = LoopId.Map.find loop_id ctx.loops in
+ Some
+ (RegionGroupId.Set.of_list
+ (RegionGroupId.Map.keys loop_info.back_outputs))
+ else None
in
let keep_rg_id =
match keep_rg_ids with
@@ -3517,9 +3520,6 @@ and translate_loop (loop : S.loop) (ctx : bs_ctx) : texpression =
loop_body;
}
in
- (* If we translate forward functions: the return type of a loop body is the
- same as the parent function *)
- assert (Option.is_some ctx.bid || fun_end.ty = loop_body.ty);
let ty = fun_end.ty in
{ e = loop; ty }