Skip to content

Commit 2f40d06

Browse files
authored
Relax comparison criteria for Apply_cont_expr (#323)
1 parent ef286e2 commit 2f40d06

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

middle_end/flambda2/simplify/expr_builder.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ let create_switch uacc ~scrutinee ~arms =
519519
UA.add_free_names uacc (Apply_cont.free_names action)
520520
|> UA.notify_added ~code_size:(Code_size.apply_cont action)
521521
in
522+
(* The resulting [Debuginfo] on the [Apply_cont] will be arbitrarily
523+
chosen from amongst the [Debuginfo] values on the arms, but this seems
524+
fine. *)
522525
RE.create_apply_cont action, uacc
523526
in
524527
match Targetint_31_63.Map.get_singleton arms with

middle_end/flambda2/terms/apply_cont_expr.ml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,16 @@ include Container_types.Make (struct
8989

9090
let hash _ = Misc.fatal_error "Not yet implemented"
9191

92-
(* CR mshinwell: I wonder if the Debuginfo should be excluded from this. For
93-
example at the moment we could get a Switch with two arms that go to the
94-
same place but differ only on Debuginfo. *)
95-
let compare { k = k1; args = args1; trap_action = trap_action1; dbg = dbg1 }
96-
{ k = k2; args = args2; trap_action = trap_action2; dbg = dbg2 } =
92+
let compare { k = k1; args = args1; trap_action = trap_action1; dbg = _ }
93+
{ k = k2; args = args2; trap_action = trap_action2; dbg = _ } =
9794
let c = Continuation.compare k1 k2 in
9895
if c <> 0
9996
then c
10097
else
10198
let c = Misc.Stdlib.List.compare Simple.compare args1 args2 in
10299
if c <> 0
103100
then c
104-
else
105-
let c = Option.compare Trap_action.compare trap_action1 trap_action2 in
106-
if c <> 0 then c else Debuginfo.compare dbg1 dbg2
101+
else Option.compare Trap_action.compare trap_action1 trap_action2
107102

108103
let equal t1 t2 = compare t1 t2 = 0
109104
end)

middle_end/flambda2/terms/apply_cont_expr.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ val clear_trap_action : t -> t
6464

6565
val to_one_arg_without_trap_action : t -> Simple.t option
6666

67+
(** Note that [compare] ignores the [Debuginfo.t]. *)
6768
include Container_types.S with type t := t

0 commit comments

Comments
 (0)