Re: [PATCH 1/2] x86: optimize XCHG to MOV for same-register forms
Paul Floyd via Valgrind-developers <valgrind-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
| Newsgroups | gmane.comp.debugging.valgrind.devel,gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
On 2026-07-03 08:23, Jan Beulich wrote: > I don't expect so. In fact, my take is that -O... should not be used on > compiler generated code. The compiler should do whatever optimizations > are possible / sensible, and it should not emit code which can (easily) > further be optimized. (Easily because the assembler really only does > very simple and pretty obvious transformations.) > > I can see that there may be a desire to optimize asm()-generated code. > That imo shouldn't be done by passing -Wa,-O... but rather by some > other, to be invented machinery. (We could tie it to the #APP / #NO_APP > markers that the compiler emits, for example.) Hi Well this does look like a gratuitous optimisation to me. We chose these sequences because we believed that no compiler or sensible person would ever use them. Other than Valgrind do you have any real world examples of benefits of making this change? Regards Paul