|
@@ -1041,7 +1041,7 @@ module ConstPropagation = struct
|
|
|
with Not_found ->
|
|
|
-1
|
|
|
|
|
|
- let can_be_inlined com v0 e = type_iseq v0.v_type e.etype && match e.eexpr with
|
|
|
+ let rec can_be_inlined com v0 e = type_iseq v0.v_type e.etype && match e.eexpr with
|
|
|
| TConst ct ->
|
|
|
begin match ct with
|
|
|
| TThis | TSuper -> false
|
|
@@ -1065,6 +1065,9 @@ module ConstPropagation = struct
|
|
|
Ssa.get_var_usage_count v0 <= 1
|
|
|
| TField(_,FEnum _) ->
|
|
|
Ssa.get_var_usage_count v0 <= 1
|
|
|
+ | TCast(e1,None) ->
|
|
|
+ (* We can inline an unsafe cast if the variable is only used once. *)
|
|
|
+ can_be_inlined com v0 {e1 with etype = e.etype} && Ssa.get_var_usage_count v0 <= 1
|
|
|
| _ ->
|
|
|
false
|
|
|
|