Skip to content

Commit

Permalink
fixup! Accept empty optimizer sequence with Yul optimizer disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-matic committed Nov 6, 2023
1 parent 5855731 commit ec90ea0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <libyul/YulStack.h>
#include <libyul/AST.h>
#include <libyul/AsmParser.h>
#include <libyul/optimiser/Suite.h>

#include <liblangutil/Scanner.h>
#include <liblangutil/SemVerHandler.h>
Expand Down Expand Up @@ -99,6 +100,7 @@ using namespace solidity;
using namespace solidity::langutil;
using namespace solidity::frontend;
using namespace solidity::stdlib;
using namespace solidity::yul;
using namespace std::string_literals;

using solidity::util::errinfo_comment;
Expand Down Expand Up @@ -1672,6 +1674,15 @@ std::string CompilerStack::createMetadata(Contract const& _contract, bool _forIR
details["yulDetails"]["stackAllocation"] = m_optimiserSettings.optimizeStackAllocation;
details["yulDetails"]["optimizerSteps"] = m_optimiserSettings.yulOptimiserSteps + ":" + m_optimiserSettings.yulOptimiserCleanupSteps;
}
else if
(
OptimiserSuite::isEmptyOptimizerSequence(m_optimiserSettings.yulOptimiserSteps) &&
OptimiserSuite::isEmptyOptimizerSequence(m_optimiserSettings.yulOptimiserCleanupSteps)
)
{
details["yulDetails"] = Json::objectValue;
details["yulDetails"]["optimizerSteps"] = m_optimiserSettings.yulOptimiserSteps + ":" + m_optimiserSettings.yulOptimiserCleanupSteps;
}

meta["settings"]["optimizer"]["details"] = std::move(details);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--ir-optimized --yul-optimizations :
--ir-optimized --metadata --yul-optimizations :
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

======= yul_optimizer_steps_without_optimize_empty_sequence/input.sol:C =======
Optimized IR:
/// @use-src 0:"yul_optimizer_steps_without_optimize_empty_sequence/input.sol"
object "C_28" {
Expand Down Expand Up @@ -126,3 +128,6 @@ object "C_28" {
data ".metadata" hex"<BYTECODE REMOVED>"
}
}

Metadata:
{"compiler":{"version": "<VERSION REMOVED>"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"foo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"yul_optimizer_steps_without_optimize_empty_sequence/input.sol":"C"},"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"details":{"constantOptimizer":false,"cse":false,"deduplicate":false,"inliner":false,"jumpdestRemover":true,"orderLiterals":false,"peephole":true,"simpleCounterForLoopUncheckedIncrement":true,"yul":false,"yulDetails":{"optimizerSteps":":"}},"runs":200},"remappings":[]},"sources":{"yul_optimizer_steps_without_optimize_empty_sequence/input.sol":{"keccak256":"0x3fc910e345ce1ee62bfa6b0f66931ee632c08265b25b6139cfbbfe4d2f8d5dd8","license":"GPL-3.0","urls":["bzz-raw://e557e9ad2c2e420a669c06ae456b0b790d77d2d6d492cd8540e6b244388a5140","dweb:/ipfs/QmaNiZmC2Mo3YxGiehs1n3dVTjZwD7FguX7EUtpeshMVuR"]}},"version":1}

0 comments on commit ec90ea0

Please sign in to comment.