Skip to content

default-on sweep: enable 10 angr structuring/switch flags by default (per-test opt-outs) - #110

Merged
mahaloz merged 6 commits into
mainfrom
feat/default-on-sweep
Jun 27, 2026
Merged

mahaloz merged 6 commits into
mainfrom
feat/default-on-sweep

Conversation

@mahaloz

@mahaloz mahaloz commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

User-directed "enable good flags by default" sweep. Flips ten previously default-off,
angr-derived settables to default-on in one group, using the per-testcase opt-out
mechanism (NOT a baseline re-pin) for the datatests they change:

gotoreduce, crossjumprevert, taildup, dedupitetail, regionlooprefine, ifelseflatten,
switchmultipred, tailcalljump, foldcallret, branchflip.

These are the SAILR/Phoenix goto-reduction passes (return-tail / cross-jump / return-call-tail
duplication + ITE-tail dedup + irreducible-loop refinement + guard-clause flattening), the
multi-predecessor unrolled-guard jump-table recovery, -O2 tail-call-jump recovery, call-return
expression folding, and negated-guard branch flipping — the angr readability layer that each
previously shipped opt-in behind option <flag> on. option <flag> off still restores the
pre-flag (Ghidra/upstream) rendering per decompilation.

Mechanism

For each flag: default = "on" in stages.toml AND the live Architecture field set on in
reset_defaults_internal (infra/architecture.rs). Nine are carried into the per-function seam
in build_arch_handle; tail_call_jumps is read directly at the S2 flow seam. No CFG/SSA/type
change.

Per-test opt-outs (no baseline re-pin)

Seven of the ten change 0 datatests. The three that do are kept at parity by a single
<com>option <flag> off</com> line in each affected datatest's <script> (with a one-line XML
comment explaining why). docs/baseline.json is UNTOUCHED:

Twelve tests/stages/ testcases that assert the pre-sweep (flags-off) baseline in their pass-1
default decompile each get an explicit option <flag> off in that pass; docs/baseline-stages.json
untouched.

Gates (all green, both baselines untouched)

  • make test — PARITY OK 675/675 (via opt-outs only)
  • make test-stages — PARITY OK 235/235
  • make rust-test — green (updated the kuna_anchor_flags unit test for the ten default-on fields)
  • Regenerated the byte-exact catalog fixture (stage_catalog.json) and docs/assertions.md
    (only the ten default fields flip off→on); kuna catalog --check OK
  • Documented as DIV-14 in docs/divergences.md + a docs/PROGRESS.md entry

Every datatest failure was exactly the documented mapping — no flag misbehaved or changed more
datatests than expected.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PBrckq3YYAzBLq5k4KpWac

mahaloz and others added 6 commits June 27, 2026 17:51
…per-test datatest opt-outs

Flip these 10 settables from default-off to default-on (stages.toml + reset_defaults_internal):
gotoreduce, crossjumprevert, taildup, dedupitetail, regionlooprefine, ifelseflatten,
switchmultipred, tailcalljump, foldcallret, branchflip.

7 of the 10 change 0 datatests. The 3 that do (tailcalljump/foldcallret/branchflip) get
per-test opt-outs via an <com>option <flag> off</com> line in the affected datatest scripts
so they keep the upstream rendering: make test stays PARITY OK 675/675 with docs/baseline.json
UNTOUCHED (opt-out, not re-pin).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…sertions.md

- tests/stages: 12 stage testcases pinned the pre-sweep (flags-off) baseline in
  their pass-1 default decompile; add explicit 'option <flag> off' lines there so
  those assertions still hold (each pass-2 'option <flag> on' re-enables only the
  flag under test). docs/baseline-stages.json UNTOUCHED -> PARITY OK 235/235.
- regenerate tests/fixtures/stage_catalog.json (the byte-exact catalog) and
  docs/assertions.md: the 10 flags' 'default' field flips off->on (only those
  lines change). catalog_bytecompat count test unaffected (65 settables).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…3 default-on flags

reset_defaults_internal now sets all 10 flags on; move switch_multi_pred to the
default-on assertion block and add the other 9 (tail_call_jumps, region_loop_refine,
reduce_return_gotos, flatten_ifelse, revert_cross_jumps, dup_return_call_tails,
dedup_ite_tail, fold_call_returns, branch_flip).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
DIV-14 records the ten default-on flags, the per-test datatest opt-outs (with the
one-line reason each) and the per-test stage opt-outs, all gates green with both
baselines untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…tension

Extends the DIV-14 sweep with four more previously default-off settables flipped
to default-on via the same three-place flip (stages.toml default="on" +
reset_defaults_internal + seam copy where one exists): stackguard,
noreturn_extern, noreturn_propagate, switchsharedcase. DIV-14 now covers 14 flags.

Three of the four REMOVE CODE from the emitted decompilation; per the user's ask
for downstream-LLM visibility, each one's catalog `summary` is prefixed
"REMOVES CODE:" (surfaced by `kuna catalog --json`):
  - stackguard: strips the -fstack-protector canary epilogue.
  - noreturn_extern: marks a matched extern call no-return, dropping the
    post-call fall-through.
  - noreturn_propagate: propagates no-return through the call graph, dropping
    unreachable code after no-return calls.
switchsharedcase's summary notes it is slower on the functions whose switch it
recovers (kept on for quality).

Per-test opt-outs (NOT a baseline re-pin; docs/baseline.json + baseline-stages.json
UNTOUCHED):
  - Datatest: only stackguard changes the corpus -> `option stackguard off` at
    the top of tests/datatests/partialsplit.xml (Partial splitting #1/#2).
    noreturn_extern/noreturn_propagate/switchsharedcase change 0 datatests.
  - Stages: switchsharedcase-b2sum.xml (switchsharedcase off pass-1),
    ghangr-incorrect-duplication-chcon-a0e113.xml (noreturn_extern off pass-1,
    same name list/seam as the existing noreturn_externmatch off),
    ghangr-x8664-cvs-863633.xml (stackguard off — canary strip changed the 0x3c
    decl count).

Gates: make test PARITY OK 675/675, make test-stages PARITY OK 235/235,
make rust-test green (updated kuna_anchor_flags for the 4 new default-on fields;
fixed two kuna-console e2e tests whose OFF/Disc baselines now needed the
now-default-on noreturn_extern / noreturn_propagate explicitly disabled to
isolate the behaviour under test). kuna catalog --check OK; regenerated
stage_catalog.json fixture + docs/assertions.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

1 participant