Commit d280fa0e authored by Andrei Paskevich's avatar Andrei Paskevich

Compile: resets prevent reordering (fix #206)

parent 09d56ba9
......@@ -615,20 +615,17 @@ module Transform = struct
open Mltree
let no_reads_writes_conflict spv spv_mreg =
(* let is_not_write {pv_ity = ity} = match ity.ity_node with
* | Ityreg rho -> not (Mreg.mem rho spv_mreg)
* | _ -> true in
* Spv.for_all is_not_write spv *)
Spv.is_empty (pvs_affected spv_mreg spv)
let no_effect_conflict spv eff =
Spv.is_empty (pvs_affected eff.eff_writes spv) &&
Spv.is_empty (pvs_affected eff.eff_resets spv)
let rec can_inline ({e_effect = eff1} as e1) ({e_effect = eff2} as e2) =
match e2.e_node with
| Evar _ | Econst _ | Eapp _ | Eassign [_] -> true
| Elet (Lvar (_, {e_effect = eff1'}), e2') ->
no_reads_writes_conflict eff1.eff_reads eff1'.eff_writes
no_effect_conflict eff1.eff_reads eff1'
&& can_inline e1 e2'
| _ -> no_reads_writes_conflict eff1.eff_reads eff2.eff_writes
| _ -> no_effect_conflict eff1.eff_reads eff2
let mk_list_eb ebl f =
let mk_acc e (e_acc, s_acc) =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment