mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix removal of memory stores in inline assembly blocks.
This commit is contained in:
parent
14cdb76e4b
commit
51ef6a62da
@ -1,5 +1,9 @@
|
||||
### 0.8.15 (unreleased)
|
||||
|
||||
Important Bugfixes:
|
||||
* Yul Optimizer: Keep all memory side-effects of inline assembly blocks.
|
||||
|
||||
|
||||
Language Features:
|
||||
* Add `E.selector` for a non-anonymous event `E` to access the 32-byte selector topic.
|
||||
* Errors and Events allow qualified access from other contracts.
|
||||
|
@ -485,6 +485,7 @@ void CompilerContext::appendInlineAssembly(
|
||||
obj.code = parserResult;
|
||||
obj.analysisInfo = make_shared<yul::AsmAnalysisInfo>(analysisInfo);
|
||||
|
||||
solAssert(!dialect.providesObjectAccess());
|
||||
optimizeYul(obj, dialect, _optimiserSettings, externallyUsedIdentifiers);
|
||||
|
||||
if (_system)
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <libyul/ControlFlowSideEffectsCollector.h>
|
||||
#include <libyul/AST.h>
|
||||
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
|
||||
#include <libsolutil/CommonData.h>
|
||||
|
||||
#include <libevmasm/Instruction.h>
|
||||
@ -76,7 +78,13 @@ void UnusedStoreEliminator::run(OptimiserStepContext& _context, Block& _ast)
|
||||
ignoreMemory
|
||||
};
|
||||
rse(_ast);
|
||||
rse.changeUndecidedTo(State::Unused, Location::Memory);
|
||||
if (
|
||||
auto evmDialect = dynamic_cast<EVMDialect const*>(&_context.dialect);
|
||||
evmDialect && evmDialect->providesObjectAccess()
|
||||
)
|
||||
rse.changeUndecidedTo(State::Unused, Location::Memory);
|
||||
else
|
||||
rse.changeUndecidedTo(State::Used, Location::Memory);
|
||||
rse.changeUndecidedTo(State::Used, Location::Storage);
|
||||
rse.scheduleUnusedForDeletion();
|
||||
|
||||
|
@ -17,5 +17,5 @@ contract c {
|
||||
// test() ->
|
||||
// gas irOptimized: 142639
|
||||
// gas legacy: 164430
|
||||
// gas legacyOptimized: 157898
|
||||
// gas legacyOptimized: 158513
|
||||
// storageEmpty -> 1
|
||||
|
Loading…
Reference in New Issue
Block a user