This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

code quality pesimization with function returning changes


Hi,
the patch making function value to be always returned in register has
caused notable slowdown in m88ksim test. I've hoped the Lars's patch
to fix it but it don't seems to do.

While lurking around the code a bit, it seems to be related to the
unreturned values.
function:

int a(a)
{
	 b(a);
}

results in code


;; Function a

(note 2 0 4 NOTE_INSN_DELETED)

(insn 4 2 5 (set (reg/v:SI 59)
        (mem/f:SI (reg/f:SI 53 virtual-incoming-args) 1)) -1 (nil)
    (expr_list:REG_EQUIV (mem/f:SI (reg/f:SI 53 virtual-incoming-args) 1)
        (nil)))

(note 5 4 7 NOTE_INSN_FUNCTION_BEG)

(note 7 5 21 0x4016fbc0 NOTE_INSN_BLOCK_BEG)

(call_insn 21 7 22 (call_placeholder 17 10 0 0 (call_insn 20 19 0 (set (reg:SI 0 eax)
            (call (mem:QI (symbol_ref:SI ("b")) 0)
                (const_int 16 [0x10]))) -1 (nil)
        (nil)
        (nil))) -1 (nil)
    (nil)
    (nil))

(note 22 21 23 0x4016fbc0 NOTE_INSN_BLOCK_END)

(note 23 22 25 NOTE_INSN_FUNCTION_END)

(insn 25 23 26 (clobber (reg/i:SI 0 eax)) -1 (nil)
    (nil))

(code_label 26 25 28 1 "" "" [0 uses])

(insn 28 26 29 (set (reg/i:SI 0 eax)
        (reg:SI 58)) -1 (nil)
    (nil))

(insn 29 28 0 (use (reg/i:SI 0 eax)) -1 (nil)
    (nil))

See the insn 28, that sets eax according to the reg 58.  The reg 58 is
never set, so it is live over whole function body.  This prevents
tail call optimization and pesimizes register allocation.

Is there some way around? What exactly the patch solves?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]