This is the mail archive of the 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: [PATCH] Constant fold -A - B as -B - A (take 2)

Hi Jan,
> 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
> friends.

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.


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