[sledge] Change Typ.is_sized to remove hack for opaque types

Summary:
It happens so seldomly that it is not worth it to optimistically
assume that linking will make opaque types sized. In particular, it is
incongruent for `Typ.is_sized` to hold and then `Typ.size_of` to
raise.

Reviewed By: jvillard

Differential Revision: D24772956

fbshipit-source-id: 96a72a5cf
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 639bda69e7
commit e415b8f22e

@ -489,7 +489,10 @@ and xlate_value ?(inline = false) stk :
let name = find_name (Llvm.operand llv 1) in
([], Exp.label ~parent ~name)
| UndefValue ->
let typ = xlate_type x (Llvm.type_of llv) in
let llt = Llvm.type_of llv in
let typ = xlate_type x llt in
if not (Typ.is_sized typ) then
todo "types with undetermined size: %a" pp_lltype llt () ;
let name = Printf.sprintf "undef_%i" !undef_count in
let loc = Loc.none in
let reg = Reg.program typ name in

@ -57,9 +57,8 @@ let pp_defn fs = function
(** Invariants *)
let is_sized = function
| Function _ -> false
| Function _ | Opaque _ -> false
| Integer _ | Float _ | Pointer _ | Array _ | Tuple _ | Struct _ -> true
| Opaque _ -> (* optimistically assume linking will make it sized *) true
let invariant t =
let@ () = Invariant.invariant [%here] t [%sexp_of: t] in

Loading…
Cancel
Save