mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Evaluate keccak(a, const) if value at memory location a is known
Here the value of constant can be at most 32.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <libyul/AST.h>
|
||||
#include <libyul/Dialect.h>
|
||||
#include <libyul/Exceptions.h>
|
||||
#include <libyul/Utilities.h>
|
||||
|
||||
#include <libsolutil/CommonData.h>
|
||||
#include <libsolutil/cxx20.h>
|
||||
@@ -388,6 +389,14 @@ bool DataFlowAnalyzer::inScope(YulString _variableName) const
|
||||
return false;
|
||||
}
|
||||
|
||||
optional<u256> DataFlowAnalyzer::valueOfIdentifier(YulString const& _name)
|
||||
{
|
||||
if (m_value.count(_name))
|
||||
if (Literal const* literal = get_if<Literal>(m_value.at(_name).value))
|
||||
return valueOfLiteral(*literal);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
std::optional<pair<YulString, YulString>> DataFlowAnalyzer::isSimpleStore(
|
||||
StoreLoadLocation _location,
|
||||
ExpressionStatement const& _statement
|
||||
@@ -412,4 +421,3 @@ std::optional<YulString> DataFlowAnalyzer::isSimpleLoad(
|
||||
return key->name;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user