[Patch] x86: RegLoadedWIthNewValue overhaul and bug fix
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 previous bug in RegLoadedWithNewValue in that it returned False for SHRX even though its destination register is completely overwritten - this caused some incorrect optimisations in DeepMOVOpt when building the compiler under -Cfavx2 -Cpcoreavx settings.
The new RegLoadedWithNewValue tries to trim down the number of special instructions to check and instead relies on the InsProp array for its information.
Steps to reproduce:
Apply patch and confirm correct compilation, especially cross-compiling from x86_64-linux to i386-linux using -Cfavx2 -Cpcoreavx
Additional information:
- This overhaul causes many "Mov2Nop 5" optimisations to be replaced with "Mov2Nop 3" (same functionality).
- Thanks to an additional check of RegLoadedWithNewValie in OptPass1MOV, a few leaf procedures become more efficient because the optimizer is able to remove "mov %esp,%ebp" when the base pointer is never used (there are no hints to SEH as to what it contains, only that it was pushed to the stack). This tends to happen more often on i386.
Mantis conversion info:
- Mantis ID: 39187
- OS: Microsoft Windows and Linux
- OS Build: 10 Home
- Build: r49585
- Platform: I386 and x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 49588 (#c185ce02)