[PATCH] [4.2] Make fold, fold (type) (a CMP b) into a CMP b for integral types

Jeffrey A Law law@redhat.com
Thu Sep 8 14:39:00 GMT 2005


On Mon, 2005-08-29 at 00:23 -0400, Andrew Pinski wrote:
> I noticed while working on my tree combiner, that fold does not fold
> "(integral_type) (a CMP b)" to "a CMP b" with the integral_type as the
> resulting comparison's type. This improves the amount of simplifications
> the tree combiner can do and actually improves the likely-hood that the
> tree combiner replaces forwprop pass fully.  Also this is already in
> convert, convert just has too many places where it does fold's job; this
> is just one example.  Should I also remove the code from convert?
> 
> OK for 4.2? Bootstrapped and tested on x86_64-linux-gnu with no 
> regressions.
> 
> Thanks,
> Andrew Pinski
> 
> ChangeLog:
> 
> 	* fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For
> 	COMPARISON_CLASS_P and an integral types create create a new
> 	expression with the new type and fold that.
The corrected version (which you posted soon after this one) is OK
once we've created the 4.1 branch.  You should probably attach this
patch to the list of 4.2 pending patches.

Jeff




More information about the Gcc-patches mailing list