Skip to content

Commit

Permalink
Merge pull request #14370 from ethereum/smt-cleanup
Browse files Browse the repository at this point in the history
Remove ReasoningBasedSimplifier from libyul
  • Loading branch information
ekpyron authored Jun 28, 2023
2 parents c819243 + 29041c8 commit 30cd1a0
Show file tree
Hide file tree
Showing 23 changed files with 3 additions and 863 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Compiler Features:
* SMTChecker: Add ``--model-checker-print-query`` CLI option and ``settings.modelChecker.printQuery`` JSON option to output the SMTChecker queries in the SMTLIB2 format. This requires using `smtlib2` solver only.
* Standard JSON Interface: Add ``ast`` file-level output for Yul input.
* Standard JSON Interface: Add ``irAst`` and ``irOptimizedAst`` contract-level outputs for Solidity input, providing AST in compact JSON format for IR and optimized IR.
* Yul Optimizer: Remove experimental `ReasoningBasedSimplifier` optimization step.
* Yul Optimizer: Stack-to-memory mover is now enabled by default whenever possible for via IR code generation and pure Yul compilation.


Expand Down
21 changes: 0 additions & 21 deletions docs/internals/optimizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ Abbreviation Full name
``L`` :ref:`load-resolver`
``M`` :ref:`loop-invariant-code-motion`
``r`` :ref:`redundant-assign-eliminator`
``R`` :ref:`reasoning-based-simplifier` - highly experimental
``m`` :ref:`rematerialiser`
``V`` :ref:`SSA-reverser`
``a`` :ref:`SSA-transform`
Expand All @@ -330,10 +329,6 @@ Abbreviation Full name
Some steps depend on properties ensured by ``BlockFlattener``, ``FunctionGrouper``, ``ForLoopInitRewriter``.
For this reason the Yul optimizer always applies them before applying any steps supplied by the user.

The ReasoningBasedSimplifier is an optimizer step that is currently not enabled
in the default set of steps. It uses an SMT solver to simplify arithmetic expressions
and boolean conditions. It has not received thorough testing or validation yet and can produce
non-reproducible results, so please use with care!

Selecting Optimizations
-----------------------
Expand Down Expand Up @@ -863,22 +858,6 @@ Works best if the code is in SSA form.

Prerequisite: Disambiguator, ForLoopInitRewriter.

.. _reasoning-based-simplifier:

ReasoningBasedSimplifier
^^^^^^^^^^^^^^^^^^^^^^^^

This optimizer uses SMT solvers to check whether ``if`` conditions are constant.

- If ``constraints AND condition`` is UNSAT, the condition is never true and the whole body can be removed.
- If ``constraints AND NOT condition`` is UNSAT, the condition is always true and can be replaced by ``1``.

The simplifications above can only be applied if the condition is movable.

It is only effective on the EVM dialect, but safe to use on other dialects.

Prerequisite: Disambiguator, SSATransform.

Statement-Scale Simplifications
-------------------------------

Expand Down
4 changes: 0 additions & 4 deletions libyul/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ add_library(yul
optimiser/OptimiserStep.h
optimiser/OptimizerUtilities.cpp
optimiser/OptimizerUtilities.h
optimiser/ReasoningBasedSimplifier.cpp
optimiser/ReasoningBasedSimplifier.h
optimiser/UnusedAssignEliminator.cpp
optimiser/UnusedAssignEliminator.h
optimiser/UnusedStoreBase.cpp
Expand All @@ -153,8 +151,6 @@ add_library(yul
optimiser/UnusedStoreEliminator.h
optimiser/Rematerialiser.cpp
optimiser/Rematerialiser.h
optimiser/SMTSolver.cpp
optimiser/SMTSolver.h
optimiser/SSAReverser.cpp
optimiser/SSAReverser.h
optimiser/SSATransform.cpp
Expand Down
228 changes: 0 additions & 228 deletions libyul/optimiser/ReasoningBasedSimplifier.cpp

This file was deleted.

75 changes: 0 additions & 75 deletions libyul/optimiser/ReasoningBasedSimplifier.h

This file was deleted.

Loading

0 comments on commit 30cd1a0

Please sign in to comment.