anchor.diff:        State :: #vvars{}.
   vvars_block(Id, State0) ->
       #{ Id := #b_blk{ is = Is, last = Terminator} } = State0#vvars.blocks,
  -    #{ Id := DefVars } = State0#vvars.branch_def_vars,
  +    #{ Id := {Vars, TryTags} } = State0#vvars.branches,
       validate_normalized(Terminator),
  -    State = State0#vvars{ defined_vars = DefVars },
  +    State = State0#vvars{ variables = Vars, try_tags = TryTags },
       vvars_terminator(Terminator, Id, vvars_block_1(Is, Terminator, State)).
   
   validate_normalized(I) ->
  
positive.code:       Terminator :: beam_ssa:terminator(),
        From :: beam_ssa:label(),
        State :: #vvars{}.
  vvars_terminator(#b_ret{ arg = Arg }=I, _From, State) ->
      ok = vvars_assert_args([Arg], I, State),
      State;
  vvars_terminator(#b_switch{arg=Arg,fail=Fail,list=Switch}=I, From, State) ->
      ok = vvars_assert_args([Arg], I, State),
      ok = vvars_assert_args([A || {A,_Lbl} <- Switch], I, State),
  
negative.code:             erlang:raise(Class, Error, Stack)
      end.
  
  -type variables() :: gb_sets:set(beam_ssa:argument()).
  -type try_tags() :: gb_sets:set(beam_ssa:b_var()).
  -type branch() :: {variables(), try_tags()}.
  
  -record(vvars,
          { blocks :: #{ beam_ssa:label() => beam_ssa:b_blk() },
            branches :: #{ %% Describes the variable state at the time of
                           %% this exact branch (phi node validation).
                           {From :: beam_ssa:label(),
                            To :: beam_ssa:label()} => branch(),
                           %% Describes the variable state common to all
                           %% branches leading to this label (un/redefined
                           %% variable validation).
                           beam_ssa:label() => branch() },
            variables :: variables(),
            try_tags :: try_tags() }).
  
  -spec validate_variables(beam_ssa:b_function()) -> ok.
  validate_variables(#b_function{ args = Args, bs = Blocks }) ->
      %% Prefill the mapping with function arguments.
      Args = vvars_get_variables(Args),
      Vars = gb_sets:from_list(Args),
      TryTags = gb_sets:new(),
      Entry = 0,
  
      State = #vvars{blocks = Blocks,
                     branches = #{ Entry => {Vars, TryTags} },
                     variables = Vars,
                     try_tags = TryTags },
      ok = vvars_assert_unique(Blocks, Args),
      vvars_phi_nodes(vvars_block(Entry, State)).
  
  