From 75bed10be56939d7b4a28bfc9fa006f4fe1267d9 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 6 Jan 2021 10:39:19 +0100 Subject: [PATCH] Check for scopes in LoadResolver. --- libyul/optimiser/LoadResolver.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libyul/optimiser/LoadResolver.cpp b/libyul/optimiser/LoadResolver.cpp index 86e406115..99d3f4ffc 100644 --- a/libyul/optimiser/LoadResolver.cpp +++ b/libyul/optimiser/LoadResolver.cpp @@ -68,9 +68,11 @@ void LoadResolver::tryResolve( if (_location == StoreLoadLocation::Storage) { if (auto value = util::valueOrNullptr(m_storage, key)) - _e = Identifier{locationOf(_e), *value}; + if (inScope(*value)) + _e = Identifier{locationOf(_e), *value}; } else if (m_optimizeMLoad && _location == StoreLoadLocation::Memory) if (auto value = util::valueOrNullptr(m_memory, key)) - _e = Identifier{locationOf(_e), *value}; + if (inScope(*value)) + _e = Identifier{locationOf(_e), *value}; }