From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18783 invoked by alias); 20 Jul 2011 13:32:04 -0000 Received: (qmail 18768 invoked by uid 22791); 20 Jul 2011 13:32:03 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 13:31:29 +0000 Received: by qwh5 with SMTP id 5so122610qwh.20 for ; Wed, 20 Jul 2011 06:31:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.89.142 with SMTP id e14mr2310035qcm.230.1311168688064; Wed, 20 Jul 2011 06:31:28 -0700 (PDT) Received: by 10.229.38.195 with HTTP; Wed, 20 Jul 2011 06:31:27 -0700 (PDT) In-Reply-To: References: Date: Wed, 20 Jul 2011 14:07:00 -0000 Message-ID: Subject: Re: [patch tree-optimization]: [2 of 3]: Boolify compares & more From: Kai Tietz To: Richard Guenther 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/msg01625.txt.bz2 2011/7/20 Richard Guenther : > On Wed, Jul 20, 2011 at 3:05 PM, Kai Tietz wrot= e: >> Hello, >> >> this is the revised version of the partial pre-approved patch for preser= ving >> type-casts from/to boolean-types. =A0It fixes additionally the regressio= n in >> tree-ssa/builtin-expect-5.c testcase, which was caused by fold_builtin_e= xpect. >> Additionally there was a regression in gcc.dg/pr28685-1.c, which is fixe= d by >> the change in tree-ssa-forwprop.c's function simplify_bitwise_binary. = =A0This >> is just temporary necessary. =A0As soon as we are boolifying comparisons= in >> gimplifier, the pattern-matching in tree-ssa-reassoc will match for 2 >> branched cases >> again and we can remove the hunk from forward-propagation again. > > Hm, if we can't apply this pieces without regressions we shouldn't. =A0Th= ey > can then wait for the boolification patch. > > Can you explain the fold_builtin_expect change? =A0I'm lost in the maze > of inner/inner_arg0/arg0 renaming game. =A0It looks as if the patch only > moves stuff - but that can't possibly be the case. =A0So, what's going on > there? Well, the issue is here that fold_builtin_expect checks here for a comparison. If this comparison was created initially with a boolean-type, the cast to 'long' will be in tree arg0 =3D (long) CMP-with-boolean-type, as we are preserving here casts from boolean-types (see the fold-const change). So we need to see through this casts to match the compare and call cases. So I moved this "see through" part before first pattern-match and introduced here a helper-variable inner_arg0 to avoid double while-loop. The "inner" variable might get invalid ... if (COMPARISON_CLASS_P (inner) && TREE_CODE (TREE_OPERAND (inner, 1)) =3D=3D INTEGER_CST) inner =3D TREE_OPERAND (inner, 0); ... These are those "prefixed casts" you were asking in the other patch about. Regards, Kai