From patchwork Thu Oct 27 14:47: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: 4862 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2508023DEE for ; Thu, 27 Oct 2011 14:47:43 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 05892A184B5 for ; Thu, 27 Oct 2011 14:47:43 +0000 (UTC) Received: by faan26 with SMTP id n26so3955700faa.11 for ; Thu, 27 Oct 2011 07:47:42 -0700 (PDT) Received: by 10.223.76.201 with SMTP id d9mr67271547fak.12.1319726862663; Thu, 27 Oct 2011 07:47:42 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs47740lak; Thu, 27 Oct 2011 07:47:42 -0700 (PDT) Received: by 10.224.76.209 with SMTP id d17mr29832534qak.87.1319726856360; Thu, 27 Oct 2011 07:47:36 -0700 (PDT) Received: from mail-qy0-f178.google.com (mail-qy0-f178.google.com [209.85.216.178]) by mx.google.com with ESMTPS id z1si1251588qcw.90.2011.10.27.07.47.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Oct 2011 07:47:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of revital.eres@linaro.org) client-ip=209.85.216.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.178 is neither permitted nor denied by best guess record for domain of revital.eres@linaro.org) smtp.mail=revital.eres@linaro.org Received: by qyg36 with SMTP id 36so3669744qyg.16 for ; Thu, 27 Oct 2011 07:47:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.51.137 with SMTP id d9mr7688757qcg.61.1319726855776; Thu, 27 Oct 2011 07:47:35 -0700 (PDT) Received: by 10.229.246.20 with HTTP; Thu, 27 Oct 2011 07:47:35 -0700 (PDT) Date: Thu, 27 Oct 2011 16:47:35 +0200 Message-ID: Subject: [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE From: Revital Eres To: gcc-patches@gcc.gnu.org Cc: Ayal Zaks , Patch Tracking Hello, The attach patch fixes the current marking of SMS loops to prevent further scheduling as follows: it marks *all* the loop's bbs with BB_DISABLE_SCHEDULE which prevents them from been scheduled later. (with the current implementation if the loop has non empty latch then it will be considered for scheduling based on sched_is_disabled_for_current_region_p () in in sched-rgn.c). It also marks the epilogue and prologue as BB_DISABLE_SCHEDULE which was shown in my experiments as a good influence on performance as scheduling those regions after SMS increased register pressure in some cases. Tested and bootstrap on all languages except java (PR50879) on ppc64-redhat-linux, enabling SMS on loops with SC 1. OK for mainline? Thanks, Revital Changelog: * modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog as BB_DISABLE_SCHEDULE. (mark_loop_unsched): New function. (sms_schedule): Call it. Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 180557) +++ modulo-sched.c (working copy) @@ -1173,6 +1173,7 @@ generate_prolog_epilog (partial_schedule /* Put the prolog on the entry edge. */ e = loop_preheader_edge (loop); split_edge_and_insert (e, get_insns ()); + e->dest->flags |= BB_DISABLE_SCHEDULE; end_sequence (); @@ -1186,9 +1187,23 @@ generate_prolog_epilog (partial_schedule gcc_assert (single_exit (loop)); e = single_exit (loop); split_edge_and_insert (e, get_insns ()); + e->dest->flags |= BB_DISABLE_SCHEDULE; + end_sequence (); } +/* Mark LOOP as software pipelined so the later + scheduling passes doesn't touch it. */ +static void +mark_loop_unsched (struct loop *loop) +{ + unsigned i; + basic_block *bbs = get_loop_body (loop); + + for (i = 0; i < loop->num_nodes; i++) + bbs[i]->flags |= BB_DISABLE_SCHEDULE; +} + /* Return true if all the BBs of the loop are empty except the loop header. */ static bool @@ -1716,7 +1731,8 @@ sms_schedule (void) /* Mark this loop as software pipelined so the later scheduling passes doesn't touch it. */ if (! flag_resched_modulo_sched) - g->bb->flags |= BB_DISABLE_SCHEDULE; + mark_loop_unsched (loop); + /* The life-info is not valid any more. */ df_set_bb_dirty (g->bb);