Skip to content

Add Yul Optimizer Step to Evaluate Yul constant Functions #15358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 55 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
60da2ac
Move test/tools/yulInterpreter to libyul/tools/interpreter
quangloc99 Aug 19, 2024
4dd061a
Add UnsupportedBuiltinFunctionEvaluated exception
quangloc99 Aug 21, 2024
c5862cd
Add test for unsupported_builtin_function_evaulated
quangloc99 Aug 21, 2024
561f2ef
Assert the literal to be limited.
quangloc99 Aug 21, 2024
d5906dc
Add class ConstantFunctionEvaluator with basic info
quangloc99 Aug 21, 2024
134dae7
Override interpreter to check for arithmetic only expression
quangloc99 Aug 21, 2024
91e2c27
Add overriden visit FunctionCall method to ConstantFunctionEvaluator
quangloc99 Aug 22, 2024
f8d6955
Add visit block logic for ConstantFunctionEvaluator
quangloc99 Aug 22, 2024
d7527c8
Register ConstantFunctionEvaluator in the Suite
quangloc99 Aug 22, 2024
c0726b4
Add ConstantFunctionEvaluator to the DefaultYulOptimiserSteps
quangloc99 Aug 22, 2024
f028985
Add ConstantFunctionEvaluator to YulOptimizerTestCommon
quangloc99 Aug 22, 2024
06700f4
std::move newBody to _function.body
quangloc99 Aug 22, 2024
f2a1142
Add new optimisation step to cmake
quangloc99 Aug 22, 2024
e053ce2
Invoke the optimizer step
quangloc99 Aug 22, 2024
b0e4d35
Add missing overriden evaluateMulti
quangloc99 Aug 22, 2024
0451498
Bring back old behavior when evaluating unlimited literal
quangloc99 Aug 22, 2024
a040375
Add getValueForUnlimitedLiteral in Interpreter
quangloc99 Aug 22, 2024
dc11602
Disallow unlimited literal in ArithmeticOnlyExpressionEvaluator
quangloc99 Aug 22, 2024
1e8c9de
Add a few tests
quangloc99 Aug 22, 2024
426af2a
Add lots_of_dependent_constants test
quangloc99 Aug 23, 2024
656c615
Update stack_compressor_msize test
quangloc99 Aug 23, 2024
341a077
Add nested_expression test
quangloc99 Aug 23, 2024
b2d8575
Add nested_function test
quangloc99 Aug 23, 2024
7a31ceb
Add recursive_calls_to_eachother test
quangloc99 Aug 23, 2024
0dbe61a
Override makeInterpreter* function of ExpressionEvaluator
quangloc99 Aug 23, 2024
ec02bc9
Add branch_with_sideeffect test
quangloc99 Aug 23, 2024
3260348
Add deeply_nested_with_sideeffect test
quangloc99 Aug 23, 2024
9161063
Whitelist POP instruction
quangloc99 Aug 23, 2024
6abc828
Add no_return_variables test
quangloc99 Aug 23, 2024
94ad59d
Add prime_check test
quangloc99 Aug 23, 2024
9cd6dfc
Add slow_gcd test to test break and continue
quangloc99 Aug 23, 2024
a275aca
Add test for all arithmetic operations
quangloc99 Aug 23, 2024
3248b64
Black list a few more builtin functions
quangloc99 Aug 23, 2024
0b80459
Add all_side_effects test
quangloc99 Aug 23, 2024
5844e2b
Clean up includes
quangloc99 Aug 23, 2024
4716350
Minor comment fix
quangloc99 Aug 23, 2024
27b6362
Fix styling
quangloc99 Aug 23, 2024
e5ac205
Fix spelling
quangloc99 Aug 23, 2024
82c7a17
Remove unused m_ast private variable
quangloc99 Aug 24, 2024
104e915
Add nested_functions_not_toplevel test
quangloc99 Aug 24, 2024
4612b9d
Update chromosome test to include new optimization step
quangloc99 Aug 24, 2024
4d1c2b6
Add recursive_multi_return test
quangloc99 Aug 24, 2024
45a1223
Add recursionDepth to interpreter
quangloc99 Aug 24, 2024
03e1818
Add recursionDepth into Inspector
quangloc99 Aug 24, 2024
8a91a51
Set upper bound for recursion depth in yul interpreter test
quangloc99 Aug 24, 2024
165a67f
Add and limit recursionDepth in ConstantFunctionEvaluator
quangloc99 Aug 24, 2024
4201a80
Update ConstantFunctionEvaluator tests
quangloc99 Aug 24, 2024
39f2896
Add EVM version to tests
quangloc99 Aug 24, 2024
cbe49ba
Assign debug data of literal as the debug data of the function itself.
quangloc99 Aug 24, 2024
e56f0ea
Update cmdlineTests
quangloc99 Aug 24, 2024
ecd48c0
Merge branch 'develop' into yul-opt-const-func
quangloc99 Sep 2, 2024
92aa297
Remove type assignment for literal
quangloc99 Sep 2, 2024
dfa525f
Minor formatting
quangloc99 Sep 2, 2024
44ccb2e
Merge branch 'develop' into yul-opt-const-func
quangloc99 Sep 3, 2024
0cf0a77
Revert yulInterpreter in test
quangloc99 Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libsolidity/interface/OptimiserSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct OptimiserSettings
"xa[r]EscLM" // Turn into SSA and simplify
"Vcul [j]" // Reverse SSA

"k" // preprocessing after some simplifications

// should have good "compilability" property here.

"Trpeul" // Run functional expression inliner
Expand Down
6 changes: 6 additions & 0 deletions libyul/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ add_library(yul
optimiser/ConditionalUnsimplifier.h
optimiser/ControlFlowSimplifier.cpp
optimiser/ControlFlowSimplifier.h
optimiser/ConstantFunctionEvaluator.cpp
optimiser/ConstantFunctionEvaluator.h
optimiser/DataFlowAnalyzer.cpp
optimiser/DataFlowAnalyzer.h
optimiser/DeadCodeEliminator.cpp
Expand Down Expand Up @@ -192,6 +194,10 @@ add_library(yul
optimiser/VarDeclInitializer.h
optimiser/VarNameCleaner.cpp
optimiser/VarNameCleaner.h
tools/interpreter/Interpreter.h
tools/interpreter/Interpreter.cpp
tools/interpreter/EVMInstructionInterpreter.h
tools/interpreter/EVMInstructionInterpreter.cpp
)

target_link_libraries(yul PUBLIC evmasm solutil langutil smtutil fmt::fmt-header-only)
Loading