From patchwork Thu May 19 06:54:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Revital Eres X-Patchwork-Id: 1527 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:52:46 -0000 Delivered-To: patches@linaro.org Received: by 10.224.54.134 with SMTP id q6cs103175qag; Wed, 18 May 2011 23:54:38 -0700 (PDT) Received: by 10.14.50.7 with SMTP id y7mr1027486eeb.83.1305788078040; Wed, 18 May 2011 23:54:38 -0700 (PDT) Received: from mail-ew0-f50.google.com (mail-ew0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id 10si5812774een.74.2011.05.18.23.54.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 May 2011 23:54:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of revital.eres@linaro.org) client-ip=209.85.215.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of revital.eres@linaro.org) smtp.mail=revital.eres@linaro.org Received: by ewy10 with SMTP id 10so781933ewy.37 for ; Wed, 18 May 2011 23:54:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.29.142 with SMTP id q14mr566600ebc.129.1305788075983; Wed, 18 May 2011 23:54:35 -0700 (PDT) Received: by 10.213.98.72 with HTTP; Wed, 18 May 2011 23:54:35 -0700 (PDT) Date: Thu, 19 May 2011 09:54:35 +0300 Message-ID: Subject: [PATCH, SMS] Fix calculation of issue_rate From: Revital Eres To: Ayal Zaks Cc: gcc-patches@gcc.gnu.org, Patch Tracking Hello, The issue rate is currently been set in SMS by calling targetm.sched.issue_rate function if it is defined. For rs6000 the issue_rate is 1 if !reload_completed && !flag_sched_pressure. To bypass that, SMS sets reload_completed to 1 before calling targetm.sched.issue_rate and restores it's original value after the call. The problem is that the issue rate is changed again to 1 because of the following chain of calls which occurs right after setting issue_rate in targetm.sched.issue_rate (): sms_schedule -> haifa_sched_init -> sched_init () -> targetm.sched.issue_rate () (in haifa-sched.c:3474) This time, when calling targetm.sched.issue_rate the issue_rate is set to 1 as reload_completed contains it's original value (zero). The attached patch tries to fix that. Tested (bootstrap and regtest) on ppc64-redhat-linux. OK for mainline? Thanks, Revital Changelog: * modulo-sched.c (sms_schedule): Fix stage_count calculation. Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 173786) +++ modulo-sched.c (working copy) @@ -924,6 +924,7 @@ sms_schedule (void) basic_block condition_bb = NULL; edge latch_edge; gcov_type trip_count = 0; + int temp; loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_RECORDED_EXITS); @@ -933,22 +934,19 @@ sms_schedule (void) return; /* There are no loops to schedule. */ } + temp = reload_completed; + reload_completed = 1; /* Initialize issue_rate. */ if (targetm.sched.issue_rate) - { - int temp = reload_completed; - - reload_completed = 1; - issue_rate = targetm.sched.issue_rate (); - reload_completed = temp; - } + issue_rate = targetm.sched.issue_rate (); else issue_rate = 1; - + /* Initialize the scheduler. */ setup_sched_infos (); haifa_sched_init (); - + reload_completed = temp; + /* Allocate memory to hold the DDG array one entry for each loop. We use loop->num as index into this array. */ g_arr = XCNEWVEC (ddg_ptr, number_of_loops ());