Are current OZ Contracts safe to optimize and compile via IR (intermediate representation / YUL)?

As of Solidity 0.8.13, the Yul IR Pipeline, which can improve optimization markedly due to inter-function optimizations, is stated to be "Production Ready". However, the Solidity docs mention there are some potentially breaking changes in initialization semantics when enabling the "via-ir" optimization flag (see
Are the current OpenZeppelin smart contracts safe to compile via IR, or will this break some functionality? If they are safe, as of what version?

1 Like

We've run tests with viaIR in the past and they were successful. I just triggered another run to see (, and the tests failed but I believe it's due to a Hardhat issue.

In the list of semantic changes, nothing sounds like it would cause an issue for OZ Contracts.