This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Constant fold -A - B as -B - A (take 2)
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: Richard Henderson <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 8 Feb 2003 11:03:14 -0700 (MST)
- Subject: Re: [PATCH] Constant fold -A - B as -B - A (take 2)
> At tree level we definitly need to preserve the fact that certain types
> do not overflow and do not introduce overflows when they are not
> supposed to happen. This is important for loop optimization and other
Please don't confuse the issue. The current loop optimizations operate
at the RTL-level and should be independent of signedness issues and/or
overflow. The fact that this isn't the case, is due to real bugs in the
Take for example, PR optimization/7799. This failure is not because of
the undefined behaviour of overflow, and many more competant compilers
can perform this induction variable substitution. The thing that they
have to remember is that the termination condition *must* be changed
from less than, to inequality and restricted to loops with known
bounds. With this fix we can enable many more loop optimizations in
the presence of overflows.
But let me stress once again, this has absolutely nothing to do with
constant folding transformations made at the tree-level. Adding bits
to the tree structure, and/or disabling valid transformations, achieves
nothing and doesn't correct the current brokeness of loop and friends.
I can only fix the compiler one patch at a time, so can we please limit
this discussion to the desired behaviour of "fold". But I'm begining
to appreciate more why people are getting confused about arguments.