[Patch] MovOpMov2Op/Lea2Add/Lea2Sub consolidation
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 addresses a minor issue in that there are two near-identical optimisations in OptPass1MOV and OptPass2MOV, and the question of which one gets run is largely just down to how many times pass 1 is run. Often, the pass 2 version never gets to run.
This patch removes the version in pass 2 and improves the version in pass 1 so it can do more in a single iteration (usually if the sequence is MOV/LEA/MOV, and the LEA can be converted into ADD or SUB). This is done by moving some LEA conversion code into a separate procedure and having IsFoldableArithOp call this conversion routine if the LEA instruction is eligible.
Steps to reproduce:
Apply patch and confirm correct compilation.
Additional information:
Often, a LEA instruction is coverted to ADD/SUB, but because it sits either side of a MOV, the MovOpMov2Op optimisation does not get noticed until the next iteration of pass 1, hence the potential in reducing the iteration count.
Time savings are currently marginal at best and the binary output size isn't improved, but it makes a notable difference in my personal work of reducing the number of iterations of pass 1 while ensuring the optimisation is as efficient as possible.
Also the compiler binaries are notably reduced in size:
ppc386: 3,156,480 -> 3,147,776 (8,704 byte saving)
ppcx64: 3,793,920 -> 3,782,656 (11,264 byte saving)
Mantis conversion info:
- Mantis ID: 37422
- OS: Microsoft Windows
- OS Build: 10 Professional
- Build: r45864
- Platform: i386 and x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 45865 (#55c4986c)
- Monitored by: » Vincent (Vincent Snijders)