Skip to content

fix[venom]: remove FloatAllocas pass#4888

Merged
harkal merged 3 commits intovyperlang:masterfrom
harkal:fix/venom/remove_float_allocas
Mar 22, 2026
Merged

fix[venom]: remove FloatAllocas pass#4888
harkal merged 3 commits intovyperlang:masterfrom
harkal:fix/venom/remove_float_allocas

Conversation

@harkal
Copy link
Copy Markdown
Collaborator

@harkal harkal commented Mar 22, 2026

What I did

Remove the FloatAllocas pass, which hoisted alloca instructions to the entry basic block. The pass was a workaround for the old codegen emitting allocas in non-dominating positions. The current venom codegen already emits allocas that dominate their uses, making the hoisting unnecessary.

How I did it

  • Deleted vyper/venom/passes/float_allocas.py
  • Removed FloatAllocas from all three optimization pipelines (O2, O3, Os)
  • Removed the FloatAllocas required_predecessors entry from Mem2Var
  • Removed the post-inline FloatAllocas invocation in FunctionInlinerPass
  • Updated test imports and comments that referenced the pass

How to verify it

  • Full test suite passes (11,462 tests)
  • Allocas in non-entry blocks work correctly — the current codegen already guarantees allocas dominate their uses

Commit message

`FloatAllocas` hoisted alloca instructions to the entry basic block as a
workaround for the old codegen pipeline emitting allocas in blocks that
did not dominate all their uses. this produced malformed IR that
downstream passes (notably SCCP) rightfully rejected.

the current venom codegen emits allocas in positions that already
dominate their uses, so the hoisting is no longer necessary. allocas
just need to dominate their uses — they don't need to be in the entry
block.

remove the pass, its pipeline entries (O2/O3/Os), the Mem2Var
required_predecessors dependency, and the post-inline invocation in
FunctionInlinerPass.

Description for the changelog

Remove the FloatAllocas pass. Allocas no longer need to be hoisted to the entry block — the underlying SCCP issues that required this have been fixed.

@harkal harkal marked this pull request as ready for review March 22, 2026 09:25
@github-actions
Copy link
Copy Markdown

📊 Bytecode Size Changes (venom)

Contract legacy-O2 legacy-Os -O2 -O3 -Os
curvefi/amm/stableswap/meta_implementation/meta_implementation_v_700.vy 23610 22805 21047 (🟢-2) 20024 (🟢-1) 19573 (🟢-2)
yearnfi/VaultV2.vy 16676 15763 14201 (🟢-4) 13714 (🟢-4) 12879 (🟢-4)
curvefi/amm/stableswap/factory/factory_v_100.vy 14558 13978 13498 (🔴+10) 12102 (🔴+10) 12044 (🔴+10)
curvefi/gauge/child_gauge/implementation/implementation_v_110.vy 12338 11561 10471 (🟢-2) 9977 (🟢-2) 9380 (🟢-2)
curvefi/gauge/child_gauge/implementation/implementation_v_100.vy 12017 11249 10177 (🟢-2) 9682 (🟢-2) 9096 (🟢-2)
curvefi/gauge/child_gauge/implementation/implementation_v_020.vy 10665 9947 9213 (🟢-2) 8719 (🟢-2) 8195 (🟢-2)
yearnfi/VaultFactory.vy 3765 3617 3856 (🟢-1) 2431 (🟢-1) 2835 (🟢-1)

Full bytecode sizes

Contract legacy-O2 legacy-Os -O2 -O3 -Os
curvefi/amm/stableswap/meta_implementation/meta_implementation_v_700.vy 23610 22805 21047 20024 19573
curvefi/legacy/CurveStableSwapMetaNG.vy 24952 23578 20799 20180 19481
curvefi/amm/stableswap/implementation/implementation_v_700.vy 24962 23769 20542 19680 19120
curvefi/legacy/CurveStableSwapNG.vy 24473 23298 19929 19094 18563
curvefi/amm/tricryptoswap/implementation/implementation_v_200.vy 20590 19825 18295 17769 17208
yearnfi/VaultV3.vy 19972 19063 16924 15015 14351
curvefi/amm/twocryptoswap/implementation/implementation_v_210.vy 18090 17350 16513 15869 15382
curvefi/legacy/CurveCryptoSwap2.vy 18947 18382 15647 15108 14721
yearnfi/VaultV2.vy 16676 15763 14201 13714 12879
curvefi/amm/stableswap/factory/factory_v_100.vy 14558 13978 13498 12102 12044
curvefi/amm/stableswap/views/views_v_120.vy 12784 12368 10555 9922 10054
curvefi/gauge/child_gauge/implementation/implementation_v_110.vy 12338 11561 10471 9977 9380
curvefi/gauge/child_gauge/implementation/implementation_v_100.vy 12017 11249 10177 9682 9096
curvefi/amm/tricryptoswap/math/math_v_200.vy 11055 10992 9509 8149 8385
curvefi/legacy/CurveCryptoMathOptimized3.vy 11054 10991 9508 8149 8385
curvefi/gauge/child_gauge/implementation/implementation_v_020.vy 10665 9947 9213 8719 8195
curvefi/helpers/router/router_v_110.vy 6717 6717 7124 6482 6698
curvefi/amm/tricryptoswap/views/views_v_200.vy 7821 7776 7054 6770 6838
curvefi/registries/metaregistry/metaregistry_v_110.vy 7590 6732 7028 6171 6071
curvefi/helpers/stable_swap_meta_zap/stable_swap_meta_zap_v_100.vy 7302 7067 6776 6380 6478
curvefi/amm/twocryptoswap/views/views_v_200.vy 6991 6946 6510 6235 6294
curvefi/registries/metaregistry/registry_handlers/stableswap/handler_v_110.vy 6633 6259 6277 5442 5917
curvefi/amm/tricryptoswap/factory/factory_v_200.vy 5246 5021 5868 4899 4972
curvefi/amm/twocryptoswap/factory/factory_v_200.vy 5540 5252 5819 4587 4710
curvefi/amm/twocryptoswap/math/math_v_210.vy 6666 6666 5564 5080 5085
curvefi/gauge/child_gauge/factory/factory_v_201.vy 4844 4547 4284 4062 3825
curvefi/registries/metaregistry/registry_handlers/tricryptoswap/handler_v_110.vy 4241 3939 4083 3754 3759
curvefi/registries/metaregistry/registry_handlers/twocryptoswap/handler_v_110.vy 4186 3884 4014 3616 3637
yearnfi/VaultFactory.vy 3765 3617 3856 2431 2835
curvefi/gauge/child_gauge/factory/factory_v_100.vy 4183 3914 3711 3475 3257
curvefi/helpers/rate_provider/rate_provider_v_101.vy 3260 3260 2879 2507 2520
curvefi/registries/address_provider/address_provider_v_201.vy 2973 2782 2786 2612 2464
curvefi/amm/stableswap/math/math_v_100.vy 3067 3046 2641 2416 2433
curvefi/helpers/rate_provider/rate_provider_v_100.vy 2847 2841 2445 2108 2116
curvefi/helpers/deposit_and_stake_zap/deposit_and_stake_zap_v_100.vy 2322 2316 2176 1913 1944
curvefi/governance/relayer/taiko/relayer_v_001.vy 2068 2064 1698 1553 1583
curvefi/governance/relayer/polygon_cdk/relayer_v_101.vy 1556 1523 1503 1381 1379
curvefi/governance/relayer/arb_orbit/relayer_v_101.vy 1266 1262 1208 1112 1140
curvefi/governance/relayer/op_stack/relayer_v_101.vy 1186 1182 1141 1048 1073
curvefi/governance/relayer/not_rollup/relayer_v_100.vy 1168 1153 1130 1043 1052
curvefi/governance/vault/vault_v_100.vy 964 941 948 899 894
curvefi/governance/agent/agent_v_100.vy 541 541 491 433 437
curvefi/governance/agent/agent_v_101.vy 541 541 491 433 437
curvefi/governance/relayer/relayer_v_100.vy 496 496 468 463 468

@harkal harkal enabled auto-merge (squash) March 22, 2026 09:34
@harkal harkal requested a review from charles-cooper March 22, 2026 09:35
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.95%. Comparing base (41b8507) to head (75de732).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4888      +/-   ##
==========================================
- Coverage   91.96%   91.95%   -0.01%     
==========================================
  Files         187      186       -1     
  Lines       27225    27198      -27     
  Branches     4779     4775       -4     
==========================================
- Hits        25037    25010      -27     
  Misses       1466     1466              
  Partials      722      722              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@harkal harkal disabled auto-merge March 22, 2026 10:33
@harkal harkal enabled auto-merge (squash) March 22, 2026 10:33
@harkal harkal merged commit 9ca728c into vyperlang:master Mar 22, 2026
176 checks passed
@harkal harkal deleted the fix/venom/remove_float_allocas branch March 22, 2026 12:19
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.

2 participants