[RFC] optimize x - y cmp 0 with undefined overflow

Eric Botcazou ebotcazou@adacore.com
Tue May 27 16:14:00 GMT 2014


> I'm asking to merge them (move them to fold_comparison).

Done (in the end the patch removes more lines than it adds :-).

Tested on x86_64-suse-linux with no regressions.


2014-05-27  Eric Botcazou  <ebotcazou@adacore.com>

	* fold-const.c (fold_comparison): Clean up and extend X +- C1 CMP C2
	to X CMP C2 -+ C1 transformation to EQ_EXPR/NE_EXPR.
	Add X - Y CMP 0 to X CMP Y transformation.
	(fold_binary_loc) <EQ_EXPR/NE_EXPR>: Remove same transformations.


2014-05-27  Eric Botcazou  <ebotcazou@adacore.com>

        * gcc.dg/fold-compare-8.c: New test.
        * gcc.dg/Wstrict-overflow-25.c: Likewise.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 6975 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140527/4db0d709/attachment.bin>


More information about the Gcc-patches mailing list