|
117 | 117 |
|
118 | 118 | let cse_with_eligible_lhs ~typing_env_at_fork ~cse_at_each_use ~params prev_cse
|
119 | 119 | (extra_bindings: EPA.t) extra_equations =
|
120 |
| - let params = KP.List.simple_set params in |
| 120 | + let params = KP.List.name_set params in |
| 121 | + let is_param simple = |
| 122 | + Simple.pattern_match simple |
| 123 | + ~name:(fun name -> Name.Set.mem name params) |
| 124 | + ~const:(fun _ -> false) |
| 125 | + in |
121 | 126 | List.fold_left cse_at_each_use ~init:EP.Map.empty
|
122 | 127 | ~f:(fun eligible (env_at_use, id, cse) ->
|
123 | 128 | let find_new_name =
|
@@ -184,15 +189,17 @@ let cse_with_eligible_lhs ~typing_env_at_fork ~cse_at_each_use ~params prev_cse
|
184 | 189 | since they are defined in [env_at_fork]. However these
|
185 | 190 | aren't bound at the use sites, so we must choose another
|
186 | 191 | alias that is. *)
|
187 |
| - if not (Simple.Set.mem bound_to params) then Some bound_to |
| 192 | + if not (is_param bound_to) then Some bound_to |
188 | 193 | else
|
189 | 194 | let aliases =
|
190 | 195 | TE.aliases_of_simple env_at_use
|
191 | 196 | ~min_name_mode:NM.normal bound_to
|
192 |
| - |> Simple.Set.filter (fun simple -> |
193 |
| - not (Simple.Set.mem simple params)) |
| 197 | + |> Aliases.Alias_set.filter ~f:(fun simple -> |
| 198 | + not (is_param simple)) |
194 | 199 | in
|
195 |
| - Simple.Set.get_singleton aliases |
| 200 | + (* CR lmaurer: This could be using |
| 201 | + [Aliases.Alias_set.find_best], I think? *) |
| 202 | + Aliases.Alias_set.get_singleton aliases |
196 | 203 | in
|
197 | 204 | match bound_to with
|
198 | 205 | | None -> eligible
|
|
0 commit comments