On Mon, Jun 27, 2011 at 8:52 PM, Kai Tietz <kti...@redhat.com> wrote: > Hello, > > this patch tries to sink conversions for comparisons patterns: > a) (type) X cmp (type) Y => x cmp y. > b) (type) X cmp CST => x cmp ((type-x) CST). > c) CST cmp (type) X => ((type-x) CST) cmp x. > > This patch just allows type sinking for the case that type-precision of type > is wider or equal to type-precision of type-x. Or if type and type-x have > same signess and CST fits into type-x. For cmp operation is == or !=, we > allow also that type and type-x have different signess, as long as CST fits > into type-x without truncation. > > ChangeLog > > 2011-06-27 Kai Tietz <kti...@redhat.com> > > * tree-ssa-forwprop.c (forward_propagate_into_comparision): > Sink types within comparison operands, if suitable. > > Bootstrapped and regression tested for x86_64-pc-linux-gnu. Ok for apply?
Hmm, why does fold_widened_comparison and fold_sign_changed_comparison not handle these cases? We already dispatch to fold in this function, so this is a case where we'd want fold to be improved. You didn't add testcases - do you have some that are not handled by fold already? Thanks, Richard. > Regards, > Kai >