[fpc-devel] CSE and node optimisation question
J. Gareth Moreton
gareth at moreton-family.com
Thu Feb 25 05:38:01 CET 2021
Regarding the "intolerably slow" option, I had the build script running
for about 45 minutes as it tried to get through ppc2, and then it
crashed with runtime error -1073741819. Converting this to hexadecimal
yields C0000005, which I know from experience is an access violation
(usually in the kernel somewhere).
So, long story short, I'm still stuck for now!
Gareth aka. Kit
On 25/02/2021 03:31, J. Gareth Moreton via fpc-devel wrote:
> Hi everyone,
>
> I've been looking at some node-level optimisations as of late, and I
> came across a couple of potential ones while doing experiments with
> the test on i38527, namely (R is an ordinal tempref, and n is an
> ordinal constant):
>
> add
> |- add
> | |- R
> | |- R
> |
> |- R
>
> Becoming:
>
> mul
> |- R
> |- 3
>
> And:
>
> add
> |- mul
> | |- R
> | |- n
> |
> |- R
>
> Becoming:
>
> mul
> |- R
> |- n+1
>
> I've been having a couple of issues though that I haven't been able to
> solve, the main thing is that taddnode.simplify doesn't get called to
> transmute the nodes as desired because pass 1 is already complete for
> most of the nodes by the time CSE is executed.
>
> I've tried a few workarounds, but ran into problems:
>
> - Once CSE is complete, calling simplify via foreachnodestatic with
> the pre-process option is unacceptably slow.
> - Attempting to selectively reset the pass 1 flags (in an attempt to
> minimise the massive performance loss with manually calling simplify
> as above) causes Internal Error 200405231 because it seems to upset
> implicit finally blocks.
> - Moving "add_entry_exit_code" to after "optcse" causes compilation of
> case blocks to malfunction.
>
> Can anyone give me advice on how to implement such a node-level
> CSE-specific optimisation? Such a thing may be useful for pure
> functions (as well as when writing things like "4 * n + 4 * n + 4 * n
> + 4 * n + 4 * n"!). Thanks in advance.
>
> 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