anchor.diff:              none
       end.
   
  --spec invert_op(basic_rel_op() | 'none') -> rel_op() | 'none'.
  -
  -invert_op({Op,Arg1,Arg2}) ->
  -    {invert_op_1(Op),Arg1,Arg2};
  -invert_op({TypeTest,Arg}) ->
  +-spec invert_test(basic_test() | 'none') -> test() | 'none'.
  +
  +invert_test({Op,Arg1,Arg2}) ->
  +    {invert_op(Op),Arg1,Arg2};
  +invert_test({TypeTest,Arg}) ->
       {{'not',TypeTest},Arg};
  -invert_op(none) -> none.
  -
  -invert_op_1('>=') -> '<';
  -invert_op_1('<') -> '>=';
  -invert_op_1('=<') -> '>';
  -invert_op_1('>') -> '=<';
  -invert_op_1('=:=') -> '=/=';
  -invert_op_1('=/=') -> '=:=';
  -invert_op_1('==') -> '/=';
  -invert_op_1('/=') -> '=='.
  +invert_test(none) -> none.
  +
  +invert_op('>=') -> '<';
  +invert_op('<') -> '>=';
  +invert_op('=<') -> '>';
  +invert_op('>') -> '=<';
  +invert_op('=:=') -> '=/=';
  +invert_op('=/=') -> '=:=';
  +invert_op('==') -> '/=';
  +invert_op('/=') -> '=='.
   
   turn_op('<') -> '>';
   turn_op('=<') -> '>=';
  
positive.code:     none.
  
  eval_switch_1([{Lit,Lbl}|T], Arg, PrevOp, Fail) ->
      RelOp = {'=:=',Arg,Lit},
      case will_succeed(PrevOp, RelOp) of
          yes ->
              %% Success. This branch will always be taken.
              Lbl;
  
negative.code: %%% Handling of relational operators.
  %%%
  
  get_test(Bool, [_|_]=Is) ->
      case last(Is) of
          #b_set{op=Op,dst=Bool,args=Args} ->
              normalize_test(Op, Args);
          #b_set{} ->
              none
      end;
  get_test(_, []) -> none.
  
  %% normalize_test(Instruction) -> {Normalized,FailLabel} | error
  %%    Normalized = {Operator,Variable,Variable|Literal} |
  %%                 {TypeTest,Variable}
  %%    Operation = '<' | '=<' | '=:=' | '=/=' | '>=' | '>' | '==' | '/='
  %%    TypeTest = is_atom | is_integer ...
  %%    Variable = #b_var{}
  %%    Literal = #b_literal{}
  %%
  %%  Normalize type tests and relational operators to facilitate
  %%  further comparisons between test. Always make the register
  %%  operand the first operand. If there are two registers, order the
  %%  registers in lexical order.
  %%
  %%  For example, this instruction:
  %%
  %%    #b_set{op={bif,'<'},args=[#b_literal{}, #b_var{}}
  %%
  %%  will be normalized to:
  %%
  %%    {'>',#b_var{},#b_literal{}}
  
  -spec normalize_test(Op, Args) -> NormalizedTest | 'none' when
        Op :: beam_ssa:op(),
        Args :: [beam_ssa:value()],
        NormalizedTest :: basic_test().
  
  normalize_test(is_tagged_tuple, [Arg,#b_literal{val=Size},#b_literal{val=Tag}])
    when is_integer(Size), is_atom(Tag) ->
      {{is_tagged_tuple,Size,Tag},Arg};
  normalize_test(is_nonempty_list, [Arg]) ->
      {is_nonempty_list,Arg};
  normalize_test({bif,Bif}, [Arg]) ->
      case erl_internal:new_type_test(Bif, 1) of
          true -> {Bif,Arg};
          false -> none
      end;
  normalize_test({bif,Bif}, [_,_]=Args) ->
      case erl_internal:comp_op(Bif, 2) of
          true ->
              normalize_test_1(Bif, Args);
          false ->
              none
      end;
  normalize_test(_, _) -> none.
  
  normalize_test_1(Bif, Args) ->
      case Args of
          [#b_literal{}=Arg1,#b_var{}=Arg2] ->
              {turn_op(Bif),Arg2,Arg1};
  