From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9478 invoked by alias); 8 Jul 2011 09:21:23 -0000 Received: (qmail 8895 invoked by uid 22791); 8 Jul 2011 09:21:18 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Jul 2011 09:20:57 +0000 Received: by wwj26 with SMTP id 26so1616615wwj.8 for ; Fri, 08 Jul 2011 02:20:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.206.82 with SMTP id ft18mr1553709wbb.64.1310116856262; Fri, 08 Jul 2011 02:20:56 -0700 (PDT) Received: by 10.227.36.212 with HTTP; Fri, 8 Jul 2011 02:20:56 -0700 (PDT) In-Reply-To: References: Date: Fri, 08 Jul 2011 09:28:00 -0000 Message-ID: Subject: Re: [patch tree-optimization]: [2 of 3]: Boolify compares & more From: Richard Guenther To: Kai Tietz Cc: GCC Patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00600.txt.bz2 On Thu, Jul 7, 2011 at 6:07 PM, Kai Tietz wrote: > Hello, > > This patch - second of series - adds boolification of comparisions in > gimplifier. =A0For this > casts from/to boolean are marked as not-useless. And in fold_unary_loc > casts to non-boolean integral types are preserved. > The hunk in tree-ssa-forwprop.c in combine_cond-expr_cond is not strictly > necessary - as long as fold-const handles 1-bit precision bitwise-express= ion > with truth-logic - but it has shown to short-cut some expensier folding. = So > I kept it within this patch. Please split it out. Also ... > > The adjusted testcase gcc.dg/uninit-15.c indicates that due > optimization we loose > in this case variables declaration. =A0But this might be to be expected. > > In vectorization we have a regression in gcc.dg/vect/vect-cond-3.c > test-case. =A0It's caused > by always having boolean-type on conditions. =A0So vectorizer sees > different types, which > aren't handled by vectorizer right now. =A0Maybe this issue could be > special-cased for > boolean-types in tree-vect-loop, by making operand for used condition > equal to vector-type. > But this is a subject for a different patch and not addressed by this ser= ies. > > There is a regressions in tree-ssa/vrp47.c, and the fix is addressed > by the 3rd patch of this > series. > > Bootstrapped and regression tested for all standard-languages (plus > Ada and Obj-C++) on host x86_64-pc-linux-gnu. > > Ok for apply? > > Regards, > Kai > > > ChangeLog > > 2011-07-07 =A0Kai Tietz =A0 > > =A0 =A0 =A0 =A0* fold-const.c (fold_unary_loc): Preserve > =A0 =A0 =A0 =A0non-boolean-typed casts. > =A0 =A0 =A0 =A0* gimplify.c (gimple_boolify): Handle boolification > =A0 =A0 =A0 =A0of comparisons. > =A0 =A0 =A0 =A0(gimplify_expr): Boolifiy non aggregate-typed > =A0 =A0 =A0 =A0comparisons. > =A0 =A0 =A0 =A0* tree-cfg.c (verify_gimple_comparison): Check result > =A0 =A0 =A0 =A0type of comparison expression. > =A0 =A0 =A0 =A0* tree-ssa.c (useless_type_conversion_p): Preserve incompa= tible > =A0 =A0 =A0 =A0casts from/to boolean, > =A0 =A0 =A0 =A0* tree-ssa-forwprop.c (combine_cond_expr_cond): Add simpli= fication > =A0 =A0 =A0 =A0support for one-bit-precision typed X for cases X !=3D 0 a= nd X =3D=3D 0. > =A0 =A0 =A0 =A0(forward_propagate_comparison): Adjust test of condition > =A0 =A0 =A0 =A0result. > > > =A0 =A0 =A0 =A0* gcc.dg/tree-ssa/builtin-expect-5.c: Adjusted. > =A0 =A0 =A0 =A0* gcc.dg/tree-ssa/pr21031.c: Likewise. > =A0 =A0 =A0 =A0* gcc.dg/tree-ssa/pr30978.c: Likewise. > =A0 =A0 =A0 =A0* gcc.dg/tree-ssa/ssa-fre-6.c: Likewise. > =A0 =A0 =A0 =A0* gcc.dg/binop-xor1.c: Mark it as expected fail. > =A0 =A0 =A0 =A0* gcc.dg/binop-xor3.c: Likewise. > =A0 =A0 =A0 =A0* gcc.dg/uninit-15.c: Adjust reported message. > > Index: gcc-head/gcc/fold-const.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/fold-const.c > +++ gcc-head/gcc/fold-const.c > @@ -7665,11 +7665,11 @@ fold_unary_loc (location_t loc, enum tre > =A0 =A0 =A0 =A0 =A0 =A0 non-integral type. > =A0 =A0 =A0 =A0 =A0 =A0 Do not fold the result as that would not simplify= further, also > =A0 =A0 =A0 =A0 =A0 =A0 folding again results in recursions. =A0*/ > - =A0 =A0 =A0 =A0 if (INTEGRAL_TYPE_P (type)) > + =A0 =A0 =A0 =A0 if (TREE_CODE (type) =3D=3D BOOLEAN_TYPE) > =A0 =A0 =A0 =A0 =A0 =A0return build2_loc (loc, TREE_CODE (op0), type, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_OPERAND = (op0, 0), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_OPERAND = (op0, 1)); > - =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 else if (!INTEGRAL_TYPE_P (type)) > =A0 =A0 =A0 =A0 =A0 =A0return build3_loc (loc, COND_EXPR, type, op0, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fold_convert = (type, boolean_true_node), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fold_convert = (type, boolean_false_node)); > Index: gcc-head/gcc/gimplify.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/gimplify.c > +++ gcc-head/gcc/gimplify.c > @@ -2842,18 +2842,23 @@ gimple_boolify (tree expr) > > =A0 =A0 case TRUTH_NOT_EXPR: > =A0 =A0 =A0 TREE_OPERAND (expr, 0) =3D gimple_boolify (TREE_OPERAND (expr= , 0)); > - =A0 =A0 =A0/* FALLTHRU */ > > - =A0 =A0case EQ_EXPR: case NE_EXPR: > - =A0 =A0case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR: > =A0 =A0 =A0 /* These expressions always produce boolean results. =A0*/ > - =A0 =A0 =A0TREE_TYPE (expr) =3D boolean_type_node; > + =A0 =A0 =A0if (TREE_CODE (type) !=3D BOOLEAN_TYPE) > + =A0 =A0 =A0 TREE_TYPE (expr) =3D boolean_type_node; > =A0 =A0 =A0 return expr; > > =A0 =A0 default: > + =A0 =A0 =A0if (COMPARISON_CLASS_P (expr)) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 /* There expressions always prduce boolean results. =A0= */ > + =A0 =A0 =A0 =A0 if (TREE_CODE (type) !=3D BOOLEAN_TYPE) > + =A0 =A0 =A0 =A0 =A0 TREE_TYPE (expr) =3D boolean_type_node; > + =A0 =A0 =A0 =A0 return expr; > + =A0 =A0 =A0 } > =A0 =A0 =A0 /* Other expressions that get here must have boolean values, = but > =A0 =A0 =A0 =A0 might need to be converted to the appropriate mode. =A0*/ > - =A0 =A0 =A0if (type =3D=3D boolean_type_node) > + =A0 =A0 =A0if (TREE_CODE (type) =3D=3D BOOLEAN_TYPE) > =A0 =A0 =A0 =A0return expr; > =A0 =A0 =A0 return fold_convert_loc (loc, boolean_type_node, expr); > =A0 =A0 } > @@ -6763,7 +6768,7 @@ gimplify_expr (tree *expr_p, gimple_seq > =A0 =A0 =A0 =A0 =A0 =A0tree org_type =3D TREE_TYPE (*expr_p); > > =A0 =A0 =A0 =A0 =A0 =A0*expr_p =3D gimple_boolify (*expr_p); > - =A0 =A0 =A0 =A0 =A0 if (org_type !=3D boolean_type_node) > + =A0 =A0 =A0 =A0 =A0 if (!useless_type_conversion_p (org_type, TREE_TYPE= (*expr_p))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*expr_p =3D fold_convert (org_type, *expr_= p); Use fold_convert_loc with saved_location > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D GS_OK; > @@ -7208,7 +7213,7 @@ gimplify_expr (tree *expr_p, gimple_seq > =A0 =A0 =A0 =A0 =A0 =A0 =A0 fold_truth_not_expr) happily uses operand typ= e and doesn't > =A0 =A0 =A0 =A0 =A0 =A0 =A0 automatically uses boolean_type as result, we= need to keep > =A0 =A0 =A0 =A0 =A0 =A0 =A0 orignal type. =A0*/ > - =A0 =A0 =A0 =A0 =A0 if (org_type !=3D boolean_type_node) > + =A0 =A0 =A0 =A0 =A0 if (!useless_type_conversion_p (org_type, TREE_TYPE= (*expr_p))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*expr_p =3D fold_convert (org_type, *expr_= p); Likewise. Maybe this fixes the diagnostic regression. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D GS_OK; > @@ -7288,7 +7293,19 @@ gimplify_expr (tree *expr_p, gimple_seq > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tree type =3D TREE_TYPE (TREE_OPERAND = (*expr_p, 1)); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!AGGREGATE_TYPE_P (type)) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto expr_2; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tree org_type =3D TREE_TYPE (*e= xpr_p); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *expr_p =3D gimple_boolify (*ex= pr_p); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!useless_type_conversion_p = (org_type, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_TYPE (*expr_p))) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *expr_p =3D fold_conver= t_loc (saved_location, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 org_type, *expr_p); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D GS_OK; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto expr_2; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else if (TYPE_MODE (type) !=3D BLKmode) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D gimplify_scalar_mode_aggre= gate_compare (expr_p); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else > Index: gcc-head/gcc/tree-cfg.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/tree-cfg.c > +++ gcc-head/gcc/tree-cfg.c > @@ -3203,7 +3203,9 @@ verify_gimple_comparison (tree type, tre > =A0 =A0 =A0 =A0&& (!POINTER_TYPE_P (op0_type) > =A0 =A0 =A0 =A0 =A0 || !POINTER_TYPE_P (op1_type) > =A0 =A0 =A0 =A0 =A0 || TYPE_MODE (op0_type) !=3D TYPE_MODE (op1_type))) > - =A0 =A0 =A0|| !INTEGRAL_TYPE_P (type)) > + =A0 =A0 =A0|| !INTEGRAL_TYPE_P (type) > + =A0 =A0 =A0|| (TREE_CODE (type) !=3D BOOLEAN_TYPE > + =A0 =A0 =A0 =A0 && TYPE_PRECISION (type) !=3D 1)) > =A0 =A0 { > =A0 =A0 =A0 error ("type mismatch in comparison expression"); > =A0 =A0 =A0 debug_generic_expr (type); > Index: gcc-head/gcc/tree-ssa.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/tree-ssa.c > +++ gcc-head/gcc/tree-ssa.c > @@ -1306,10 +1306,10 @@ useless_type_conversion_p (tree outer_ty > =A0 =A0 =A0 =A0 =A0|| TYPE_PRECISION (inner_type) !=3D TYPE_PRECISION (ou= ter_type)) > =A0 =A0 =A0 =A0return false; > > - =A0 =A0 =A0/* Preserve conversions to BOOLEAN_TYPE if it is not of prec= ision > - =A0 =A0 =A0 =A0 one. =A0*/ > - =A0 =A0 =A0if (TREE_CODE (inner_type) !=3D BOOLEAN_TYPE > - =A0 =A0 =A0 =A0 && TREE_CODE (outer_type) =3D=3D BOOLEAN_TYPE > + =A0 =A0 =A0/* Preserve conversions to/from BOOLEAN_TYPE if types are not > + =A0 =A0 =A0 =A0of precision one. =A0*/ > + =A0 =A0 =A0if (((TREE_CODE (inner_type) =3D=3D BOOLEAN_TYPE) > + =A0 =A0 =A0 =A0 =A0!=3D (TREE_CODE (outer_type) =3D=3D BOOLEAN_TYPE)) > =A0 =A0 =A0 =A0 =A0&& TYPE_PRECISION (outer_type) !=3D 1) > =A0 =A0 =A0 =A0return false; > > Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/builtin-expect-5.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/tree-ssa/builtin-expect-5.c > +++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/builtin-expect-5.c > @@ -11,5 +11,5 @@ f (int i, float j) > > =A0/* { dg-final { scan-tree-dump-times { if } 2 "forwprop1"} } */ > =A0/* { dg-final { scan-tree-dump {builtin_expect[^\n]*, 0\);\n[^\n]*if} > "forwprop1"} } */ > -/* { dg-final { scan-tree-dump {builtin_expect[^\n]*, 1\);\n[^\n]*if} > "forwprop1"} } */ > +/* { dg-final { scan-tree-dump-not {builtin_expect[^\n]*, > 1\);\n[^\n]*if} "forwprop1"} } */ Hm? Why that? > =A0/* { dg-final { cleanup-tree-dump "forwprop?" } } */ > Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/pr21031.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/tree-ssa/pr21031.c > +++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/pr21031.c > @@ -16,5 +16,5 @@ foo (int a) > =A0 =A0 return 0; > =A0} > > -/* { dg-final { scan-tree-dump-times "Replaced" 2 "forwprop1"} } */ > +/* { dg-final { scan-tree-dump-times "Replaced" 1 "forwprop1"} } */ > =A0/* { dg-final { cleanup-tree-dump "forwprop1" } } */ > Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/pr30978.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/tree-ssa/pr30978.c > +++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/pr30978.c > @@ -10,5 +10,5 @@ int foo(int a) > =A0 return e; > =A0} > > -/* { dg-final { scan-tree-dump "e_. =3D a_..D. > 0;" "optimized" } } */ > +/* { dg-final { scan-tree-dump " =3D a_..D. > 0;" "optimized" } } */ > =A0/* { dg-final { cleanup-tree-dump "optimized" } } */ > Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-6.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-6.c > +++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-6.c > @@ -2,5 +2,5 @@ > =A0/* { dg-options "-O -fdump-tree-fre1-details" } */ > > =A0int i; int foo(void) { i =3D 2; int j =3D i * 2; int k =3D i + 2; retu= rn j =3D=3D k; } > -/* { dg-final { scan-tree-dump-times "Replaced " 5 "fre1" } } */ > +/* { dg-final { scan-tree-dump-times "Replaced " 6 "fre1" } } */ > =A0/* { dg-final { cleanup-tree-dump "fre1" } } */ > Index: gcc-head/gcc/tree-ssa-forwprop.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/tree-ssa-forwprop.c > +++ gcc-head/gcc/tree-ssa-forwprop.c > @@ -367,9 +367,61 @@ combine_cond_expr_cond (location_t loc, > =A0 gcc_assert (TREE_CODE_CLASS (code) =3D=3D tcc_comparison); > > =A0 t =3D fold_binary_loc (loc, code, type, op0, op1); > + > + =A0if (!t && INTEGRAL_TYPE_P (TREE_TYPE (op1)) > + =A0 =A0 =A0&& TYPE_PRECISION (TREE_TYPE (op1)) =3D=3D 1 > + =A0 =A0 =A0&& (code =3D=3D EQ_EXPR || code =3D=3D NE_EXPR)) > + =A0 =A0{ > + =A0 =A0 =A0if (TREE_CODE (op1) =3D=3D INTEGER_CST) > + =A0 =A0 =A0 =A0{ > + =A0 =A0 =A0 =A0 if (integer_onep (op1)) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 op1 =3D fold_convert_loc (loc, TREE_TYPE (op1),= integer_zero_node); > + =A0 =A0 =A0 =A0 =A0 =A0 code =3D (code =3D=3D NE_EXPR ? EQ_EXPR : NE_EX= PR); So you change truthvalue !=3D/=3D=3D 1 to truthvalue =3D=3D/!=3D 0 and then recurse ... that doesn't make sense to me and is super-ugly. What's the testcase that made you add all this code? > + =A0 =A0 =A0 =A0 =A0 =A0 return combine_cond_expr_cond (loc, code, type,= op0, op1, > invariant_only); > + =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 if (TREE_CODE_CLASS (TREE_CODE (op0)) =3D=3D tcc_compar= ison > + =A0 =A0 =A0 =A0 =A0 =A0 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op= 0, 0)))) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 if (code =3D=3D NE_EXPR) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 t =3D op0; > + =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 code =3D invert_tree_comparison (TREE_C= ODE (op0), false); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (code !=3D ERROR_MARK) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t =3D fold_build2_loc (loc, code, t= ype, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + =A0 =A0 =A0else > + =A0 =A0 =A0 =A0{ > + =A0 =A0 =A0 =A0 if (TREE_CODE_CLASS (TREE_CODE (op0)) =3D=3D tcc_compar= ison > + =A0 =A0 =A0 =A0 =A0 =A0 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op= 0, 0)))) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 enum tree_code opc =3D invert_tree_comparison (= TREE_CODE (op0), false); > + =A0 =A0 =A0 =A0 =A0 =A0 if (opc !=3D ERROR_MARK) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 op0 =3D fold_build2_loc (loc, opc, TREE= _TYPE (op0), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t =3D fold_build2_loc (loc, BIT_XOR_EXP= R, type, op0, op1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 else if (TREE_CODE_CLASS (TREE_CODE (op1)) =3D=3D tcc_c= omparison > + =A0 =A0 =A0 =A0 =A0 =A0 && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (op= 1, 0)))) > + =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 enum tree_code opc =3D invert_tree_comparison (= TREE_CODE (op1), false); > + =A0 =A0 =A0 =A0 =A0 =A0 if (opc !=3D ERROR_MARK) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 op1 =3D fold_build2_loc (loc, opc, TREE= _TYPE (op1), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0TREE_OPERAND (op1, 0), TREE_OPERAND (op1, 1)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t =3D fold_build2_loc (loc, BIT_XOR_EXP= R, type, op0, op1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + =A0 =A0} > =A0 if (!t) > =A0 =A0 return NULL_TREE; > - > =A0 /* Require that we got a boolean type out if we put one in. =A0*/ > =A0 gcc_assert (TREE_CODE (TREE_TYPE (t)) =3D=3D TREE_CODE (type)); > > @@ -1122,13 +1174,11 @@ forward_propagate_comparison (gimple stm > =A0 if (!use_stmt) > =A0 =A0 return false; > > - =A0/* Conversion of the condition result to another integral type. =A0*/ > + =A0/* Test of the condition result. =A0*/ > =A0 if (is_gimple_assign (use_stmt) > - =A0 =A0 =A0&& (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (use_stmt)) > - =A0 =A0 =A0 =A0 || TREE_CODE_CLASS (gimple_assign_rhs_code (use_stmt)) > - =A0 =A0 =A0 =A0 =A0 =A0=3D=3D tcc_comparison > - =A0 =A0 =A0 =A0 =A0|| gimple_assign_rhs_code (use_stmt) =3D=3D TRUTH_NO= T_EXPR) > - =A0 =A0 =A0&& INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (use_stmt))= )) > + =A0 =A0 =A0&& ((TREE_CODE_CLASS (gimple_assign_rhs_code (use_stmt)) > + =A0 =A0 =A0 =A0 =A0=3D=3D tcc_comparison) > + =A0 =A0 =A0 =A0 =A0|| gimple_assign_rhs_code (use_stmt) =3D=3D TRUTH_NO= T_EXPR)) > =A0 =A0 { > =A0 =A0 =A0 tree lhs =3D gimple_assign_lhs (use_stmt); > > Index: gcc-head/gcc/testsuite/gcc.dg/binop-xor1.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/binop-xor1.c > +++ gcc-head/gcc/testsuite/gcc.dg/binop-xor1.c > @@ -7,8 +7,5 @@ foo (int a, int b, int c) > =A0 return ((a && !b && c) || (!a && b && c)); > =A0} > > -/* We expect to see ""; confirm that, so that we know to count > - =A0 it in the real test. =A0*/ > -/* { dg-final { scan-tree-dump-times "\]*>" 5 "optimized" } } */ > -/* { dg-final { scan-tree-dump-times "\\\^" 1 "optimized" } } */ > +/* { dg-final { scan-tree-dump-times "\\\^" 1 "optimized" { xfail > *-*-* } } } */ > =A0/* { dg-final { cleanup-tree-dump "optimized" } } */ > Index: gcc-head/gcc/testsuite/gcc.dg/binop-xor3.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/binop-xor3.c > +++ gcc-head/gcc/testsuite/gcc.dg/binop-xor3.c > @@ -7,8 +7,5 @@ foo (int a, int b) > =A0 return ((a && !b) || (!a && b)); > =A0} > > -/* We expect to see ""; confirm that, so that we know to count > - =A0 it in the real test. =A0*/ > -/* { dg-final { scan-tree-dump-times "\]*>" 1 "optimized" } } */ > -/* { dg-final { scan-tree-dump-times "\\\^" 1 "optimized" } } */ > +/* { dg-final { scan-tree-dump-times "\\\^" 1 "optimized" { xfail > *-*-* } } } */ > =A0/* { dg-final { cleanup-tree-dump "optimized" } } */ > Index: gcc-head/gcc/testsuite/gcc.dg/uninit-15.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc-head.orig/gcc/testsuite/gcc.dg/uninit-15.c > +++ gcc-head/gcc/testsuite/gcc.dg/uninit-15.c > @@ -18,9 +18,9 @@ foo (int i) > =A0void baz (void); > > =A0void > -bar (void) > +bar (void) /* { dg-warning "'j' is used uninitialized" } */ > =A0{ > =A0 int j; /* { dg-message "note: 'j' was declared here" "" { xfail *-*-*= } } */ > - =A0for (; foo (j); ++j) =A0/* { dg-warning "'j' is used uninitialized" = } */ > + =A0for (; foo (j); ++j) > =A0 =A0 baz (); > =A0} >