From patchwork Thu Jul 9 16:30:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 493490 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AD8C314027C for ; Fri, 10 Jul 2015 02:30:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BBWHI6U+; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=hbgd3LpQyLw5 2hd1tZM1nX/d5kgJfdecqiSDHD9eZzcksLOgmpCDEMjTrejmLrYTvzWoT9iQz3dE UgL6IHJtHFbOLxgs6S8thtjTcSzN8KloE/JTn1f1QFbiK9GWQJ6+wUBH+Ys8R+CW F3/YDiBdLI4fsIzPJkKWIU63t4kCgiE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=qg5NU0qU1EHgzw4qCQ oJQz0m+EU=; b=BBWHI6U+GGxdwHRoKAZyy9H7Q91xT48gWrihTccV4NvMXPsoQ+ c7wlys4sNCCYK+0idkgYB4y6RdN4fzbjv8lAhxfsT43ywxkg4KKEiIjqS1c748Bk heJchDR9R9PHB0RY+e+qOhr9ibLmCX/EnvJCofHZeanoe8yhbignfICNk= Received: (qmail 122122 invoked by alias); 9 Jul 2015 16:30:47 -0000 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 Received: (qmail 122113 invoked by uid 89); 9 Jul 2015 16:30:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_40, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 09 Jul 2015 16:30:44 +0000 Received: by wifm2 with SMTP id m2so23824235wif.1 for ; Thu, 09 Jul 2015 09:30:41 -0700 (PDT) X-Received: by 10.180.37.133 with SMTP id y5mr75303540wij.7.1436459441765; Thu, 09 Jul 2015 09:30:41 -0700 (PDT) Received: from s42.loc (91-119-213-131.dynamic.xdsl-line.inode.at. [91.119.213.131]) by smtp.gmail.com with ESMTPSA id lz10sm9577055wjb.48.2015.07.09.09.30.40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 Jul 2015 09:30:40 -0700 (PDT) Received: from cow by s42.loc with local (Exim 4.80) (envelope-from ) id 1ZDEid-0003nW-P7; Thu, 09 Jul 2015 18:30:39 +0200 From: Bernhard Reutner-Fischer To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer , Daniel Berlin , Tobias Grosser , Sebastian Pop Subject: [PATCH] Remove duplicate graphite statistics printers Date: Thu, 9 Jul 2015 18:30:31 +0200 Message-Id: <1436459431-14567-1-git-send-email-rep.dot.nop@gmail.com> X-IsSubscribed: yes graphite-scop-detection.c contained a copy of graphite.c print_graphite_statistics() and print_graphite_scop_statistics(). The latter gained a parameter to distinguish \nBefore limit_scops SCoP statistics ( from \nSCoP statistics ( Note that previously the version in gimple.c was never called (AFAICT) probably due to ICF or the like. Note that previously the 2 functions where different due to using different strings so i'd have expected some clever trick iff it really was ICF who substituted them. But that'd be another bug or feature-request, maybe. With the patch below a sample dump thus has the following diff: @@ -541,35 +541,35 @@ fix_loop_structure: fixing up loops for Before limit_scops SCoP statistics (BBS:1, LOOPS:0, CONDITIONS:0, STMTS:0) -Before limit_scops SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0) +SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0) Before limit_scops SCoP statistics (BBS:1, LOOPS:0, CONDITIONS:0, STMTS:0) -Before limit_scops SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0) +SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0) which looks plausible to me since the stats are dumped once before limit_scops() and once afterwards and now this is reflected in the dumps. Ok for trunk if bootstrap+regtest pass? Thanks, gcc/ChangeLog 2015-07-09 Bernhard Reutner-Fischer * graphite.h: New file. (print_graphite_statistics): Extern declaration. * graphite-scop-detection.c (print_graphite_scop_statistics, print_graphite_statistics): Remove. * graphite.c (print_graphite_statistics): Make public and add PREFIX parameter. Adjust callers. (print_graphite_scop_statistics): Add PREFIX parameter. Signed-off-by: Bernhard Reutner-Fischer --- gcc/graphite-scop-detection.c | 74 ++----------------------------------------- gcc/graphite.c | 18 +++++++---- gcc/graphite.h | 27 ++++++++++++++++ 3 files changed, 40 insertions(+), 79 deletions(-) create mode 100644 gcc/graphite.h diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index dac8eeb..2c1cc36 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_isl #include "graphite-poly.h" +#include "graphite.h" #include "graphite-scop-detection.h" /* Forward declarations. */ @@ -1124,77 +1125,6 @@ contains_only_close_phi_nodes (basic_block bb) return true; } -/* Print statistics for SCOP to FILE. */ - -static void -print_graphite_scop_statistics (FILE* file, scop_p scop) -{ - long n_bbs = 0; - long n_loops = 0; - long n_stmts = 0; - long n_conditions = 0; - long n_p_bbs = 0; - long n_p_loops = 0; - long n_p_stmts = 0; - long n_p_conditions = 0; - - basic_block bb; - - FOR_ALL_BB_FN (bb, cfun) - { - gimple_stmt_iterator psi; - loop_p loop = bb->loop_father; - - if (!bb_in_sese_p (bb, SCOP_REGION (scop))) - continue; - - n_bbs++; - n_p_bbs += bb->count; - - if (EDGE_COUNT (bb->succs) > 1) - { - n_conditions++; - n_p_conditions += bb->count; - } - - for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi)) - { - n_stmts++; - n_p_stmts += bb->count; - } - - if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop))) - { - n_loops++; - n_p_loops += bb->count; - } - - } - - fprintf (file, "\nBefore limit_scops SCoP statistics ("); - fprintf (file, "BBS:%ld, ", n_bbs); - fprintf (file, "LOOPS:%ld, ", n_loops); - fprintf (file, "CONDITIONS:%ld, ", n_conditions); - fprintf (file, "STMTS:%ld)\n", n_stmts); - fprintf (file, "\nBefore limit_scops SCoP profiling statistics ("); - fprintf (file, "BBS:%ld, ", n_p_bbs); - fprintf (file, "LOOPS:%ld, ", n_p_loops); - fprintf (file, "CONDITIONS:%ld, ", n_p_conditions); - fprintf (file, "STMTS:%ld)\n", n_p_stmts); -} - -/* Print statistics for SCOPS to FILE. */ - -static void -print_graphite_statistics (FILE* file, vec scops) -{ - int i; - scop_p scop; - - FOR_EACH_VEC_ELT (scops, i, scop) - print_graphite_scop_statistics (file, scop); -} - /* We limit all SCoPs to SCoPs, that are completely surrounded by a loop. Example: @@ -1440,7 +1370,7 @@ build_scops (vec *scops) build_graphite_scops (regions, scops); if (dump_file && (dump_flags & TDF_DETAILS)) - print_graphite_statistics (dump_file, *scops); + print_graphite_statistics (dump_file, "Before limit_scops ", *scops); limit_scops (scops); regions.release (); diff --git a/gcc/graphite.c b/gcc/graphite.c index ba8029a..820491a 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_isl #include "graphite-poly.h" +#include "graphite.h" #include "graphite-scop-detection.h" #include "graphite-isl-ast-to-gimple.h" #include "graphite-sese-to-poly.h" @@ -140,7 +141,7 @@ print_global_statistics (FILE* file) /* Print statistics for SCOP to FILE. */ static void -print_graphite_scop_statistics (FILE* file, scop_p scop) +print_graphite_scop_statistics (FILE* file, const char *prefix, scop_p scop) { long n_bbs = 0; long n_loops = 0; @@ -153,6 +154,9 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) basic_block bb; + if (prefix == NULL) + prefix = ""; + FOR_ALL_BB_FN (bb, cfun) { gimple_stmt_iterator psi; @@ -183,7 +187,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) } } - fprintf (file, "\nSCoP statistics ("); + fprintf (file, "\n%sSCoP statistics (", prefix); fprintf (file, "BBS:%ld, ", n_bbs); fprintf (file, "LOOPS:%ld, ", n_loops); fprintf (file, "CONDITIONS:%ld, ", n_conditions); @@ -195,17 +199,17 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) fprintf (file, "STMTS:%ld)\n", n_p_stmts); } -/* Print statistics for SCOPS to FILE. */ +/* Print statistics for SCOPS to FILE. Prefix statistic headers with PREFIX. */ -static void -print_graphite_statistics (FILE* file, vec scops) +void +print_graphite_statistics (FILE* file, const char *prefix, vec scops) { int i; scop_p scop; FOR_EACH_VEC_ELT (scops, i, scop) - print_graphite_scop_statistics (file, scop); + print_graphite_scop_statistics (file, prefix, scop); } /* Initialize graphite: when there are no loops returns false. */ @@ -286,7 +290,7 @@ graphite_transform_loops (void) if (dump_file && (dump_flags & TDF_DETAILS)) { - print_graphite_statistics (dump_file, scops); + print_graphite_statistics (dump_file, NULL, scops); print_global_statistics (dump_file); } diff --git a/gcc/graphite.h b/gcc/graphite.h new file mode 100644 index 0000000..08330b3 --- /dev/null +++ b/gcc/graphite.h @@ -0,0 +1,27 @@ +/* Gimple Represented as Polyhedra. + Copyright (C) 2006-2015 Free Software Foundation, Inc. + Contributed by Sebastian Pop and + Tobias Grosser . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GRAPHITE_H +#define GCC_GRAPHITE_H + +extern void print_graphite_statistics (FILE*, const char*, vec); + +#endif /* GCC_GRAPHITE_H */