On Fri, Jan 13, 2012 at 10:00 AM, Eric Botcazou <ebotca...@adacore.com> wrote:
>> Yes, it is a complete solution. Tracking register liveness is
>> different issue, and a register is indeed dead after instruction, if
>> it has been clobbered by insn, or when marked unused.
>
> My concern was liveness within the new sequence of instructions: suppose you
> have
>
>  (set (reg:M x) (...))  REG_UNUSED (reg:M x)
>
> and we "peephole" the instruction.  Is the live range of (reg:M x) properly
> extended within the new sequence of instructions?

The patch doesn't change this functionality, but:

(match_scratch:M 1 "r")
 (set (reg:M x) (...))  REG_UNUSED (reg:M x)
(match_dup 1)

Previously, register x would be allocated as a scracth register, but
now it isn't. Regarding the liveness analysis of a new sequence - this
functionality is not changed at all. As said, the new code only
prevents x to be allocated as a scratch that must live up to the
(match_dup 1).

>> The problem my patch solves is the answer to the question "Is the
>> choosen non-live temporary register untouched over the insn
>> sequence?". The answer: "Yes, if it was not set or clobbered by any
>> insn in the sequence".
>
> Are you sure that you don't need to do this in addition to the existing test,
> instead of in lieu of the existing test?

Yes, because new test ALWAYS includes the registers that were wrongly
marked as dead by previous test due to REG_UNUSED and noclobber
processing.

Uros.

Reply via email to