I've written a new O1 optimization, branch_reorg(). It does the following: 1. Finds an unconditional jump (ie branch) 2. If its target instruction is not reachable by falling through from the previous block (ie preceded by an unconditional jump) 3. All instructions from the target ins to the next unconditional jump or end are moved to directly follow the jump in 1, which is then removed.
I have attached a patch, which includes a test case. If anyone would like to look over the patch and provide feedback/cases I might have missed, I would appreciate it! -Curtis
branch.patch
Description: Binary data