GCC inlines small functions if the code size after expansion is not
excedded.
For test case (inline.c, avr-gcc -Os -S inline.c) code size become
higher if
'func2' is inlined. It happens because the CONVERT_EXPR/ NOP_EXPR are
considered
as zero cost expression.
Few conversions will cost additional instructions. For targets like AVR
it will cost considerably as it's register size is just one byte.
Attached the tentative patch that changes the CONVERT_EXPR/ NOP_EXPR cost
to 1 if the LHS is bigger than RHS and target's word_mode.
Is this Ok?
Would it be reasonable if cost evaluated as below instead of constant 1?
if (LHS PRECISION > RHS PRECISION)
cost = LHS_PRECISION / word_mode - 1
else
cost = 0
Built GCC for native with bootstrap enabled. No issues.