[Bug middle-end/31531] A microoptimization of isnegative of signed integer

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 13 07:47:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31531

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-13 07:46:45 UTC ---
Created attachment 26645
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26645
Patch which fixes the problem (well the fold-const.c is really only needed for
the original testcase)

ChangeLog:
* fold-const.c (fold_comparison): Handle ((CAST)~X).
* tree-ssa-forwprop.c (combine_cond_expr_cond): Swap operands so
that fold_binary_loc would not return a non-folded tree.
Don't call canonicalize_cond_expr_cond.
(forward_propagate_into_comparison_1): Also combine casts into the comparisons.
(expand_possible_comparison): New function.
(forward_propagate_into_comparison): Call expand_possible_comparison.
(forward_propagate_into_gimple_cond): Take also a gsi.
Call expand_possible_comparison.
(forward_propagate_into_cond): Call expand_possible_comparison.
(ssa_forward_propagate_and_combine): Update call to
forward_propagate_into_gimple_cond.



More information about the Gcc-bugs mailing list