mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add assertion that DeadCodeEliminator needs ForLoopInitRewriter.
This commit is contained in:
parent
bf5792f7ca
commit
fb06451f45
@ -67,6 +67,12 @@ auto findFirstTerminatingStatement(Block& _block)
|
||||
}
|
||||
}
|
||||
|
||||
void DeadCodeEliminator::operator()(ForLoop& _for)
|
||||
{
|
||||
yulAssert(_for.pre.statements.empty(), "DeadCodeEliminator needs ForLoopInitRewriter as a prerequisite.");
|
||||
ASTModifier::operator()(_for);
|
||||
}
|
||||
|
||||
void DeadCodeEliminator::operator()(Block& _block)
|
||||
{
|
||||
auto& statements = _block.statements;
|
||||
|
@ -47,6 +47,7 @@ class DeadCodeEliminator: public ASTModifier
|
||||
{
|
||||
public:
|
||||
using ASTModifier::operator();
|
||||
void operator()(ForLoop& _for) override;
|
||||
void operator()(Block& _block) override;
|
||||
};
|
||||
|
||||
|
@ -192,6 +192,7 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con
|
||||
disambiguate();
|
||||
NameDispenser nameDispenser{*m_dialect, *m_ast};
|
||||
ExpressionSplitter{*m_dialect, nameDispenser}(*m_ast);
|
||||
ForLoopInitRewriter{}(*m_ast);
|
||||
CommonSubexpressionEliminator{*m_dialect}(*m_ast);
|
||||
ExpressionSimplifier::run(*m_dialect, *m_ast);
|
||||
UnusedPruner::runUntilStabilised(*m_dialect, *m_ast);
|
||||
|
@ -6,8 +6,8 @@
|
||||
// step: fullSimplify
|
||||
// ----
|
||||
// {
|
||||
// let a := 10
|
||||
// for {
|
||||
// let a := 10
|
||||
// }
|
||||
// iszero(iszero(a))
|
||||
// {
|
||||
|
Loading…
Reference in New Issue
Block a user