From patchwork Mon Sep 12 11:41:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Revital Eres X-Patchwork-Id: 4023 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 971E523EF7 for ; Mon, 12 Sep 2011 11:41:36 +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 79DC6A18178 for ; Mon, 12 Sep 2011 11:41:36 +0000 (UTC) Received: by fxe23 with SMTP id 23so1661316fxe.11 for ; Mon, 12 Sep 2011 04:41:36 -0700 (PDT) Received: by 10.223.74.89 with SMTP id t25mr218942faj.65.1315827696070; Mon, 12 Sep 2011 04:41:36 -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.11.8 with SMTP id m8cs99523lab; Mon, 12 Sep 2011 04:41:35 -0700 (PDT) Received: by 10.101.136.4 with SMTP id o4mr2621763ann.157.1315827694534; Mon, 12 Sep 2011 04:41:34 -0700 (PDT) Received: from mail-yx0-f178.google.com (mail-yx0-f178.google.com [209.85.213.178]) by mx.google.com with ESMTPS id s36si7396219anh.206.2011.09.12.04.41.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Sep 2011 04:41:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.213.178 is neither permitted nor denied by best guess record for domain of revital.eres@linaro.org) client-ip=209.85.213.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.213.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 yxj19 with SMTP id 19so45727yxj.37 for ; Mon, 12 Sep 2011 04:41:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.3.40 with SMTP id f40mr3852569ani.89.1315827693849; Mon, 12 Sep 2011 04:41:33 -0700 (PDT) Received: by 10.101.58.12 with HTTP; Mon, 12 Sep 2011 04:41:33 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Sep 2011 14:41:33 +0300 Message-ID: Subject: Re: [PATCH, SMS] Minor misc. fixes From: Revital Eres To: Ayal Zaks , Patch Tracking , gcc-patches@gcc.gnu.org Hello, > OK. > While we're at it, an alternative would be to have > remove_node_from_ps() assert its own (parameters and) return value. > That is, replace "if (c) return false" by "assert (!c)" and have it > return void if successful. There's not much you can do if it returns > false. That would check its other invocation too. OK, that's indeed seems reasonable. The attached patch implements it. Will commit it after re-testing completes if there is not objection. Thanks, Revital Changelog: modulo-sched.c (remove_node_from_ps): Return void instead of bool. (optimize_sc): Adjust call to remove_node_from_ps. (sms_schedule): Add print info. Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 178755) +++ modulo-sched.c (working copy) @@ -211,7 +211,7 @@ static int get_sched_window (partial_sch static bool try_scheduling_node_in_cycle (partial_schedule_ptr, ddg_node_ptr, int, int, sbitmap, int *, sbitmap, sbitmap); -static bool remove_node_from_ps (partial_schedule_ptr, ps_insn_ptr); +static void remove_node_from_ps (partial_schedule_ptr, ps_insn_ptr); #define SCHED_ASAP(x) (((node_sched_params_ptr)(x)->aux.info)->asap) #define SCHED_TIME(x) (((node_sched_params_ptr)(x)->aux.info)->time) @@ -834,8 +834,7 @@ optimize_sc (partial_schedule_ptr ps, dd if (next_ps_i->node->cuid == g->closing_branch->cuid) break; - gcc_assert (next_ps_i); - gcc_assert (remove_node_from_ps (ps, next_ps_i)); + remove_node_from_ps (ps, next_ps_i); success = try_scheduling_node_in_cycle (ps, g->closing_branch, g->closing_branch->cuid, c, @@ -1485,8 +1484,8 @@ sms_schedule (void) if (dump_file) { fprintf (dump_file, - "SMS succeeded %d %d (with ii, sc)\n", ps->ii, - stage_count); + "%s:%d SMS succeeded %d %d (with ii, sc)\n", + insn_file (tail), insn_line (tail), ps->ii, stage_count); print_partial_schedule (ps, dump_file); } @@ -2719,22 +2718,18 @@ create_ps_insn (ddg_node_ptr node, int c } -/* Removes the given PS_INSN from the partial schedule. Returns false if the - node is not found in the partial schedule, else returns true. */ -static bool +/* Removes the given PS_INSN from the partial schedule. */ +static void remove_node_from_ps (partial_schedule_ptr ps, ps_insn_ptr ps_i) { int row; - if (!ps || !ps_i) - return false; - + gcc_assert (ps && ps_i); + row = SMODULO (ps_i->cycle, ps->ii); if (! ps_i->prev_in_row) { - if (ps_i != ps->rows[row]) - return false; - + gcc_assert (ps_i == ps->rows[row]); ps->rows[row] = ps_i->next_in_row; if (ps->rows[row]) ps->rows[row]->prev_in_row = NULL; @@ -2748,7 +2743,7 @@ remove_node_from_ps (partial_schedule_pt ps->rows_length[row] -= 1; free (ps_i); - return true; + return; } /* Unlike what literature describes for modulo scheduling (which focuses