Skip to content

Commit febb7c8

Browse files
committed
fixup! Effects: partial CPS transform
1 parent 1998e9e commit febb7c8

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

compiler/lib/global_flow.ml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ blocks, to track functions across modules.
2525

2626
open! Stdlib
2727

28-
let debug = Debug.find "flow2"
28+
let debug = Debug.find "global-flow"
2929

3030
let times = Debug.find "times"
3131

@@ -133,11 +133,9 @@ let rec arg_deps st ?ignore params args =
133133
| x :: params, y :: args ->
134134
(* This is to deal with the [else] clause of a conditional,
135135
where we know that the value of the tested variable is 0. *)
136-
if not
137-
(match ignore with
138-
| Some y' -> Var.equal y y'
139-
| _ -> false)
140-
then add_assign_def st x y;
136+
(match ignore with
137+
| Some y' when Var.equal y y' -> ()
138+
| _ -> add_assign_def st x y);
141139
arg_deps st params args
142140
| _ -> ()
143141

@@ -263,16 +261,17 @@ let program_deps st { blocks; _ } =
263261
cont_deps blocks st cont)
264262
blocks
265263

266-
(* For each variable, we keep track of which values (function or
267-
block) if may contain. We loose a lot of information when going to
268-
[Top] since we have to assume that all functions might escape. So,
269-
having possibly unknown values does not move us to [Top]; we use a
270-
flag for that instead. *)
264+
(* For each variable, we keep track of which values, function or
265+
block, it may contain. Other kinds of values are not relevant and
266+
just ignored. We loose a lot of information when going to [Top]
267+
since we have to assume that all functions might escape. So, having
268+
possibly unknown values does not move us to [Top]; we use a flag
269+
for that instead. *)
271270
type approx =
272271
| Top
273272
| Values of
274-
{ known : Var.Set.t (* List of possible values *)
275-
; others : bool (* Whether other values are possible *)
273+
{ known : Var.Set.t (* List of possible values (functions and blocks) *)
274+
; others : bool (* Whether other functions or blocks are possible *)
276275
}
277276

278277
module Domain = struct
@@ -566,7 +565,7 @@ let f p =
566565
Var.ISet.iter
567566
(fun x ->
568567
let s = Var.Tbl.get approximation x in
569-
if true || not (Poly.( = ) s Domain.bot)
568+
if not (Domain.equal s Domain.bot)
570569
then
571570
Format.eprintf
572571
"%a: %a@."

0 commit comments

Comments
 (0)