Repository navigation
[AUTOMATED] Print the returns an unoptimized function was written with (returndup auto) - #1941
Merged
Merged
Conversation
[AUTOMATED] work in progress; debug dump still present. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…fy recorded returning ifs, stage test [AUTOMATED] work in progress; debug dump still present. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
… auto) [AUTOMATED] New default value `auto` of option `returndup`: in functions the unoptimized detector flags, the return statements read from the raw block graph at the first heritage pass decide which shared epilogues are split, and the rule-based return placement (const gate, rettriangle, earlyreturn, switchreturn, tailform's size rule) stands down there. `on` keeps the old rules everywhere. Void returns are told apart by the instruction a path lands on (a `return;` is a nop), stripped canary chains are joined first, and an epilogue holding only hoisted arithmetic may be split. Debug dump removed. Stage test kuna-returndup-auto.xml; datatests and stage tests that pin other features take `option returndup on`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] merge of origin/main e6cb5da. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Under the default returndup auto, main of the in-repo stripped PIE fixture prints its two -O0 returns, so argv[1] reaches the call through a local; the probe checks elfmain's typing, so it keeps the merged form. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…epilogues [AUTOMATED] docs/spec/08-structuring.md describes behind-nop returns, nop-run landings, the stripped-canary splice and pure-arithmetic epilogues of returndup auto. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] castobject, callrettype, rettriangle, ARM interworking and local-name tests check text the old return placement printed; they pass --option returndup on. The bejoin truncation round trip drops a trailing comment from a printed signature before using it as a declaration, and the crackme rename test reads the strcmp result the recorded returns now assign. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…d optimized functions alone [AUTOMATED] The guard re-spelling of a decided function's last returning if declines when the final return carries a label, and the skipped final return applies only in decided functions. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
mahaloz
added a commit
that referenced
this pull request
Nov 24, 2026
[AUTOMATED] Brings in main through 2087bd3 (#1937, #1938, #1940, #1941). The corpus file count is 914 (83 datatests, 831 stage tests) and the stage baseline is re-recorded: main's 5340 keys plus the 65 assertions of this branch's six stage tests, with the two catalog rows that name pushan. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTo941vG8RLpZJvswN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At -O0 the binary records which
returnstatements a function was written with: everyreturncompiles to its own value-setting code that jumps to the one epilogue. kuna throws that away during simplification and then guesses the form with rules tuned on optimized code. gcc -O0 output ofint guard(int c) { if (!c) return 0; use(1); return 0; },void vguard(int c) { if (c) return; use(4); }andint pick(int c, int a, int b) { if (c) return a; return b; }:Before:
After:
returndupgains the valueauto, now the default (and what theaggressivepreset sets). In a function the unoptimized detector flags,p8_structure/kuna_o0returns.rsreads the raw block graph at the first heritage pass and tags each edge into the epilogue with thereturnit came through: a predecessor that only computes a value is one return, an epilogue that sets the return register itself is one return shared by everything reaching it, and in a void function areturn;is thenopa path lands on. The tags ride in high bits of the edge labels, which survive the removal of the emptied blocks.returndupruns, each recorded return gets its own copy of the epilogue and no more, constant or not;earlyreturn,switchreturn,rettriangleandtailform's size rule leave such functions alone (the no-return nesting still applies).onkeeps the old rules everywhere; optimized functions are unchanged.return c ? a : b;exactly likeif (c) return a; return b;; this prints the second.Tests:
tests/stages/kuna-returndup-auto.xml(the three functions above plus a body that shares the epilogue's return;option returndup onreproduces the old output) and unit tests. Two datatests, ten stage tests, one CLI probe and the castobject, callrettype, rettriangle, ARM-interworking and local-name workspace tests check other features' -O0 text and pinoption returndup on; the bejoin round trip now drops a trailing comment from a printed signature before compiling it.decompile-allwall time on the O2-noinline sshd, ls and bash: 1.000, 1.010 and 0.990 of main's.Model:
anthropic/claude-opus-5-5🤖 Generated with Claude Code
https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU