Do not overwrite allowMSizeOptimization

This commit is contained in:
chriseth
2019-07-16 10:13:18 +02:00
parent 579bdaddb9
commit a0a0a34a21
4 changed files with 45 additions and 5 deletions
+2 -4
View File
@@ -119,15 +119,13 @@ void UnusedPruner::operator()(Block& _block)
void UnusedPruner::runUntilStabilised(
Dialect const& _dialect,
Block& _ast,
bool _allowMSizeOptization,
bool _allowMSizeOptimization,
set<YulString> const& _externallyUsedFunctions
)
{
_allowMSizeOptization = !SideEffectsCollector(_dialect, _ast).containsMSize();
while (true)
{
UnusedPruner pruner(_dialect, _ast, _allowMSizeOptization, _externallyUsedFunctions);
UnusedPruner pruner(_dialect, _ast, _allowMSizeOptimization, _externallyUsedFunctions);
pruner(_ast);
if (!pruner.shouldRunAgain())
return;
+6 -1
View File
@@ -34,6 +34,11 @@ struct Dialect;
* Optimisation stage that removes unused variables and functions and also
* removes side-effect-free expression statements.
*
* If msize is used, we cannot remove any statements that access memory.
* Because of that, the Unused Pruner should only be invoked on full ASTs,
* such that it can check for the presence of msize itself, or
* the `_allowMSizeOptimization` needs to be passed.
*
* Note that this does not remove circular references.
*
* Prerequisite: Disambiguator
@@ -64,7 +69,7 @@ public:
static void runUntilStabilised(
Dialect const& _dialect,
Block& _ast,
bool _allowMSizeOptization,
bool _allowMSizeOptimization,
std::set<YulString> const& _externallyUsedFunctions = {}
);