This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Flow crash for conditional branches against a constant
- From: Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Jun 2004 10:52:17 +0100
- Subject: Re: Flow crash for conditional branches against a constant
- References: <20040611154452.GA26000@nevyn.them.org> <1086973215.11466.31.camel@pc960.cambridge.arm.com> <20040611170534.GA30014@nevyn.them.org> <20040612204600.GA4466@nevyn.them.org>
On Sat, 2004-06-12 at 21:46, Daniel Jacobowitz wrote:
> On Fri, Jun 11, 2004 at 01:05:34PM -0400, Daniel Jacobowitz wrote:
> > Rather than adding it I'm testing removal of the invariant. I don't
> > see anything besides the boolean arithmetic functions which relies on
> > the exact form of the condition... yet.
>
> I still don't see any problems. The attached patch causes no
> differences in the generated libstdc++ on arm-elf (both -marm and
> -mthumb), and no testsuite changes for C, C++, or libstdc++-v3 (again
> -marm and -mthumb).
>
> [Well, no real testsuite changes. Four libstdc++ tests failed, but
> pass when rerunning them by hand; the error is symptomatic of a missing
> input file. Two g++ tests pass, where they used to fail to link
> referencing a symbol in libstdc++, but libstdc++ is exactly the same.
> I think I botched something running the tests.]
>
> I imagine there's some case where this permits slightly better code on
> Thumb. It also allows me to use cond_exec patterns which compare
> against non-zero constants.
>
> OK?
No, I don't think so (unless I've misunderstood your patch).
The problem is that we only track the one register in the cond table, by
removing the constraint that the second argument is against 0, you
potentially allow
if (a < b)
op1;
else if (a >= c)
op2;
to be transformed into
if (a < b)
op1;
else
op2;
which it might do because it only takes into account 2 of the 3
constraints required (operand 1 is 'a', comparison is opposite of '<')
and ignores the third (operand 2 is 'b'). This is clearly not the same.
R.