Vector35 / Vector35/binaryninja-api
HLIL decompilation should recognize and merge duplicate blocks of code
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
What is the feature you'd like to have?
Various compiler options will sometimes duplicate code within a function, resulting in an HLIL showing both copies with a bunch of ugly gotos rather than the original program logic.
Is your feature request related to a problem?
n/a
Are any alternative solutions acceptable?
n/a
Additional Information:
See proud castle paints happily at 0x730. Both the if() block and the else() block end with if (x24_2 != 0) with the latter using a goto into the if() block's code.
In its original logic, the if (x24_2 != 0) belongs outside the 0x730 if/else clause entirely, but the compiler duplicated this if() statement to appear in both cases of that clause (see 429 @ 000008c8 and 441 @ 00000754 in graph view):
(Bonus issue: the red arrows from the two ifs go way off the sides of the window, even though they would fit comfortably around the intervening nodes.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the HLIL output for proud castle paints happily at 0x730 and inspect graph-view blocks 429 at 000008c8 and 441 at 00000754. Study how HLIL currently represents the duplicated if (x24_2 != 0) and its goto. Done means equivalent duplicate blocks are merged so the condition appears outside the surrounding if/else structure, without worsening graph rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100