let join o1 o2 =
let result =
if o1 == o2
then o1
else
match o1, o2 with
| Unknown,_ | _, Unknown -> Unknown
| Well,_ | _ , Well -> Well
| Misalign_read o1, Misalign_read o2 ->
Misalign_read(LocationSetLattice.join o1 o2)
| _, (Misalign_read _ as m) | (Misalign_read _ as m), _ -> m
| Leaf o1, Leaf o2 ->
Leaf(LocationSetLattice.join o1 o2)
| (Leaf _ as m), _ | _, (Leaf _ as m) -> m
| Merge o1, Merge o2 ->
Merge(LocationSetLattice.join o1 o2)
| (Merge _ as m), _ | _, (Merge _ as m) -> m
| Arith o1, Arith o2 ->
Arith(LocationSetLattice.join o1 o2)
in
result