This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Flow crash for conditional branches against a constant


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.


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