Slow compilation (~3 s) of a 17-line contract on --via-ir and --via-ssa-cfg
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Description
A 17-line contract with deeply nested fixed-size arrays compiles in ~3 seconds with both `--via-ir --optimize` and `--experimental --via-ssa-cfg --optimize`. The legacy backend (without `--optimize`) compiles the same input in ~0.05 s, so the slowdown is roughly 60×. Found by AFL fuzzing of solc (the input was flagged as a hang against AFL's per-exec timeout).
Repro file also available as a gist: https://gist.github.com/msooseth/8bc721462a9f05ab754118d9579d62e4
## Environment
- Compiler version: `0.8.35-develop.2026.4.28+commit.b83005c9.Linux.g++` (commit `b83005c900d356e82f4d2da52be1601e1d8b3539`, tag `v0.8.35-pre.1-97-gb83005c90`)
- Compilation pipeline: `--via-ir` and `--via-ssa-cfg`
- Target EVM version: `prague`
- Framework/IDE: solc CLI
- EVM execution environment: n/a
- Operating system: Linux 6.19.13-arch1-1
Reproducer harness: `argotorg/solidity` pinned at `b83005c9` inside `solidity-fuzzing` @ `9aa104b07235022d9cc8e39bd5e3edb4f7d8df75`.
## Steps to Reproduce
```solidity
contract C {
struct S {
uint8[2][2][2][2][2][2][2][2] b;
}
S[][][] s1;
S[][1][] s2;
S[1][][1] s3;
function test1(S[][][] memory _a) public returns (S[][] memory){
s1.push();
s1[0] = _a[0];
return s1[0];
}
}
```
```bash
time solc --bin --via-ir --optimize --evm-version prague repro.sol # ~3.20 s
time solc --bin --experimental --via-ssa-cfg --optimize --evm-version prague repro.sol # ~3.00 s
time solc --bin --evm-version prague repro.sol # ~0.05 s
```
## Measurements
| Pipeline | Flags | Wall time |
|---|---|---|
| Legacy, no optimizer | `--bin --evm-version prague` | 0.05 s |
| via-IR + optimizer | `--bin --via-ir --optimize --evm-version prague` | 3.20 s |
| via-SSA-CFG + optimizer | `--bin --experimental --via-ssa-cfg --optimize --evm-version prague` | 3.00 s |
3 seconds on a 17-line input is enough that AFL classifies it as a hang.
Contributor guide
Research direction
Start by saving the reproduced contract as repro.sol and running the three solc CLI commands from the issue to confirm the timing gap. Trace the optimizer paths used by --via-ir and --via-ssa-cfg, then verify that the 17-line contract no longer causes a roughly three-second compile or AFL hang classification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100