Fix slow compilation of complex guards

beam_utils:is_not_used_at/3 could be very slow for complex guards,
because the cached result for previously encountered labels were
neither used nor updated within blocks.

Reported-by: Magnus Müller
Fix optimization of some binary comprehensions

If a variable bound in a generator is used as the size of a segment
in the comprehension body, v3_core uses this variable in the code
generated to compute the initial size given to the `bs_init_writable`
primop before the variable is actually bound, as in:

  << <<0:S>> || S <- Slist >>

Reported-By: Peer Stritzinger
Add a new option +clint0 to the compiler

This option makes the compiler run the Core Erlang linting pass before
any optimization pass, which can crash if the given code has unbound
variables, something that is detected by core_lint.
Merge branch 'nox/fix-bc-optim/OTP-11005' into maint

* nox/fix-bc-optim/OTP-11005:
  Add a new option +clint0 to the compiler
  Fix optimization of some binary comprehensions
Use erlang:demonitor(Ref, [flush]) where applicable
Move let expressions into sequences

The Core Erlang compiler simplifies let expressions by moving them
into their argument when it is another let or a case expression.
It can then perform other optimizations such as removing the let
expressions altogether, sometimes saving BEAM registers later in
the process.

This commit teaches sys_core_fold how to move let expressions into
sequence arguments.
Use a set to store ref registers in beam_receive

In some circumstances, as when inlining code, when some optimization
passes are disabled or with hand-written but semantically correct Core
Erlang or BEAM assembly, a fresh reference may be live in more than one
register:

    ...
    {allocate_zero,2,2}.
    ...
    {call_ext,0,{extfunc,erlang,make_ref,0}}. % Ref in [x0]
    ...
    {move,{x,0},{y,0}}. % Ref in [x0,y0]
    {move,{y,1},{x,0}}. % Ref in [y0]
    ...
    {move,{y,0},{x,0}}. % Ref in [x0,y0]
    {move,{x,0},{y,1}}. % Ref in [x0,y0,y1]
  {label,5}.
    {loop_rec,{f,6},{x,0}}. % Ref in [y0,y1]
    ...
    {loop_rec_end,{f,5}}.
  {label,6}.
    {wait,{f,5}}.
    ...

Pass beam_receive expects a single live register for the ref when it
encounters the loop_rec instruction and crashes with the following
reason:

$ erlc t.S
...
crash reason: {{case_clause,
                   {'EXIT',
                       {{case_clause,[{y,1},{y,0}]},
                        [{beam_receive,opt_recv,5,
                             [{file,"beam_receive.erl"},{line,154}]},
                         ...]}}},
               ...}

This commit teaches beam_receive how to use a set of registers instead
of a single one when tracking fresh references, thus avoiding the crash.
Merge branch 'nox/move-let-into-seq/OTP-11056'

* nox/move-let-into-seq/OTP-11056:
  Move let expressions into sequences
Remove the "coding: utf-8" comment from all Erlang source files
Convert XML files to UTF-8, where needed
Convert XML files to UTF-8
Merge branch 'hb/unicode/OTP-10907'

* hb/unicode/OTP-10907:
  otp_SUITE: Add test cases to ensure that OTP conventions are obeyed
  Convert XML files to UTF-8
  Convert XML files to UTF-8, where needed
  Remove the "coding: utf-8" comment from all Erlang source files
  Update primary bootstrap
  Change the default encoding of Erlang files to UTF-8
Merge branch 'maint'
beam_lib, compile: Replace use of deprecated crypto functions

Since both the STDLIB and compiler applications turn warnings
into errors, we must stop using the old deprecated crypto functions.

While we are at it, generalize the format of the key tuple returned
by beam_lib:make_crypto_key/2 to facilitate introducing new crypto
methods in the future. Change the format to:

  {Type,Key,IV,BlockSize}

where Type, Key, and IV are the first three arguments for either
crypto:block_encrypt4/ or crypto:block_decrypt/4, and BlockSize
is the block size for the crypto algorithm (it is needed to properly
pad the plaintext blocks before encryption).
Fix renaming of bs_put_string instructions

The clause was formerly commented-out because at this point in the code,
no bs_put_string instruction has been generated yet when compiling from
Erlang.

If an Erlang module is compiled to BEAM assembly and the result contains
a bs_put_string instruction, the output can't be compiled to binary
anymore and the compiler crashes with the following error:

$ erlc prs.S
Function: compress/1
prs.S:none: internal error in beam_block;
crash reason: {{case_clause,
                   {'EXIT',
                       {function_clause,
                           [{beam_utils,live_opt,
                                [[{bs_put_string,1,{string,[0]}},
                                  {bs_init,
                                      {f,0},
                                      {bs_append,0,8,{field_flags,[]}},
                                      0,
                                      [{integer,8},{x,0}],
                                      {x,1}},
                                  {label,2}],
                                 2,
                                 {1,{1,1,nil,nil}},
                                 [{block,
                                      [{'%live',2},
                                       {set,[{x,0}],[{x,1}],move},
                                       {'%live',1}]},
                                  return]],
                                [{file,"beam_utils.erl"},{line,639}]},
                            {beam_utils,live_opt,1,
                                [{file,"beam_utils.erl"},{line,205}]},
                            {beam_block,function,2,
                                [{file,"beam_block.erl"},{line,38}]},
                            {lists,mapfoldl,3,
                                [{file,"lists.erl"},{line,1329}]},
                            {beam_block,module,2,
                                [{file,"beam_block.erl"},{line,29}]},
                            {compile,'-select_passes/2-anonymous-2-',2,
                                [{file,"compile.erl"},{line,476}]},
                            {compile,'-internal_comp/4-anonymous-1-',2,
                                [{file,"compile.erl"},{line,276}]},
                            {compile,fold_comp,3,
                                [{file,"compile.erl"},{line,294}]}]}}},
               [{compile,'-select_passes/2-anonymous-2-',2,
                    [{file,"compile.erl"},{line,476}]},
                {compile,'-internal_comp/4-anonymous-1-',2,
                    [{file,"compile.erl"},{line,276}]},
                {compile,fold_comp,3,[{file,"compile.erl"},{line,294}]},
                {compile,internal_comp,4,[{file,"compile.erl"},{line,278}]},
                {compile,'-do_compile/2-anonymous-0-',2,
                    [{file,"compile.erl"},{line,152}]}]}
Merge remote-tracking branch 'upstream/maint'

Conflicts:
	bootstrap/lib/stdlib/ebin/beam_lib.beam
	lib/public_key/test/erl_make_certs.erl
compiler: Correct liveness optimization for wait/1

The live optimization in beam_utils:live_opt/4 did not take into
account that the wait/1 instruction *never* falls through to
the next instruction (it has the same effect on the control flow
as the jump/1 instruction).
Merge branch 'maint'
Merge branch 'bjorn/compiler/fix-compiler-crash/OTP-11119' into maint

* bjorn/compiler/fix-compiler-crash/OTP-11119:
  compiler: Correct liveness optimization for wait/1
Merge branch 'maint'

* maint:
  compiler: Correct liveness optimization for wait/1