in-accurate costs to estimate function body size?
Pitchumani Sivanupandi
pitchumani.sivanupandi@microchip.com
Fri Oct 28 12:18:00 GMT 2016
GCC inlines small functions if the code size after expansion is not
exceeded.
For attached test case (inline.c) code size become higher if 'func1' is
inlined. It happens because the CONVERT_EXPR/ NOP_EXPR are considered as
zero
size expression.
Function 'func1' is auto-inlined with -Os option (gcc -Os -S inline.c).
Code size is better if 'func1' is not inlined.
gcc -Os -S inline.c -DDONTINLINE
Ref: gcc/tree-inline.c (estimate_operator_cost)
Not all convert expressions are 'free' in terms of size. At least for
targets
like AVR, it requires few instructions to be generated as the register size
is just 1 byte.
Is it Ok to associate any cost to CONVERSION expressions?
Also there is comment '??? We may consider mapping RTL costs to this'.
Or any other way to get the code size estimation correct?
Regards,
Pitchumani
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inline.c
Type: text/x-csrc
Size: 699 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20161028/f72617a7/attachment.bin>
More information about the Gcc-help
mailing list