[Patch]Better node count heuristic for inlining code
Original Reporter info from Mantis: Julian Puhl @jpuhl
-
Reporter name:
Original Reporter info from Mantis: Julian Puhl @jpuhl
- Reporter name:
Description:
The current heuristic for inlining tries to calculate the complexity based on the nth-root using the current inline level. It does not take any actual code length into account. This is bad as the number of allowed nodes shrinks drastically the further the inline level gets. If you have small functions which call other small functions you will very soon get not any inlines at all despite having only a few lines of code.
This patch tries to get a better estimate of the actual node count by summing all the nodes up until a limit is reached. The limit can be set with {$MAXINLINELENGTH x} where x is the maximum number of nodes. The default is currently 600 but ideally this is chosen depending on the target cpu.
If the patch is going to be accepted the new compiler directive should probably be changed from a global to a local directive with am additional command line parameter. I was not sure if it is worth the effort so for now I chose the simplest implementation. I can modify it if wanted.
Also since this is my first compiler patch there might be things which are not done the way the team usually handles them.
The patch was created against revision 39750.