This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING: [PATCH] Fix PR 20972
Josh Conner wrote:
On Apr 27, 2005, at 3:40 AM, Bernd Schmidt wrote:
Josh Conner wrote:
In the register allocator, change post-modified registers to be
considered 'clobbered', instead of 'set'.
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01291.html
I doubt that this is the right thing to do. Could you post more
analysis (initial RTL and RTL before and after register allocation)?
I'd expect the same assumption is made by a number of other places in
the compiler.
[...]
(rN corresponds to virtual register 110 and rM to 104 in the attached
dumps)
And the question is: should rN and rM be allowed to share a register if
rM is not initialized in a previous instruction (it isn't live coming
into this instruction)?
Vlad, this appears to be another side effect of your accurate liveness
analysis: http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01038.html
As far as I can tell the idea of that patch appears to be that a
register that appears to be uninitialized on a path can't conflict with
one that is initialized. However, a register may not only appear to be
uninitialized, it can actually be used uninitialized, as in Josh's
testcase. By sharing the same register for two different inputs we
could generate RTL that's invalid. In this case we have an assembler
warning, but I imagine there could be situations where the compiler
itself aborts.
The solution I'd prefer is to make sure that if two registers are used
as inputs in the same instruction, they must conflict, regardless of
what the liveness analysis thinks. (We might want to go back to the
recent find_dummy_reload issue to see if that would also be fixed by
such a change).
Bernd