This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [m32c-elf] losing track of register lifetime in combine?
- From: Ian Lance Taylor <iant at google dot com>
- To: "Dave Korn" <dave dot korn at artimi dot com>
- Cc: "'DJ Delorie'" <dj at redhat dot com>, <gcc at gcc dot gnu dot org>
- Date: 10 Nov 2006 07:01:25 -0800
- Subject: Re: [m32c-elf] losing track of register lifetime in combine?
- References: <032d01c704c3$b6f2fca0$a501a8c0@CAM.ARTIMI.COM>
"Dave Korn" <dave.korn@artimi.com> writes:
> On 10 November 2006 07:13, Ian Lance Taylor wrote:
>
> > DJ Delorie <dj@redhat.com> writes:
> >
> >> I compared the generated code with an equivalent explicit test,
> >> and discovered that gcc uses a separate rtx for the intermediate:
> >>
> >> i = 0xfffff;
> >> if (j >= 16)
> >> {
> >> int i2;
> >> i2 = i >> 8;
> >> i = i2 >> 8;
> >> j -= 16;
> >> }
> >>
> >> This seems to avoid the combiner problem, becuase you don't have the
> >> same register being set and being used in one insn. Does this explain
> >> why combine was having a problem, or was this a legitimate thing to do
> >> and the combiner is still wrong? Using a temp in the expander works
> >> around the problem.
> >
> > Interesting. Using a temporary is the natural way to implement this
> > code. But not using a temporary should be valid. So I think there is
> > a bug in combine.
>
>
> Doesn't this just suggest that there's a '+' constraint modifier missing
> from an operand in a pattern in the md file somewhere, such as the one that
> expands the conditional in the first place?
Not necessarily. I would guess that it's a define_expand which
generates a pseudo-register and uses it as
(set (reg) (ashiftrt (reg) (const_int 8)))
That is OK.
In any case a '+' constraint doesn't make any difference this early in
the RTL passes. combine doesn't look at constraints.
Ian