mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Value Constraint Based Simplifier.
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <libyul/optimiser/MainFunction.h>
|
||||
#include <libyul/optimiser/Rematerialiser.h>
|
||||
#include <libyul/optimiser/ExpressionSimplifier.h>
|
||||
#include <libyul/optimiser/ValueConstraintBasedSimplifier.h>
|
||||
#include <libyul/optimiser/UnusedPruner.h>
|
||||
#include <libyul/optimiser/ExpressionJoiner.h>
|
||||
#include <libyul/optimiser/SSAReverser.h>
|
||||
@@ -182,6 +183,11 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con
|
||||
disambiguate();
|
||||
ExpressionSimplifier::run(*m_dialect, *m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "valueConstraintBasedSimplifier")
|
||||
{
|
||||
disambiguate();
|
||||
ValueConstraintBasedSimplifier::run(*m_dialect, *m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "fullSimplify")
|
||||
{
|
||||
disambiguate();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
let x := 2
|
||||
if lt(x, 9) { sstore(0, 1) }
|
||||
if lt(x, 2) { sstore(0, 1) }
|
||||
if gt(x, 0) { sstore(0, 1) }
|
||||
if lt(9, x) { sstore(0, 1) }
|
||||
if lt(2, x) { sstore(0, 1) }
|
||||
if gt(0, x) { sstore(0, 1) }
|
||||
}
|
||||
// ----
|
||||
// valueConstraintBasedSimplifier
|
||||
// {
|
||||
// let x := 2
|
||||
// if 1
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if 0
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if 1
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if 0
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if 0
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if 0
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
let x := and(callvalue(), 0xff)
|
||||
if lt(x, 0x100) { sstore(0, 1) }
|
||||
if lt(x, 0xff) { sstore(0, 1) }
|
||||
}
|
||||
// ----
|
||||
// valueConstraintBasedSimplifier
|
||||
// {
|
||||
// let x := and(callvalue(), 0xff)
|
||||
// if 1
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// if lt(x, 0xff)
|
||||
// {
|
||||
// sstore(0, 1)
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
}
|
||||
// ----
|
||||
// valueConstraintBasedSimplifier
|
||||
// {
|
||||
// }
|
||||
Reference in New Issue
Block a user