From patchwork Mon Mar 26 11:11:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razya Ladelsky X-Patchwork-Id: 148697 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 DDB10B6F9F for ; Mon, 26 Mar 2012 22:11:56 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1333365117; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:To:MIME-Version:Subject:From: Message-ID:Date:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=+RoXKu9doltrubEyj44tESvWQrU=; b=FmOAFTianzQbR7P L81ldYRV09GOgsW/0qziaDcXWoMEBAr4ZszXKegMO9TcGDUnXHiYwUm80v2f7jbI JbIF1ZpUjDp2fxTNbWWvZfJCBZBy3DFOvi0XNmMC/sSeUWtHR4iZo2MvaIPedKk1 kArGaXEDEhsEdo0x8g7iZ4N71XfI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:To:MIME-Version:Subject:X-KeepSent:From:Message-ID:Date:Content-Type:x-cbid:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=X+3P96/uvBl2lVAXacIiYbbyZ7h6ps8BHvO1V5cxMkIkuX2pqZ0H31MvGoNiwp vymwR45wFzsb8bEHnvteYhPPPKNIg3SeX9dYz6gzGUwZiqDxZ2vtdsD8KCZnPXVR bU+fsZLd98lvXKkFGvcXIWwaRS+xiJUxmxaKCH5ZYWMFw=; Received: (qmail 31241 invoked by alias); 26 Mar 2012 11:11:50 -0000 Received: (qmail 31229 invoked by uid 22791); 26 Mar 2012 11:11:49 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Mar 2012 11:11:35 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Mar 2012 12:11:33 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 26 Mar 2012 12:11:17 +0100 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2QBBGSW2539664 for ; Mon, 26 Mar 2012 12:11:16 +0100 Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2QBBGSD016480 for ; Mon, 26 Mar 2012 05:11:16 -0600 Received: from d06ml319.portsmouth.uk.ibm.com (d06ml319.portsmouth.uk.ibm.com [9.149.76.146]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q2QBBG6S016477; Mon, 26 Mar 2012 05:11:16 -0600 To: gcc-patches@gcc.gnu.org, Richard Guenther MIME-Version: 1.0 Subject: [PATCH] Permanent Fix for PR46886 X-KeepSent: 165878BB:FC5B37DD-C22579CD:003C03B9; type=4; name=$KeepSent From: Razya Ladelsky Message-ID: Date: Mon, 26 Mar 2012 13:11:08 +0200 x-cbid: 12032611-5024-0000-0000-00000214C3A4 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, This is (hopefully) a permanent fix to pr46886.c I removed the condition preventing parallelization of do_while loops, as it was blocking parallelizing important loops in spec-2006. The patch fixes the number of iterations for cases where the body could appear in the latch, as in pr46886.c. 2012-03-26 Razya Ladelsky PR tree-optimization/46886 * tree-parloops.c (transform_to_exit_first_loop):Set number of iterations correctly when the body may appear at the latch. (pallelize_loops): Remove the condition preventing do-while loops. Bootstrap and testsuite psss successfully on power7 linux machine. Ok to commit? Thanks, = Index: tree-parloops.c =================================================================== --- tree-parloops.c (revision 185775) +++ tree-parloops.c (working copy) @@ -1522,7 +1522,10 @@ transform_to_exit_first_loop (struct loop *loop, h the condition, moving the condition to the entry requires decrementing one iteration. */ exit_1 = EDGE_SUCC (exit->src, EDGE_SUCC (exit->src, 0) == exit); - if (exit_1->dest == loop->latch) + + /* if the latch contains more than the one statemnt of control variable + increment then it contains the body. */ + if (exit_1->dest == loop->latch && last_and_only_stmt (loop->latch)) new_rhs = gimple_cond_rhs (cond_stmt); else { @@ -2146,7 +2149,6 @@ parallelize_loops (void) return false; if (cfun->has_nonlocal_label) return false; - gcc_obstack_init (&parloop_obstack); reduction_list = htab_create (10, reduction_info_hash, reduction_info_eq, free); @@ -2187,10 +2189,7 @@ parallelize_loops (void) || loop_has_blocks_with_irreducible_flag (loop) || (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP) /* FIXME: the check for vector phi nodes could be removed. */ - || loop_has_vector_phi_nodes (loop) - /* FIXME: transform_to_exit_first_loop does not handle not - header-copied loops correctly - see PR46886. */ - || !do_while_loop_p (loop)) + || loop_has_vector_phi_nodes (loop)) continue; estimated = max_stmt_executions_int (loop, false); /* FIXME: Bypass this check as graphite doesn't update the @@ -2213,6 +2212,7 @@ parallelize_loops (void) continue; changed = true; + if (dump_file && (dump_flags & TDF_DETAILS)) { if (loop->inner)