http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50315
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-07 15:09:47 UTC --- (In reply to comment #5) > On Wed, 7 Sep 2011, sergos.gnu at gmail dot com wrote: > > > Will it be a good idea to have a twos-complement architecture hook? In case > > of > > All architectures supported by GCC are twos-complement. > > > x86 we can reassociate since the architecture itself always behave as > > twos-complement. So introducing such a flag can help with this particular > > reassociation and another one that Ilya Enkovich implemented recently. > > The ability to reassociate does not depend on architecture features. > > C is a high-level language whose defined semantics are that signed integer > overflow is undefined, independent of any target architecture. > > GENERIC and GIMPLE are internal representations in GCC that follow the > same semantics for signed integer overflow as C does, independent of > target architecture. On the no-undefined-overflow branch there are tree codes for arithmetic where we know overflow does not occur (for both signed and unsigned types). So you can go from (a +no b) +no c to a + (b + c), dropping overflow knowledge on re-association.