[Patch/Refactor] Jump Optimisation Improvements
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
This patch makes some minor improvements to the cross-platform code that deals with jump optimisations. More specifically, it attempts to do more in a single pass which has the nice side-effect of fixing a couple of minor mistakes (in some situations, it would erroneously remove an alignment entry).
Steps to reproduce:
Apply patch and confirm compilers and generated code are correct.
Additional information:
- Most improvements are with dealing with Jcc/JMP pairs and their equivalents on other platforms, by collapsing label clusters and stripping dead code as soon as it has enough information to do so, and being more intelligent before calling Continue to see if another optimisation can be performed in the same sitting.
- RemoveDeadCodeAfterJump is now a function that returns True if a jump was found among the dead code, thus allowing the ability to flag the peephole optimizer for another iteration of Pass 1 - the destination label may have appeared earlier in the code and become dead as a result of the removal of the jump, thus opening up new optimisations with instructions that sat either side of the label.
- Preliminary tests show that it does sometimes reduce the number of passes required to optimise a subroutine under -O3.
Mantis conversion info:
- Mantis ID: 36371
- OS: Microsoft Windows
- OS Build: 10 Professional
- Build: r43596
- Platform: Cross-platform
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 43668 (#599e2df7)
- Monitored by: » Vincent (Vincent Snijders)