Skip to content

HLIL decompilation should recognize and merge duplicate blocks of code #7082

@pjcreath

Description

@pjcreath

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):

Image

(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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CoreIssue needs changes to the coreEffort: MediumIssue should take < 1 monthImpact: LowIssue is a papercut or has a good, supported workaround

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions