From patchwork Thu Jun 30 12:00:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razya Ladelsky X-Patchwork-Id: 102748 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 453A3B6F54 for ; Thu, 30 Jun 2011 22:00:57 +1000 (EST) Received: (qmail 15152 invoked by alias); 30 Jun 2011 12:00:52 -0000 Received: (qmail 15144 invoked by uid 22791); 30 Jun 2011 12:00:51 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, SUBJ_ALL_CAPS, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate4.uk.ibm.com (HELO mtagate4.uk.ibm.com) (194.196.100.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Jun 2011 12:00:36 +0000 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p5UC0YFF002893 for ; Thu, 30 Jun 2011 12:00:34 GMT Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p5UC0YeR2511074 for ; Thu, 30 Jun 2011 13:00:34 +0100 Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p5UC0Yo7009518 for ; Thu, 30 Jun 2011 06:00:34 -0600 Received: from d12mc102.megacenter.de.ibm.com (d12mc102.megacenter.de.ibm.com [9.149.167.114]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p5UC0YEH009515; Thu, 30 Jun 2011 06:00:34 -0600 To: gcc-patches@gcc.gnu.org Cc: Zdenek Dvorak , Richard Guenther MIME-Version: 1.0 Subject: PATCH] PR 49580 X-KeepSent: 40F9874B:8CC4E239-C22578BF:003E7CE1; type=4; name=$KeepSent From: Razya Ladelsky Message-ID: Date: Thu, 30 Jun 2011 15:00:33 +0300 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 patch fixes the build failure of gcc spec2006 benchmark. The change is in gimple_duplicate_sese_tail(), where we need to subtract 1 from the loop's number of iterations. The stmt created to change the rhs of the loop's condition, used to be inserted right after the defining stmt of the rhs (an ssa name). This requires special handling of different cases of the defining stmt: 1.gimple_stmt 2.gimple_phi 3.default_def Instead of handling each case separately, if we insert the new stmt at the begining of the loop's preheader, we're sure that it's already been defined. Bootstrap and testsuite pass successfully (as autopar is not enabled by default). No new regressions when the testsuite is run with autopar enabled. No new regressions for the run of spec2006 with autopar enabled, and gcc benchmark now passes successfully.. OK for trunk? Thanks, Razya = 22-12-2009 Razya Ladelsky * tree-cfg.c (gimple_duplicate_sese_tail): Insert the stmt caclculating the new rhs of the loop's condition stmt to the preheader instead of iters_bb. = Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 174166) +++ gcc/tree-cfg.c (working copy) @@ -5401,7 +5401,6 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_U gimple cond_stmt; edge sorig, snew; basic_block exit_bb; - basic_block iters_bb; tree new_rhs; gimple_stmt_iterator psi; gimple phi; @@ -5501,11 +5500,10 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_U if (TREE_CODE (gimple_cond_rhs (cond_stmt)) == SSA_NAME) { - iters_bb = gimple_bb (SSA_NAME_DEF_STMT (gimple_cond_rhs (cond_stmt))); - for (gsi1 = gsi_start_bb (iters_bb); !gsi_end_p (gsi1); gsi_next (&gsi1)) - if (gsi_stmt (gsi1) == SSA_NAME_DEF_STMT (gimple_cond_rhs (cond_stmt))) - break; + basic_block preheader; + preheader = loop_preheader_edge(orig_loop)->src; + gsi1 = gsi_after_labels (preheader); new_rhs = force_gimple_operand_gsi (&gsi1, new_rhs, true, NULL_TREE,false,GSI_CONTINUE_LINKING); }