[sledge] Revise invariant checking regarding opaque types

Summary: These relaxations are needed for some of the llvm test suite.

Reviewed By: mbouaziz

Differential Revision: D15098813

fbshipit-source-id: 702d3ffd9
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent d3f33d0b43
commit 9986d98645

@ -258,12 +258,7 @@ let rec xlate_type : x -> Llvm.lltype -> Typ.t =
;
xlate_type_ llt
|>
[%Trace.retn fun {pf} typ ->
assertf
(Bool.equal (Llvm.type_is_sized llt) (Typ.is_sized typ))
!"xlate_type did not preserve is_sized: %a to %a %{sexp:Typ.t}"
pp_lltype llt Typ.pp typ typ () ;
pf "%a" Typ.pp_defn typ] )
[%Trace.retn fun {pf} -> pf "%a" Typ.pp_defn] )
and xlate_type_opt : x -> Llvm.lltype -> Typ.t option =
fun x llt ->

@ -61,6 +61,8 @@ let is_sized = function
| Function _ | Opaque _ -> false
| Integer _ | Float _ | Pointer _ | Array _ | Tuple _ | Struct _ -> true
let is_sized_or_opaque = function Opaque _ -> true | t -> is_sized t
let invariant t =
Invariant.invariant [%here] t [%sexp_of: t]
@@ fun () ->
@ -68,8 +70,9 @@ let invariant t =
| Function {return; args} ->
assert (Option.for_all ~f:is_sized return) ;
assert (Vector.for_all ~f:is_sized args)
| Array {elt} -> assert (is_sized elt)
| Tuple {elts} | Struct {elts} -> assert (Vector.for_all ~f:is_sized elts)
| Array {elt} -> assert (is_sized_or_opaque elt)
| Tuple {elts} | Struct {elts} ->
assert (Vector.for_all ~f:is_sized_or_opaque elts)
| Integer {bits} | Float {bits} -> assert (bits > 0)
| Pointer _ | Opaque _ -> assert true

Loading…
Cancel
Save