Skip to content

Commit 11d47d7

Browse files
authored
apply size optimizations by default (#298)
So far if no optimization level was specified, optimizations for execution time were applied. However, we currently are a bit limited on code size. Add to that, this setting is not available in solc and people generally ignore the docs, generating a lot of support requests. Signed-off-by: Cyrill Leutwiler <[email protected]>
1 parent e3a9c95 commit 11d47d7

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ This is a development pre-release.
66

77
Supported `polkadot-sdk` rev:`c29e72a8628835e34deb6aa7db9a78a2e4eabcee`
88

9+
## v0.1.0
10+
11+
This is a development pre-release.
12+
13+
Supported `polkadot-sdk` rev:`c29e72a8628835e34deb6aa7db9a78a2e4eabcee`
14+
915
### Added
1016

1117
### Changed
18+
- By default, heavy size optimizations are applied.
1219

1320
### Fixed
1421

crates/llvm-context/src/optimizer/settings/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl TryFrom<&SolcStandardJsonInputSettingsOptimizer> for Settings {
234234
fn try_from(value: &SolcStandardJsonInputSettingsOptimizer) -> Result<Self, Self::Error> {
235235
let mut result = match value.mode {
236236
Some(mode) => Self::try_from_cli(mode)?,
237-
None => Self::cycles(),
237+
None => Self::size(),
238238
};
239239
if value.fallback_to_optimizing_for_size.unwrap_or_default() {
240240
result.enable_fallback_to_size();

crates/solidity/src/resolc/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn main_inner() -> anyhow::Result<()> {
129129

130130
let mut optimizer_settings = match arguments.optimization {
131131
Some(mode) => revive_llvm_context::OptimizerSettings::try_from_cli(mode)?,
132-
None => revive_llvm_context::OptimizerSettings::cycles(),
132+
None => revive_llvm_context::OptimizerSettings::size(),
133133
};
134134
if arguments.fallback_to_optimizing_for_size {
135135
optimizer_settings.enable_fallback_to_size();

0 commit comments

Comments
 (0)