Repository navigation
[AUTOMATED] ARM: keep a constant returned through a conditional return beside a call (condexeretuse) - #948
Merged
Conversation
…oes not reject a return value (WIP) [AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
…t merges [AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
[AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
[AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
… scores [AUTOMATED] A value whose forced branch leads away from the RETURN (a spin loop, a call that does not return) never reaches it; skipping every use it cannot reach passed the walk with nothing checked. Adds the spin / bleq exit stage cases, unit tests for forced_out_block, the reachability cap and the forced-away case, and re-derives the counts on the rebased base. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
[AUTOMATED] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF
mahaloz
added a commit
that referenced
this pull request
Oct 6, 2026
mahaloz
added a commit
that referenced
this pull request
Oct 6, 2026
38 of 42 tasks
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.
On ARM, a function that returns a constant through a conditional return (
bxeq lr,popeq {...,pc}) and otherwise tail-calls or returns a call's result prints asvoid. Run against main:With this change it prints
int pick(int a0) { if (a0) return getv(a0); return 7; }.The fix
pickiscmp r0,#0; moveq r0,#7; bxeq lr; b getv. Thebxeqblock merges the two arms of themoveqand branches on Z again, so in the graph the 7 reaches both the RETURN and the tail call'sr0, though the execution that writes it always returns. Return recovery scoresr0beforeActionConditionalExeremoves that merge, and the sole-use check rejects it for the call.condexeretuse(default on,P4). When the sole-use walk for a RETURN fails after passing through such a merge, it is repeated once, skipping the uses the merge's forced branch cannot reach. Two merges in a row (a 64-bitmoveq r0,#7; moveq r1,#0; bxeq lr) are followed.moveq r0,#7; beq spin/bleq exit) leaves the function void. A value reached both through such a merge and another way keeps the old answer.getv(a0)argument comes from the same impossible path on the call side. It is left alone here: rescoring it would also drop the real argument fromif (a) return getw(a);to an unprototyped callee.Tests
tests/stages/kuna-condexeretuse.xml: ARMbxeq, 64-bit pair,popeq, and a Thumbitt eqblock, plus six shapes that must stay void (including the spin loop andbleq exitin ARM and Thumb). Pass 1 (option off) is the bug; the file fails on main. Unit tests cover the forced out block (and its complement), the reachability cap, and the forced-away case.decompile-allbefore/after: 13 decbench ARM firmware images (O0/O2) change 3 functions, all u-boot EFI helpers that now return their status (efi_locate_handle_buffer_intreturns0x80000002on a null argument, as the source does). 120 u-boot objects rebuilt with clang for ARM and Thumb change onlyubi_major2num, which now returns-19or the device number. 96 ARM/AArch64 fixtures and 8 x86-64 binaries are unchanged.decompile-allmin of 11 interleaved runs: total +0.6% (gzip 0.0%, kmod -1.3%, grep -O0 +1.4%, ls +0.7%, nuttx +1.3%, chibios +2.3%), within run-to-run noise. The second walk only runs when the first one fails after passing such a merge.Fixes #874
Part of #890
🤖 Generated with Claude Code
https://claude.ai/code/session_01Qihrih8NnnexavqvZxp8CF