diff --git a/docs/internals/optimizer.rst b/docs/internals/optimizer.rst index 741b6bbb93ce..bd3bac48e024 100644 --- a/docs/internals/optimizer.rst +++ b/docs/internals/optimizer.rst @@ -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 `_ to opcodes. It also combines equal code sets and removes unused code. @@ -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.