let memoize kf =
  try
    ignore
      (Mem_Exec.memo
         (fun kf ->
            Kf_state.mark_as_called kf;
            let with_globals = initial_state_contextfree_only_globals () in
            let with_formals = initial_state_formals kf with_globals in
            let (a,b,_) =
              compute_with_initial_state kf ~call_kinstr:Kglobal with_formals
            in
            let result = a,b in
            let ins =
              (!Db.InOutContext.get_internal kf).Inout_type.over_inputs
            in
            let outs = !Db.Outputs.get_external kf in
            with_formals,result,ins,outs)
         kf)
  with Db.Value.Aborted ->
    (* the function will not be memoized. TODO: inform the user
       that the analyzer will behave as if the option was not set *)

    ()