<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/src/Makefile, branch maint-22</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>compiler: Add missing header dependencies</title>
<updated>2019-04-10T13:12:11+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-04-10T08:22:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a2d73d0e36be1b7e614b75bef0059eb1a1e3e1dd'/>
<id>a2d73d0e36be1b7e614b75bef0059eb1a1e3e1dd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>HiPE: Don't fail the compilation for unimplemented instructions</title>
<updated>2019-03-20T15:19:30+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-03-11T12:15:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=4e0430638635083c199f81375a6c14f2ffb726fb'/>
<id>4e0430638635083c199f81375a6c14f2ffb726fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Do the destructive setelement optimization in SSA</title>
<updated>2019-02-19T09:18:08+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-02-18T13:33:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=26c93c06ebb9b1585418d463142f63bdca071f85'/>
<id>26c93c06ebb9b1585418d463142f63bdca071f85</id>
<content type='text'>
The expansion of record field updates, when more than one field is
updated, but not a majority of the fields, will create a sequence of
calls to `erlang:setelement(Index, Value, Tuple)` where Tuple in the
first call is the original record tuple, and in the subsequent calls
Tuple is the result of the previous call. Furthermore, all Index
values are constant positive integers, and the first call to
`setelement` will have the greatest index. Thus all the following
calls do not actually need to test at run-time whether Tuple has type
tuple, nor that the index is within the tuple bounds.

Since OTP R7, the `sys_core_dsetel` pass, run as the very last Core
Erlang pass, has optimized this sequence of `setelement` calls to use
a special destructive version of `setelement` (called
`set_tuple_element`) for all but the very first `setelement` in the
sequence.

It turns out that the presence of the `set_tuple_element` in SSA code
is awkward and can prevent or complicate type analysis and aggressive
optimizations.

Therefore, this commit removes the `sys_core_dsetel` pass and
reimplements it for SSA code. The optimization will be done in the
`beam_ssa_pre_codegen` pass (that is, just before code generation and
after running all other SSA code optimization passes).

In most cases, the resulting BEAM code is identical to previous
code. For a few modules, the BEAM code is actually slightly better,
with smaller stack frames.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The expansion of record field updates, when more than one field is
updated, but not a majority of the fields, will create a sequence of
calls to `erlang:setelement(Index, Value, Tuple)` where Tuple in the
first call is the original record tuple, and in the subsequent calls
Tuple is the result of the previous call. Furthermore, all Index
values are constant positive integers, and the first call to
`setelement` will have the greatest index. Thus all the following
calls do not actually need to test at run-time whether Tuple has type
tuple, nor that the index is within the tuple bounds.

Since OTP R7, the `sys_core_dsetel` pass, run as the very last Core
Erlang pass, has optimized this sequence of `setelement` calls to use
a special destructive version of `setelement` (called
`set_tuple_element`) for all but the very first `setelement` in the
sequence.

It turns out that the presence of the `set_tuple_element` in SSA code
is awkward and can prevent or complicate type analysis and aggressive
optimizations.

Therefore, this commit removes the `sys_core_dsetel` pass and
reimplements it for SSA code. The optimization will be done in the
`beam_ssa_pre_codegen` pass (that is, just before code generation and
after running all other SSA code optimization passes).

In most cases, the resulting BEAM code is identical to previous
code. For a few modules, the BEAM code is actually slightly better,
with smaller stack frames.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_ssa_opt: Add a scaffold for module-level optimizations</title>
<updated>2019-01-24T07:25:28+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-01-10T16:06:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=1c73a313e72909d054f55e321c1929d2be55ff11'/>
<id>1c73a313e72909d054f55e321c1929d2be55ff11</id>
<content type='text'>
This serves as a base for the upcoming module-level type
optimization, but may come in handy for other passes like
beam_ssa_funs and beam_ssa_bsm that have their own ad-hoc
implementations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This serves as a base for the upcoming module-level type
optimization, but may come in handy for other passes like
beam_ssa_funs and beam_ssa_bsm that have their own ad-hoc
implementations.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move optimizations of bs_put* instruction to beam_ssa_opt</title>
<updated>2019-01-16T12:06:00+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-01-13T09:52:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d4248d50ec9b2b27b2e000bd414f249c71f34c17'/>
<id>d4248d50ec9b2b27b2e000bd414f249c71f34c17</id>
<content type='text'>
Do the optimizations of bs_put* instructions in beam_ssa_opt
and remove the beam_bs pass. This can lead to a slight improvement
of compilation times.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do the optimizations of bs_put* instructions in beam_ssa_opt
and remove the beam_bs pass. This can lead to a slight improvement
of compilation times.
</pre>
</div>
</content>
</entry>
<entry>
<title>Share the code for semantically equivalent blocks</title>
<updated>2018-11-28T10:36:33+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-10-31T18:45:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=555b633acadc39b4b38d920fd678d7a2cc7407e6'/>
<id>555b633acadc39b4b38d920fd678d7a2cc7407e6</id>
<content type='text'>
Share code for semantically equivalent blocks referred to to by `br`
and `switch` instructions.

A similar optimization is done in `beam_jump`, but doing it here as
well is beneficial as it may enable other optimizations. Also, if
there are many semantically equivalent clauses, this optimization can
substanstially decrease compilation times.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Share code for semantically equivalent blocks referred to to by `br`
and `switch` instructions.

A similar optimization is done in `beam_jump`, but doing it here as
well is beneficial as it may enable other optimizations. Also, if
there are many semantically equivalent clauses, this optimization can
substanstially decrease compilation times.
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize named funs and fun-wrapped macros</title>
<updated>2018-10-03T11:42:10+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2018-10-01T13:23:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=31a4c1d65c24d8240d5d46d8cffe81097ebb28bf'/>
<id>31a4c1d65c24d8240d5d46d8cffe81097ebb28bf</id>
<content type='text'>
If a fun is defined locally and only used for calls, it can be replaced
with direct calls to the relevant function. This greatly speeds up "named
functions" (which rely on make_fun to recreate themselves) and macros that
wrap their body in a fun.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a fun is defined locally and only used for calls, it can be replaced
with direct calls to the relevant function. This greatly speeds up "named
functions" (which rely on make_fun to recreate themselves) and macros that
wrap their body in a fun.
</pre>
</div>
</content>
</entry>
<entry>
<title>Rewrite BSM optimizations in the new SSA-based intermediate format</title>
<updated>2018-09-28T09:31:57+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2018-05-08T06:52:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=fd6246c5191d07b80bc7100b470a37a338accecd'/>
<id>fd6246c5191d07b80bc7100b470a37a338accecd</id>
<content type='text'>
This commit improves the bit-syntax match optimization pass,
leveraging the new SSA intermediate format to perform much more
aggressive optimizations. Some highlights:

* Watch contexts can be reused even after being passed to a
  function or being used in a try block.
* Sub-binaries are no longer eagerly extracted, making it far
  easier to keep "happy paths" free from binary creation.
* Trivial wrapper functions no longer disable context reuse.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit improves the bit-syntax match optimization pass,
leveraging the new SSA intermediate format to perform much more
aggressive optimizations. Some highlights:

* Watch contexts can be reused even after being passed to a
  function or being used in a try block.
* Sub-binaries are no longer eagerly extracted, making it far
  easier to keep "happy paths" free from binary creation.
* Trivial wrapper functions no longer disable context reuse.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove the beam_dead and beam_split passes</title>
<updated>2018-09-17T08:04:35+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-09-04T12:03:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=0871e4e581d3679c61b82f5552adc9192399d815'/>
<id>0871e4e581d3679c61b82f5552adc9192399d815</id>
<content type='text'>
Most of the optimizations in beam_dead have been superseded
by the optimizations in beam_ssa_dead.

The forward/1 pass of beam_dead has been moved to beam_jump.

The beam_split pass splits blocks that contain instructions with
non-zero labels. Because there are no optimizations left that optimize
instructions within blocks, beam_block never needs to put such
instructions into blocks in the first place.  beam_split also moved
'move' instructions out block to help beam_dead. That is no longer
necessary since beam_dead no longer exists.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most of the optimizations in beam_dead have been superseded
by the optimizations in beam_ssa_dead.

The forward/1 pass of beam_dead has been moved to beam_jump.

The beam_split pass splits blocks that contain instructions with
non-zero labels. Because there are no optimizations left that optimize
instructions within blocks, beam_block never needs to put such
instructions into blocks in the first place.  beam_split also moved
'move' instructions out block to help beam_dead. That is no longer
necessary since beam_dead no longer exists.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add beam_ssa_dead.erl</title>
<updated>2018-09-17T04:41:02+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-08-21T06:58:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=70bb14fe3fd27e8c429bf402e364b144a5807d9a'/>
<id>70bb14fe3fd27e8c429bf402e364b144a5807d9a</id>
<content type='text'>
Add beam_ssa_dead to perform the main optimizations done
by beam_dead:

* Shortcut branches that jump to another block with a branch.
If it can be seen that the second branch will always branch
to a specific block, replace the target of the first branch.

* Combined nested sequences of '=:=' tests and switch
instructions operating on the same variable to a single switch.

Diffing the compiler output, it seems that beam_ssa_dead finds
many more opportunities for optimizations than beam_dead,
although it does not find all opportunities that beam_dead does.
In total, beam_ssa_dead is such improvement over beam_dead that
there is no reason to keep beam_dead as well as beam_ssa_dead.

Note that beam_ssa_dead does not attempt to optimize away
redundant bs_context_binary instructions, because that instruction
will be superseded by new instructions in the near future.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add beam_ssa_dead to perform the main optimizations done
by beam_dead:

* Shortcut branches that jump to another block with a branch.
If it can be seen that the second branch will always branch
to a specific block, replace the target of the first branch.

* Combined nested sequences of '=:=' tests and switch
instructions operating on the same variable to a single switch.

Diffing the compiler output, it seems that beam_ssa_dead finds
many more opportunities for optimizations than beam_dead,
although it does not find all opportunities that beam_dead does.
In total, beam_ssa_dead is such improvement over beam_dead that
there is no reason to keep beam_dead as well as beam_ssa_dead.

Note that beam_ssa_dead does not attempt to optimize away
redundant bs_context_binary instructions, because that instruction
will be superseded by new instructions in the near future.
</pre>
</div>
</content>
</entry>
</feed>
