|
@@ -2009,6 +2009,12 @@ module CopyPropagation = DataFlow(struct
|
|
lattice := IntMap.empty
|
|
lattice := IntMap.empty
|
|
|
|
|
|
let commit ctx =
|
|
let commit ctx =
|
|
|
|
+ (* We don't care about the scope on JS and AS3 because they hoist var declarations. *)
|
|
|
|
+ let in_scope bb bb' = match ctx.com.platform with
|
|
|
|
+ | Js _ -> true
|
|
|
|
+ | Flash when Common.defined ctx.com Define.As3 -> true
|
|
|
|
+ | _ -> List.mem (List.hd bb'.bb_scopes) bb.bb_scopes
|
|
|
|
+ in
|
|
let rec commit bb e = match e.eexpr with
|
|
let rec commit bb e = match e.eexpr with
|
|
| TLocal v when not v.v_capture ->
|
|
| TLocal v when not v.v_capture ->
|
|
begin try
|
|
begin try
|
|
@@ -2025,7 +2031,7 @@ module CopyPropagation = DataFlow(struct
|
|
considering variables whose origin-variables are assigned to at most once. *)
|
|
considering variables whose origin-variables are assigned to at most once. *)
|
|
let writes = (get_var_info ctx.graph v'').vi_writes in
|
|
let writes = (get_var_info ctx.graph v'').vi_writes in
|
|
begin match writes with
|
|
begin match writes with
|
|
- | [_] -> ()
|
|
|
|
|
|
+ | [bb'] when in_scope bb bb' -> ()
|
|
| _ -> leave()
|
|
| _ -> leave()
|
|
end;
|
|
end;
|
|
commit bb {e with eexpr = TLocal v'}
|
|
commit bb {e with eexpr = TLocal v'}
|