Skip to content

[4.1] disable CFL Alias Analysis by default; fixes known cases of indeterministic build output#309

Merged
spoonincode merged 3 commits intorelease/4.1from
disable_cffaa_default_41
Aug 22, 2024
Merged

[4.1] disable CFL Alias Analysis by default; fixes known cases of indeterministic build output#309
spoonincode merged 3 commits intorelease/4.1from
disable_cffaa_default_41

Conversation

@spoonincode
Copy link
Contributor

We've struggled with cdt generating slightly different outputs build-to-build. Typically the number of output permutations is low which allows eventually coming to a consensus between two independent build environments (e.g. two individuals building a contract) by just building over and over until matching up, but clearly this is not ideal behavior and may not always be the case.

The CFL Alias Analysis optimization looks to be the source of the build indeterminism. Disable it by default, and switch the exposed option to allow it to be reenabled in case someone out there really needs it, or finds some severe regression due to the removal of this optimization. (I'm tempted to just remove it entirely: LLVM 9 documents this optimization pass as experimental)

Technically this is a breaking change (removal of -fno-cfl-aa option). An alternative is to add the new -fcfl-aa and keep the existing -fno-cfl-aa. But then I have to figure out how to properly handle repeated options here (someone passing -fcfl-aa -fno-cfl-aa -fcfl-aa). I am not really convinced it's worth making this more complex; but we can discuss if someone has a strong opinion about it w.r.t. no breaking changes in a minor release.

Disabling this optimization makes a very marginal increase in contract size; I measured two contracts' size in bytes:

contract with CFL AA no CFL AA Increase
eosio.system 371557 371589 <0.01%
eosio.evm 478959 480609 0.3%

FWIW, eosio.evm's stack/data did not increase. I do not have any performance metrics. With such a small change in compiled size it's unlikely there is a significant performance delta, but there is still a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants