Skip to content

[x86 / Refactor] OptPass2JMP simplification

Summary

This merge request simplifies the OptPass2JMP optimisation on x86 platforms by no longer explicitly checking to see if the next instruction is a direct assignment (e.g. MOV) prior to calling CheckJumpMovTransferOpt, instead relying on the callee function to do the heavy lifting. The performance hit should be negligable (and slightly improved in cases where the optimisation can be applied), but it reduces the compiler's code size and improves maintainability by not having two separate lists of valid assignment instructions to check against (it would be all too easy to add (or remove) an instruction to one list but forget to do the same for the other list).

System

  • Processor architecture: i386, x86_64

What is the current bug behavior?

N/A

What is the behavior after applying this patch?

Compiler should be slightly smaller and simpler

Relevant logs and/or screenshots

This a pure refactor and there are no changes in generated machine code. The only difference is that OptPass2JMP is smaller and simpler.

For x86_64-win64 under -O2 (default)...

Before: 3,855,872 bytes
After: 3,852,800 bytes

Edited by J. Gareth "Kit" Moreton

Merge request reports