anchor.diff:          true -> update_type(fun subtract/2, RType, LHS, Vst);
           false -> Vst
       end.
  -
  -update_eq_types(LHS, RHS, Vst0) ->
  -    %% Either side might contain something worth inferring, so we need
  -    %% to check them both.
  -    Infer_L = infer_types(RHS, Vst0),
  -    Infer_R = infer_types(LHS, Vst0),
  -    Vst1 = Infer_R(RHS, Infer_L(LHS, Vst0)),
  -
  -    T1 = get_term_type(LHS, Vst1),
  -    T2 = get_term_type(RHS, Vst1),
  -
  -    Vst = update_type(fun meet/2, T2, LHS, Vst1),
  -    update_type(fun meet/2, T1, RHS, Vst).
   
   %% Helper functions for the above.
   
  
positive.code:                    kill_state(SuccVst)
             end).
  
  infer_types({Kind,_}=Reg, Vst) when Kind =:= x; Kind =:= y ->
      infer_types(get_reg_vref(Reg, Vst), Vst);
  infer_types(#value_ref{}=Ref, #vst{current=#st{vs=Vs}}) ->
      case Vs of
          #{ Ref := Entry } -> infer_types_1(Entry);
          #{} -> fun(_, S) -> S end
      end;
  infer_types(_, #vst{}) ->
      fun(_, S) -> S end.
  
  infer_types_1(#value{op={bif,'=:='},args=[LHS,RHS]}) ->
      fun({atom,true}, S) ->
              %% Either side might contain something worth inferring, so we need
              %% to check them both.
              Infer_L = infer_types(RHS, S),
              Infer_R = infer_types(LHS, S),
              Infer_R(RHS, Infer_L(LHS, S));
         (_, S) -> S
      end;
  infer_types_1(#value{op={bif,element},args=[{integer,Index},Tuple]}) ->
      fun(Val, S) ->
              case is_value_alive(Tuple, S) of
                  true ->
                      ElementType = get_term_type(Val, S),
                      Es = beam_types:set_element_type(Index, ElementType, #{}),
                      Type = #t_tuple{size=Index,elements=Es},
                      update_type(fun meet/2, Type, Tuple, S);
                  false ->
                      S
              end
      end;
  infer_types_1(#value{op={bif,is_atom},args=[Src]}) ->
      infer_type_test_bif(#t_atom{}, Src);
  infer_types_1(#value{op={bif,is_boolean},args=[Src]}) ->
      infer_type_test_bif(beam_types:make_boolean(), Src);
  infer_types_1(#value{op={bif,is_binary},args=[Src]}) ->
      infer_type_test_bif(#t_bitstring{unit=8}, Src);
  infer_types_1(#value{op={bif,is_bitstring},args=[Src]}) ->
      infer_type_test_bif(#t_bitstring{}, Src);
  infer_types_1(#value{op={bif,is_float},args=[Src]}) ->
      infer_type_test_bif(float, Src);
  infer_types_1(#value{op={bif,is_integer},args=[Src]}) ->
      infer_type_test_bif(#t_integer{}, Src);
  infer_types_1(#value{op={bif,is_list},args=[Src]}) ->
      infer_type_test_bif(list, Src);
  infer_types_1(#value{op={bif,is_map},args=[Src]}) ->
      infer_type_test_bif(#t_map{}, Src);
  infer_types_1(#value{op={bif,is_number},args=[Src]}) ->
      infer_type_test_bif(number, Src);
  infer_types_1(#value{op={bif,is_tuple},args=[Src]}) ->
      infer_type_test_bif(#t_tuple{}, Src);
  infer_types_1(#value{op={bif,tuple_size}, args=[Tuple]}) ->
      fun({integer,Arity}, S) ->
              case is_value_alive(Tuple, S) of
                  true ->
                      Type = #t_tuple{exact=true,size=Arity},
                      update_type(fun meet/2, Type, Tuple, S);
                  false ->
                      S
              end;
         (_, S) -> S
      end;
  infer_types_1(_) ->
      fun(_, S) -> S end.
  
  infer_type_test_bif(Type, Src) ->
      fun({atom,Bool}, S) when is_boolean(Bool) ->
              case is_value_alive(Src, S) of
                  true when Bool =:= true ->
                      update_type(fun meet/2, Type, Src, S);
                  true when Bool =:= false ->
                      update_type(fun subtract/2, Type, Src, S);
                  false ->
                      S
              end;
         (_, S) ->
              S
      end.
  
  %%%
  %%% Keeping track of types.
  
negative.code:         _Type -> Vst
      end.
  
  update_eq_types(LHS, RHS, Vst0) ->
      Vst1 = infer_types(eq_exact, LHS, RHS, Vst0),
  
      T1 = get_term_type(LHS, Vst1),
      T2 = get_term_type(RHS, Vst1),
  
      Vst = update_type(fun meet/2, T2, LHS, Vst1),
      update_type(fun meet/2, T1, RHS, Vst).
  
  update_ne_types(LHS, RHS, Vst0) ->
      Vst = infer_types(ne_exact, LHS, RHS, Vst0),
  
      %% While updating types on equality is fairly straightforward, inequality
      %% is a bit trickier since all we know is that the *value* of LHS differs
      %% from RHS, so we can't blindly subtract their types.
  