[fpc-devel] Peephole Optimizer - work in reducing number of passes
J. Gareth Moreton
gareth at moreton-family.com
Mon Oct 19 14:52:04 CEST 2020
Hi everyone,
Being on a working Intel laptop full-time again, I've gone back to
looking at the Peephole Optimizer like I always used to do. One thing
I've been focusing on is an attempt to reduce the number of passes of
the Peephole Optimizer, since a single pass amounts to stepping through
every instruction in the pre-compiled assembly language, which can get
long for complex routines.
https://bugs.freepascal.org/view.php?id=37959
The main change is that the mandatory second run of pass 1 has been
removed, and the upper limit on the number of iterations performed is
governed by whether the setting is -O2 (2), -03 (5) or -O4 (8), and 1
otherwise - details are in the bug report. As a result -O1 will perform
slightly worse, but I gathered from past conversations that this is
acceptable as this is generally only done when debugging - if it's not,
then this can be easily fixed by changing the upper limit from 1 to 2
for -O1. -O2 and above should be exactly the same in regards to the
code that is produced (if it's not, then there's likely something wrong
with an optimisation not setting Result to True when it should have
done). So far, I've had success with the RTL and Lazraus when it comes
to this.
Ultimately, there should be a slight increase in compiler performance
under high optimisation settings... at least that's the theory. Under
x86 platforms at least, I've been making sure optimisations do set
Result to True when they should.
Gareth aka. Kit
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the fpc-devel
mailing list