[fpc-devel] Merging identical procedure proposals
Jonas Maebe
jonas at freepascal.org
Sat Oct 16 16:32:40 CEST 2021
On 13/10/2021 19:33, J. Gareth Moreton via fpc-devel wrote:
> I figure this would be a whole-program optimization though due to
> inter-unit calls and comparisons and the like.
Usually this is an optimisation that is performed at link-time because
you don't need any compiler-level information for it. And then it can
also consider code from statically linked libraries etc. Most standard
linkers don't have support for it, but link-time optimisation frameworks
generally do.
One thing you have to be mindful of is that if the address of a routine
gets taken in any way then you cannot merge it anymore, because there
might be a comparison somewhere in the program such as
if procvar = @myproc then
..
end;
and if myproc gets merged with other routines, then this will return
true in more cases.
Jonas
More information about the fpc-devel
mailing list