Latest Repo Discovered
Foodprint-wallet
Python
·
No license
Top Contributor of the Month
8948 commits in all time
Dec 26, 2025 06:12 – Mar 26, 2026 06:12 UTC
docs: add missing env vars to README and create .env.example
86482f44
release/ak-v4
2/36 ++ 6 --
feat: add ordering op canonicalization to GVN
Recognize that a<b and b>a (and <=/>= variants, including bytes comparisons) are equivalent by canonicalizing operand VNs in the expression key. When the first operand VN is larger, swap operands and mirror the predicate (< ↔ >, <= ↔ >=). This follows the same approach as LLVM GVN and GCC's SCC-VN: sort operand VNs and adjust the comparison predicate to match. comparison_swaps test case: 78 → 54 bytes (-31%), 45 → 29 ops (-36%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48d7604e
gvn
24/88 ++ 441 --
feat: extend GVN to eliminate redundant pure subroutine calls
InvokeSubroutine with target.pure and identical argument VNs now receives the same value number, eliminating duplicate calls. Catches redundant _puya_lib.bytes_.is_substring calls across three test contracts. Net impact: -72 bytes / -51 ops at O1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
161ea5f9
gvn
70/830 ++ 2,542 --
feat: add SCC-based phi congruence analysis to GVN
After hash-based numbering, build a phi dependency graph and find SCCs. Within each non-trivial SCC, check if all phis have the same set of external (non-SCC) argument VNs. If so, they're all congruent and can be merged. Catches patterns like phi(a,y)/phi(b,x) where a==b that hash-based GVN misses due to back-edge conservatism. No impact on current test suite (no such patterns exist), but zero-cost when not triggered. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1755db5e
gvn
1/78 ++ 3 --
fix: improve GVN test coverage to 99%
- Fix phi_congruence test to exercise GVN redundant phi path (lines 279-288) by using commutative operand order (a|b vs b|a) so the frontend keeps them as separate registers but GVN canonicalises them to the same VN - Convert unreachable defensive guards to raise InternalError (arity mismatch, replacement cycle, multi-external-VN SCC, missing VN representative) — these are excluded from coverage via .coveragerc Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
14c2050d
gvn
25/279 ++ 277 --
test: add comparison_swaps test case for GVN ordering-op canonicalization
Test contract with inline=False subroutines that assert both directions of each ordering comparison (a<b then b>a, a<=b then b>=a) for both uint64 and BigUInt types. The redundant converse comparisons should be eliminated once GVN learns to canonicalize swapped predicates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43dc5f78
gvn
53/4,510 ++ 0 --
feat: add negation-aware comparison numbering to GVN
Recognize that !(a < b) has the same value as (a >= b) by tracking which VNs were produced by comparison ops. When GVN processes a ! intrinsic whose operand was a comparison, it returns the inverse comparison's expression key instead, so the normal hash lookup naturally matches any existing computation of the inverse. Inverse pairs: < ↔ >=, > ↔ <=, == ↔ != (and b-prefixed variants). Double negation (!(!x)) works automatically since !(comparison) produces an inverse comparison key which is itself tracked. negated_comparisons test case: 107 → 65 bytes (-39%), 71 → 41 ops (-42%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54d2c065
gvn
25/965 ++ 1,285 --
test: add negated_comparisons test case for GVN inverse comparison numbering
Test contract with inline=False subroutines that assert a comparison and the negation of its inverse (e.g. assert a < b, assert not (a >= b)) for all 6 inverse pairs, for both uint64 and BigUInt types. The negated assertions should be eliminated once GVN learns to recognise !(comparison) as the inverse comparison. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b7c6af1e
gvn
53/5,624 ++ 0 --
refactor: simplify GVN replacement chain handling
Replace _resolve_transitive chain resolution with a validation assert. Both the hash-based pass and SCC pass always replace with VN representatives, which are never themselves replacement targets, so chains cannot form. Asserting this invariant (via InternalError) is safer than silently resolving — a chain would indicate a bug in the replacement logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ebed9c95
gvn
1/9 ++ 14 --
feat: add GVN-PRE infrastructure with recursive materialisation
Add Partial Redundancy Elimination module (gvn_pre.py) integrated into the GVN pass. Flow: number -> PRE insert -> re-number -> eliminate. Key components: - ANTIC_IN/AVAIL_OUT dataflow analysis - Recursive materialisation: when operands aren't available at the insertion point, recursively insert the expressions that produce them - Dominance-aware leader lookup via idom tree - Safety filter: only non-trapping ops can be inserted on new paths - Critical edge splitting before insertion Refactors GVN to separate _number_values from elimination so PRE can hook between them. Currently produces net regressions due to phi/split-block overhead exceeding savings on cheap single-instruction ops. Needs filtering to skip expressions where hoisting overhead exceeds the benefit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
718ac33f
gvn
2/524 ++ 4 --
feat: add SCC-based phi congruence analysis to GVN
After hash-based numbering, build a phi dependency graph and find SCCs. Within each non-trivial SCC, check if all phis have the same set of external (non-SCC) argument VNs. If so, they're all congruent and can be merged. Catches patterns like phi(a,y)/phi(b,x) where a==b that hash-based GVN misses due to back-edge conservatism. Adds test_cases/phi_congruence with contracts exercising cross-assignment loops (SCC size 2), triple rotation cycles (SCC size 3), and a redundant phi pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32d635c6
gvn
54/7,449 ++ 1 --
chore: disable GVN-PRE pending better insertion heuristics
PRE produces net regressions on current test suite: phi/stack overhead exceeds savings for the cheap expressions that pass the safety filter. Also fixes oscillation bugs (infinite optimizer loop from PRE insert then GVN eliminate cycling). Infrastructure remains in gvn_pre.py for future work. Key remaining issues: - Need heuristics to skip insertions where overhead > benefit - Need robust no-op detection to prevent optimizer loop oscillation - Critical edge splitting interacts poorly with the fixed-point loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
787353a5
gvn
2/17 ++ 32 --
feat: extend GVN to number pure zero-arg intrinsics
Remove the `and args` guard so GVN numbers immediate-only pure ops like txn, txna, arg, etc. These are deterministic within a transaction and frequently duplicated after inlining. Net impact: -1177 bytes / -773 ops at O1 across the test suite. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aa657d77
gvn
300/101,488 ++ 142,728 --
feat: extend GVN to handle multi-target assignments
Operations like addw and decode_bytes return multiple values. GVN now numbers these by storing all target registers in the expression table, enabling elimination of duplicate multi-return ops. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d5661446
gvn
118/2,557 ++ 3,001 --
refactor: simplify GVN internals
- Remove unused get_register_vn method - Replace save/restore full-dict-copy scoping with delta-based push_scope/pop_scope (tracks only keys added per scope) - Extract _try_replace helper to unify replacement logic (4 call sites) - Extract _index_vns helper for shared ExtractValue/ReplaceValue pattern - Add _ScopeDelta attrs class and _Snapshot TypeAlias to eliminate repeated tuple type annotations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38ba4d4d
gvn
1/95 ++ 93 --
feat: add Global Value Numbering (GVN) optimization pass
Hash-based GVN that assigns canonical value numbers to SSA definitions and eliminates redundant computations across the dominator tree. Complements the existing CSE pass by catching deeper equivalences (value identity through operand VNs, commutative reorderings, redundant phis). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ea070067
gvn
2/433 ++ 0 --
fix: resolve deprecated API usage warnings in components
48866b75
release/ak-v4
3/11 ++ 20 --
fix: prefix unused parameters to resolve ts6133 warnings
695a5174
release/ak-v4
4/15 ++ 22 --