8955 commits in all time Dec 26, 2025 07:34 – Mar 26, 2026 07:34 UTC
achidlow puya
fix potential (serious) bug whereby GVN wasn't considering through blocks in phi congruence. Can't test for this with acceptance tests unfortunately.
Git Commit 314d1a90 Branch gvn Document 1/4 ++ 1 --
achidlow puya
Merge 4dd2ff89536c5fb9279e7748452b9c0775f6216a into 8b0803fbe1c1b7bfd3f22220b130edec27b6f2cb
Git Commit ef5d67ca Branch pull/679/merge Document 1/10 ++ 2 --
achidlow puya
fix a hypothetical/future issue whereby a block with a single predecessor && unconditionally branched to with trivial phi nodes could result in a use-before-def error
Git Commit 4dd2ff89 Branch fix-potential-phi-issue Document 1/10 ++ 2 --
rohan-tessl algorand-mcp
Merge 2751b4b22ea4e89cfaeaf5003c2ff4afa0ecd1b0 into 27edae991777dc216fbfbb5642d8bf0b36f430e2
Git Commit 9001d716 Branch pull/13/merge Document 4/64 ++ 115 --
rohan-tessl algorand-mcp
ci: add Tessl skill review workflow for SKILL.md PRs
Git Commit 2751b4b2 Branch pull/13/head Document 1/22 ++ 0 --
rohan-tessl algorand-mcp
feat: improve skill scores for algorand-mcp
Optimized all three SKILL.md files using tessl skill review feedback:

| Skill                        | Before | After | Change |
|------------------------------|--------|-------|--------|
| algorand-interaction         | 93%    | 100%  | +7%    |
| alpha-arcade-interaction     | 89%    | 96%   | +7%    |
| haystack-router-interaction  | 93%    | 100%  | +7%    |

Changes:
- algorand-interaction: consolidated three workflow tables into one
  compact table, streamlined Links section, reordered Security before
  References for better flow
- alpha-arcade-interaction: unified microunit explanations (previously
  repeated in three separate sections), trimmed Common Pitfalls to
  remove items already covered in Units section
- haystack-router-interaction: condensed swap direction rules table
  from 7 verbose rows to 3 pattern-based rows, removed redundant
  Key Concepts section (already covered in tool docs)
Git Commit d81605e2 Branch pull/13/head Document 3/42 ++ 115 --
achidlow puya
chore: compile all (after rebase)
Git Commit fdb83d95 Branch gvn Document 300/51,835 ++ 57,626 --
docs: add missing env vars to README and create .env.example
Git Commit 86482f44 Branch release/ak-v4 Document 2/36 ++ 6 --
achidlow puya
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>
Git Commit 48d7604e Branch gvn Document 24/88 ++ 441 --
achidlow puya
chore: compile all
Git Commit e5c26f8f Branch gvn Document 25/671 ++ 635 --
achidlow puya
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>
Git Commit 161ea5f9 Branch gvn Document 70/830 ++ 2,542 --
achidlow puya
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>
Git Commit 1755db5e Branch gvn Document 1/78 ++ 3 --
achidlow puya
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>
Git Commit 14c2050d Branch gvn Document 25/279 ++ 277 --
achidlow puya
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>
Git Commit 43dc5f78 Branch gvn Document 53/4,510 ++ 0 --
achidlow puya
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>
Git Commit 54d2c065 Branch gvn Document 25/965 ++ 1,285 --
achidlow puya
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>
Git Commit b7c6af1e Branch gvn Document 53/5,624 ++ 0 --
achidlow puya
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>
Git Commit ebed9c95 Branch gvn Document 1/9 ++ 14 --
achidlow puya
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>
Git Commit 718ac33f Branch gvn Document 2/524 ++ 4 --
achidlow puya
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>
Git Commit 32d635c6 Branch gvn Document 54/7,449 ++ 1 --
achidlow puya
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>
Git Commit 787353a5 Branch gvn Document 2/17 ++ 32 --
achidlow puya
make test actually cover the case
Git Commit 69a2f9e0 Branch gvn Document 1/12 ++ 11 --
achidlow puya
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>
Git Commit aa657d77 Branch gvn Document 300/101,488 ++ 142,728 --
achidlow puya
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>
Git Commit d5661446 Branch gvn Document 118/2,557 ++ 3,001 --
achidlow puya
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>
Git Commit 38ba4d4d Branch gvn Document 1/95 ++ 93 --
achidlow puya
chore: compile all
Git Commit 448c11da Branch gvn Document 300/15,167 ++ 17,031 --