Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel <daniel@ekpyron.org>
  • Loading branch information
matheusaaguiar and ekpyron authored Oct 30, 2023
1 parent 3c09b19 commit d65bbdc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/internals/optimizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
The Optimizer
*************

The Solidity compiler uses three different optimizer modules: The "old" optimizer
that operates at the opcode level and two "new" optimizers, one that operates on Yul IR code
and another that removes unnecessary overflow checks of code generation of ``for`` loops.
The Solidity compiler involves optimizations at three different levels (in order of execution):
- Optimizations in code generation based on a direct analysis of solidity code.
- Optimizing transformations on the Yul IR code.
- Optimizations on the opcode level.

The opcode-based optimizer applies a set of `simplification rules <https://github.com/ethereum/solidity/blob/develop/libevmasm/RuleList.h>`_
to opcodes. It also combines equal code sets and removes unused code.
Expand All @@ -21,8 +22,8 @@ the function calls. Similarly, if a function is
side-effect free and its result is multiplied by zero, you can remove the function
call completely.

The codegen-based optimizer is a single step that makes the compiler use unchecked
arithmetic when generating code of a ``for`` loop counter variable increment.
The codegen-based optimizer currently consists of a single step that makes the compiler use unchecked
arithmetic when generating code for the counter variable increment of certain ``for`` loops.

Currently, the parameter ``--optimize`` activates the opcode-based optimizer for the
generated bytecode and the Yul optimizer for the Yul code generated internally, for example for ABI coder v2.
Expand Down

0 comments on commit d65bbdc

Please sign in to comment.