diff options
Diffstat (limited to 'libyul/optimiser/SSAReverser.cpp')
-rw-r--r-- | libyul/optimiser/SSAReverser.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libyul/optimiser/SSAReverser.cpp b/libyul/optimiser/SSAReverser.cpp index 2cfa3d58..6548ebb5 100644 --- a/libyul/optimiser/SSAReverser.cpp +++ b/libyul/optimiser/SSAReverser.cpp @@ -15,6 +15,7 @@ along with solidity. If not, see <http://www.gnu.org/licenses/>. */ #include <libyul/optimiser/SSAReverser.h> +#include <libyul/optimiser/Metrics.h> #include <libyul/AsmData.h> #include <libdevcore/CommonData.h> @@ -22,6 +23,13 @@ using namespace std; using namespace dev; using namespace yul; +void SSAReverser::run(Block& _block) +{ + AssignmentCounter assignmentCounter; + assignmentCounter(_block); + SSAReverser{assignmentCounter}(_block); +} + void SSAReverser::operator()(Block& _block) { walkVector(_block.statements); @@ -47,7 +55,7 @@ void SSAReverser::operator()(Block& _block) assignment->variableNames.size() == 1 && identifier && identifier->name == varDecl->variables.front().name - ) + ) { vector<Statement> result; result.emplace_back(Assignment{ @@ -75,7 +83,10 @@ void SSAReverser::operator()(Block& _block) if ( varDecl2->variables.size() == 1 && identifier && - identifier->name == varDecl->variables.front().name + identifier->name == varDecl->variables.front().name && ( + m_assignmentCounter.assignmentCount(varDecl2->variables.front().name) > + m_assignmentCounter.assignmentCount(varDecl->variables.front().name) + ) ) { vector<Statement> result; |