From patchwork Thu Oct 14 19:23:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 67854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 77C7A1007D3 for ; Fri, 15 Oct 2010 06:23:59 +1100 (EST) Received: (qmail 27366 invoked by alias); 14 Oct 2010 19:23:56 -0000 Received: (qmail 27358 invoked by uid 22791); 14 Oct 2010 19:23:56 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_FC, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Oct 2010 19:23:48 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9EJNle8020204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Oct 2010 15:23:47 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9EJNkvR009573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 14 Oct 2010 15:23:47 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id o9EJNk3k018160 for ; Thu, 14 Oct 2010 21:23:46 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id o9EJNjFf018159 for gcc-patches@gcc.gnu.org; Thu, 14 Oct 2010 21:23:45 +0200 Date: Thu, 14 Oct 2010 21:23:45 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Small fix for ifcvt Message-ID: <20101014192345.GA18103@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! If a _Bool SSA_NAME != boolean_false_node condition is fold_build2_loc'ed into the SSA_NAME itself, invert_truthvalue_loc for it is TRUTH_NOT_EXPR , which is not a valid condition, so add_to_dst_predicate_list forces it into queued stmts and then uses the new temporary as the condition. We end up then with D.12346_679 = !D.12345_678 and/or D.12347_680 = D.12345_678 || D.12346_679 useless statements in the basic block, which prevent further vectorization. By canonicalization of the condition to SSA_NAME == boolean_false_node we can avoid emitting those useless stmts. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2010-10-14 Jakub Jelinek PR tree-optimization/46008 * tree-if-conv.c (predicate_bbs): Try to canonicalize c2 if possible. Jakub --- gcc/tree-if-conv.c.jj 2010-09-06 08:42:00.000000000 +0200 +++ gcc/tree-if-conv.c 2010-10-13 17:49:58.000000000 +0200 @@ -915,7 +915,7 @@ predicate_bbs (loop_p loop) case GIMPLE_COND: { - tree c2; + tree c2, tem; edge true_edge, false_edge; location_t loc = gimple_location (stmt); tree c = fold_build2_loc (loc, gimple_cond_code (stmt), @@ -932,6 +932,9 @@ predicate_bbs (loop_p loop) /* If C is false, then FALSE_EDGE is taken. */ c2 = invert_truthvalue_loc (loc, unshare_expr (c)); + tem = canonicalize_cond_expr_cond (c2); + if (tem) + c2 = tem; add_to_dst_predicate_list (loop, false_edge, cond, c2); cond = NULL_TREE;