Skip to content

Commit 1b7652e

Browse files
authored
Merge pull request #14597 from ethereum/add-steps-to-full-simplify
Add required steps to fullSimplify step.
2 parents b187d06 + a3ad63e commit 1b7652e

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

test/libyul/YulOptimizerTestCommon.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ YulOptimizerTestCommon::YulOptimizerTestCommon(
194194
}},
195195
{"fullSimplify", [&]() {
196196
disambiguate();
197+
FunctionGrouper::run(*m_context, *m_ast);
198+
BlockFlattener::run(*m_context, *m_ast);
197199
ExpressionSplitter::run(*m_context, *m_ast);
198200
ForLoopInitRewriter::run(*m_context, *m_ast);
199201
FunctionHoister::run(*m_context, *m_ast);
@@ -259,6 +261,8 @@ YulOptimizerTestCommon::YulOptimizerTestCommon(
259261
}},
260262
{"loadResolver", [&]() {
261263
disambiguate();
264+
FunctionGrouper::run(*m_context, *m_ast);
265+
BlockFlattener::run(*m_context, *m_ast);
262266
ForLoopInitRewriter::run(*m_context, *m_ast);
263267
FunctionHoister::run(*m_context, *m_ast);
264268
ExpressionSplitter::run(*m_context, *m_ast);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
function f(x) {}
3+
let x
4+
{
5+
x := add(1, calldataload(0))
6+
}
7+
f(call(2, 0, 1, mod(x, 8), 1, 1, 1))
8+
}
9+
// ----
10+
// step: fullSimplify
11+
//
12+
// {
13+
// {
14+
// let x_1
15+
// let _2 := calldataload(x_1)
16+
// let _3 := 1
17+
// x_1 := add(_3, _2)
18+
// pop(call(2, 0, _3, addmod(_3, _2, 8), _3, _3, _3))
19+
// }
20+
// }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
let x
3+
{
4+
let y := msize()
5+
x := add(4, y)
6+
}
7+
x := keccak256(0, mod(x, 2))
8+
}
9+
// ----
10+
// step: loadResolver
11+
//
12+
// {
13+
// {
14+
// let x
15+
// let y := msize()
16+
// let _1 := 4
17+
// x := add(_1, y)
18+
// x := keccak256(0, addmod(_1, y, 2))
19+
// }
20+
// }

0 commit comments

Comments
 (0)