mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use side effects of user-defined functions in other optimizer steps.
This commit is contained in:
@@ -31,12 +31,15 @@ namespace solidity::yul
|
||||
{
|
||||
struct Dialect;
|
||||
struct OptimiserStepContext;
|
||||
struct ControlFlowSideEffects;
|
||||
|
||||
/**
|
||||
* Optimisation stage that removes unreachable code
|
||||
*
|
||||
* Unreachable code is any code within a block which is preceded by a
|
||||
* leave, return, invalid, break, continue, selfdestruct or revert.
|
||||
* leave, return, invalid, break, continue, selfdestruct or revert or
|
||||
* a call to a user-defined function that never returns (either due to
|
||||
* recursion or a call to return / revert / stop).
|
||||
*
|
||||
* Function definitions are retained as they might be called by earlier
|
||||
* code and thus are considered reachable.
|
||||
@@ -57,9 +60,13 @@ public:
|
||||
void operator()(Block& _block) override;
|
||||
|
||||
private:
|
||||
DeadCodeEliminator(Dialect const& _dialect): m_dialect(_dialect) {}
|
||||
DeadCodeEliminator(
|
||||
Dialect const& _dialect,
|
||||
std::map<YulString, ControlFlowSideEffects> const& _sideEffects
|
||||
): m_dialect(_dialect), m_functionSideEffects(_sideEffects) {}
|
||||
|
||||
Dialect const& m_dialect;
|
||||
std::map<YulString, ControlFlowSideEffects> const& m_functionSideEffects;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user