[fpc-devel] generated assembler code

Jonas Maebe jonas.maebe at elis.ugent.be
Tue May 19 15:23:43 CEST 2015

Martin Frb wrote on Tue, 19 May 2015:

> 005EACF0 833A00                   cmp dword ptr [edx],$00
> 005EACF3 0F95C0                   setnz al
> 005EACF6 84C0                     test al,al
> 005EACF8 7509                     jnz +$09
> Is that something that should be optimized away?

I'm sure you can find 100's of examples like that when using inline.  
So yes, it's obviously a missed optimisation, but an x86 peephole  
optimisation to remove those two instructions is "dweilen met de kraan  
open" (mopping up water while leaving the tap running), and (as far as  
I'm concerned) a waste of time since exactly the same happens on all  
architectures as well (except for possibly those without flags).

Florian has some ideas about how to simplify the node tree so that  
they can be optimised better at that (higher) level, but that won't  
immediately solve this particular problem by itself (although it's a  
step in the right direction) and it won't be ready any time soon.


More information about the fpc-devel mailing list