mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test case that shows that break/unbreak are more or less inverse.
This commit is contained in:
parent
cbd0116e98
commit
5ea514213a
@ -118,6 +118,19 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con
|
||||
NameDispenser nameDispenser(*m_ast);
|
||||
ExpressionSplitter{nameDispenser}(*m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "expressionJoiner")
|
||||
{
|
||||
disambiguate();
|
||||
ExpressionJoiner::run(*m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "splitJoin")
|
||||
{
|
||||
disambiguate();
|
||||
NameDispenser nameDispenser(*m_ast);
|
||||
ExpressionSplitter{nameDispenser}(*m_ast);
|
||||
ExpressionJoiner::run(*m_ast);
|
||||
ExpressionJoiner::run(*m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "functionGrouper")
|
||||
{
|
||||
disambiguate();
|
||||
@ -175,11 +188,6 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con
|
||||
disambiguate();
|
||||
UnusedPruner::runUntilStabilised(*m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "expressionJoiner")
|
||||
{
|
||||
disambiguate();
|
||||
ExpressionJoiner::run(*m_ast);\
|
||||
}
|
||||
else if (m_optimizerStep == "ssaTransform")
|
||||
{
|
||||
disambiguate();
|
||||
|
26
test/libyul/yulOptimizerTests/splitJoin/control_flow.yul
Normal file
26
test/libyul/yulOptimizerTests/splitJoin/control_flow.yul
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
if mul(add(calldataload(0), 2), 3) {
|
||||
for { let a := 2 } lt(a, mload(a)) { a := add(a, mul(a, 2)) } {
|
||||
let b := mul(add(a, 2), 4)
|
||||
sstore(b, mul(b, 2))
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// splitJoin
|
||||
// {
|
||||
// if mul(add(calldataload(0), 2), 3)
|
||||
// {
|
||||
// for {
|
||||
// let a := 2
|
||||
// }
|
||||
// lt(a, mload(a))
|
||||
// {
|
||||
// a := add(a, mul(a, 2))
|
||||
// }
|
||||
// {
|
||||
// let b := mul(add(a, 2), 4)
|
||||
// sstore(b, mul(b, 2))
|
||||
// }
|
||||
// }
|
||||
// }
|
30
test/libyul/yulOptimizerTests/splitJoin/functions.yul
Normal file
30
test/libyul/yulOptimizerTests/splitJoin/functions.yul
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
let x := f(0)
|
||||
function f(y) -> r {
|
||||
r := mload(mul(6, add(y, 0x20)))
|
||||
}
|
||||
for { let a := 2 } lt(a, mload(a)) { a := add(a, mul(a, 2)) } {
|
||||
let b := mul(add(a, f(a)), 4)
|
||||
sstore(b, mul(b, 2))
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// splitJoin
|
||||
// {
|
||||
// let x := f(0)
|
||||
// function f(y) -> r
|
||||
// {
|
||||
// r := mload(mul(6, add(y, 0x20)))
|
||||
// }
|
||||
// for {
|
||||
// let a := 2
|
||||
// }
|
||||
// lt(a, mload(a))
|
||||
// {
|
||||
// a := add(a, mul(a, 2))
|
||||
// }
|
||||
// {
|
||||
// let b := mul(add(a, f(a)), 4)
|
||||
// sstore(b, mul(b, 2))
|
||||
// }
|
||||
// }
|
5
test/libyul/yulOptimizerTests/splitJoin/smoke.yul
Normal file
5
test/libyul/yulOptimizerTests/splitJoin/smoke.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{}
|
||||
// ----
|
||||
// splitJoin
|
||||
// {
|
||||
// }
|
Loading…
Reference in New Issue
Block a user