Skip to content

Commit 50cded3

Browse files
christianparpartChristian Parpart
authored andcommitted
[yul] Ensures DataFlowAnalyzer works fine with break/continue statements just like without.
1 parent 2896d61 commit 50cded3

File tree

4 files changed

+68
-12
lines changed

4 files changed

+68
-12
lines changed

libyul/optimiser/DataFlowAnalyzer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,6 @@ void DataFlowAnalyzer::operator()(ForLoop& _for)
130130
popScope();
131131
}
132132

133-
void DataFlowAnalyzer::operator()(Break&)
134-
{
135-
yulAssert(false, "Not implemented yet.");
136-
}
137-
138-
void DataFlowAnalyzer::operator()(Continue&)
139-
{
140-
yulAssert(false, "Not implemented yet.");
141-
}
142-
143133
void DataFlowAnalyzer::operator()(Block& _block)
144134
{
145135
size_t numScopes = m_variableScopes.size();

libyul/optimiser/DataFlowAnalyzer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class DataFlowAnalyzer: public ASTModifier
5353
void operator()(Switch& _switch) override;
5454
void operator()(FunctionDefinition&) override;
5555
void operator()(ForLoop&) override;
56-
void operator()(Break& _continue) override;
57-
void operator()(Continue& _continue) override;
5856
void operator()(Block& _block) override;
5957

6058
protected:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
let a
3+
let b
4+
for {let i := 0} lt(i, 10) {i := add(a, b)} {
5+
a := origin()
6+
b := origin()
7+
b := caller()
8+
if callvalue() { break }
9+
a := caller()
10+
}
11+
}
12+
// ----
13+
// rematerialiser
14+
// {
15+
// let a
16+
// let b
17+
// for {
18+
// let i := 0
19+
// }
20+
// lt(i, 10)
21+
// {
22+
// i := add(caller(), caller())
23+
// }
24+
// {
25+
// a := origin()
26+
// b := origin()
27+
// b := caller()
28+
// if callvalue()
29+
// {
30+
// break
31+
// }
32+
// a := caller()
33+
// }
34+
// }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
let a
3+
let b
4+
for {let i := 0} lt(i, 10) {i := add(a, b)} {
5+
a := origin()
6+
b := origin()
7+
b := caller()
8+
if callvalue() { continue }
9+
a := caller()
10+
}
11+
}
12+
// ----
13+
// rematerialiser
14+
// {
15+
// let a
16+
// let b
17+
// for {
18+
// let i := 0
19+
// }
20+
// lt(i, 10)
21+
// {
22+
// i := add(caller(), caller())
23+
// }
24+
// {
25+
// a := origin()
26+
// b := origin()
27+
// b := caller()
28+
// if callvalue()
29+
// {
30+
// continue
31+
// }
32+
// a := caller()
33+
// }
34+
// }

0 commit comments

Comments
 (0)