let find_scope allstmts modif_stmts s =
let add fw sid x acc =
match x with
| State.Start ->
if fw then add_s sid acc
else
let x =
List.fold_left (fun x s -> State.merge x (States.find s.sid))
State.NotSeen s.succs
in let x = State.transfer (SidSet.mem sid modif_stmts) x in
if x = State.SameVal then add_s sid acc else acc
| State.SameVal -> add_s sid acc
| _ -> acc
in
let _ = backward_data_scope allstmts modif_stmts s in
let bw = States.fold (add false) Stmt.Set.empty in
let _ = forward_data_scope modif_stmts s in
let fw = States.fold (add true) Stmt.Set.empty in
let fb = Stmt.Set.inter bw fw in
let fw = Stmt.Set.diff fw fb in
let bw = Stmt.Set.diff bw fb in
fw, fb, bw