Repository navigation
[AUTOMATED] Make the test that is a loop's condition the loop's exit (loopcondhoist off|auto|on, default on) - #1964
Merged
Merged
Conversation
…to be removed [AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…ill in) [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…turer, ReturnSplit) [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…p only recorded shared break, latch walk [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…purity; same storage for visible outputs [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…exits, dump removed, docs [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…red chain, disjoint stores) [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…ts fewer gotos), stage test, pins [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…tch scope; docs [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # decompiler/crates/kuna-base/src/xml.rs
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Extends looptest proven: a guard drops when the skip path equals the exit path run zero times (returns, return blocks with calls, joins); empty-body loops; recomputed latch inputs; linear sums and constant comparisons in the entry normal form; wider fresh loads; the frame-counter rule limited to unoptimized functions. Stage tests, unit tests, spec prose, catalog row. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # docs/baseline-stages.json
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # decompiler/crates/kuna-base/src/xml.rs # docs/baseline-stages.json
…a choice; drop the function-level redo (speed) [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # decompiler/crates/kuna-base/src/xml.rs # decompiler/crates/kuna-decomp/src/infra/architecture.rs # decompiler/crates/kuna-decomp/src/substrate/funcdata_block.rs # decompiler/crates/kuna-decomp/tests/fixtures/phase_catalog.json # docs/baseline-stages.json # docs/options.md
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # decompiler/crates/kuna-base/src/xml.rs # docs/baseline-stages.json
…frees a node kuna_o0jumps::continue_once removed the old if block and its clause while a goto could still name them, which panicked the renderer once loopcondhoist made a loop's head test its condition. [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
[AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU # Conflicts: # decompiler/crates/kuna-base/src/xml.rs # docs/baseline-stages.json
The probe checks the label of a switch default's goto into a no-return tail; with the loop condition rule the default arm prints that tail itself. [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
…og line count [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
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.
A loop that has its test and also a
breakorreturninside often comes out aswhile( true ): the loop's condition is anifinside it, and the code written before thebreakis printed after the loop. gcc -O0 output offor (i = 0; i < nents; i++) { if (ents[i].type & 1) cur = ents[i].name; if (i == id) { *group = cur; *name = ents[i].name; break; } }:Before:
After:
p8_structure/kuna_loopcond.rsnames the block whose test is a loop's condition. In unoptimized functions it reads the layout: the compiler enters awhile/forby jumping to its condition, placed after the body, so a head laid out after every latch is the condition and a head laid out first with a conditional latch is ado … while. In optimized code it takes a single conditional latch (a rotated loop, whichlooptestthen moves back to the top), else a head test. A test whose arm only reaches a no-return call does not count.CollapseStructuretakes that block's exit as the loop exit and folds its returning arm last in the deferredruleBlockIfNoExitscan; the region structurer keeps that exit edge. In unoptimized functionsActionReturnSplitno longer copies the return block for abreakthat thereturndup autorecord says shares thereturnafter the loop.loopcondhoistoption tooff|auto|on, defaulton(auto= unoptimized functions only). The oldonskipped every loop head and was off by default. When the rule changed a choice and the structuring holds agoto, it is structured again without the rule and the version with fewer gotos is kept.loopcontinue autorewrite that prints a recordedcontinue;freed the oldifnode while agotocould still name it; it now re-points such gotos, which a loop condition at the head made reachable (a renderer panic).option loopcondhoist off, 65 more O2-noinline functions (66 gained, 1 lost) and 143 more O0 functions (146 gained, 3 lost) match the source's control flow exactly.Tests:
tests/stages/kuna-loopcondhoist.xmlcovers three gcc -O0 loops (a break that carries stores, an early return, a break to the shared return) and one gcc -O2 rotated loop. Each printswhile( true )underoption loopcondhoist off, and the -O2 one also underauto. The vendoredpromotecompare.xml, three stage tests, one CLI probe and thetailformround-trip test, which check other features, pinoption loopcondhoist off; the ghidra-sim line-count pin for the faillog function moves from 281 to 279. Unit tests cover the condition rule and the option parse.Model:
anthropic/claude-opus-5-5🤖 Generated with Claude Code
https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU