Skip to content

Commit 5ff26ae

Browse files
author
Shale Xiong
committed
[gen] Update the diy7 filter, ignoring the insert edge.
1 parent 194e85a commit 5ff26ae

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

gen/alt.ml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,18 @@ struct
223223
| (None,_)|(_,(Irr|NoDir)) -> true
224224
| Some a,(Dir d) -> C.A.applies_atom a d
225225

226-
let pair_ok safes po_safe xs ys e1 e2 = match e1.edge,e2.edge with
226+
let rec hd_non_insert = function
227+
| [] -> assert false
228+
| [x] -> x
229+
| x::xs ->
230+
if C.E.is_insert_store x.C.E.edge then hd_non_insert xs
231+
else x
232+
let last_non_insert xs = hd_non_insert (List.rev xs)
233+
234+
let pair_ok safes po_safe xs ys =
235+
let e1 = last_non_insert xs in
236+
let e2 = hd_non_insert ys in
237+
match e1.edge,e2.edge with
227238
(*
228239
First reject some of hb' ; hb'
229240
*)
@@ -278,24 +289,16 @@ module Make(C:Builder.S)
278289
| _,_ -> false
279290
else fun _ _ -> true
280291

281-
let rec hd_non_insert = function
282-
| [] -> assert false
283-
| [x] -> x
284-
| x::xs ->
285-
if C.E.is_insert_store x.C.E.edge then hd_non_insert xs
286-
else x
287-
let last_non_insert xs = hd_non_insert (List.rev xs)
288-
289292
let do_compat safes po_safe xs ys =
290293
let x = Misc.last xs and y = List.hd ys in
291294
let r =
292295
C.E.can_precede x y
293296
&& check_mixed x y
294-
&& FilterImpl.pair_ok safes po_safe xs ys x y
297+
&& FilterImpl.pair_ok safes po_safe xs ys
295298
&&
296299
begin
297300
if do_kvm then
298-
C.E.can_precede (hd_non_insert xs) (last_non_insert ys)
301+
C.E.can_precede (FilterImpl.hd_non_insert xs) (FilterImpl.last_non_insert ys)
299302
else true
300303
end in
301304
if O.verbose > 2 then begin
@@ -798,7 +801,5 @@ module Make(C:Builder.S)
798801
let safe,_,_ = parse_input ~relax ~safe ~reject:[] in
799802
let safe_set = C.R.Set.of_list safe in
800803
let po_safe = edges_ofs safe |> extract_po in
801-
let last = Misc.last lhs in
802-
let first = List.hd rhs in
803-
FilterImpl.pair_ok safe_set po_safe lhs rhs last first
804+
FilterImpl.pair_ok safe_set po_safe lhs rhs
804805
end

0 commit comments

Comments
 (0)