From 423be6746d244ba4e44f4427e9fa7e1b714b274a Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 4 Mar 2024 15:39:20 +0100 Subject: [PATCH 1/2] Compiler: fix parallel renaming --- compiler/lib/generate.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/lib/generate.ml b/compiler/lib/generate.ml index 85e55ee610..2fb2ed754c 100644 --- a/compiler/lib/generate.ml +++ b/compiler/lib/generate.ml @@ -731,8 +731,9 @@ let parallel_renaming back_edge params args continuation queue = ~f:(fun (queue, before, renaming, seen) (y, x) -> let (((_, deps_x) as px), cx, locx), queue = access_queue_loc queue x in let seen' = Code.Var.Set.add y seen in - if back_edge && not Code.Var.Set.(is_empty (inter seen deps_x)) + if not Code.Var.Set.(is_empty (inter seen deps_x)) then + let () = assert back_edge in let before, queue = flush_queue queue @@ -1778,9 +1779,11 @@ and compile_argument_passing ctx queue (pc, args) back_edge continuation = and compile_branch st queue ((pc, _) as cont) scope_stack ~fall_through : bool * _ = let scope = List.assoc_opt pc scope_stack in let back_edge = - match scope with - | Some (_l, _used, Loop) -> true - | None | Some _ -> false + List.exists + ~f:(function + | pc', (_, _, Loop) when pc' = pc -> true + | _ -> false) + scope_stack in compile_argument_passing st.ctx queue cont back_edge (fun queue -> if match fall_through with From ee3540717024ff213ad434105b61fb56897cc612 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 4 Mar 2024 15:45:18 +0100 Subject: [PATCH 2/2] Changes --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index b6bbc7442b..41b1bce0b6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ ## Bug fixes * Compiler: fix --enable=vardecl * Lib: fix paragraph construction and coercion +* Compiler: fix parallel renaming (bug introduced in #1567) # 5.7.0 (2024-02-16) - Lille