From patchwork Fri Oct 13 10:39:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 825386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464117-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="c5q8k28y"; dkim-atps=neutral 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 3yD43Y0vS8z9sNr for ; Fri, 13 Oct 2017 21:39:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=UnPPD9jXag17ho0nuh1bTzQ1Dlat4h5Yo/JCCpSbBpsoNbMR9rFNJ bF5PcLaGl5dcKIF6gK9unDYn//G3WB9xcYgGi0Yn41MhHZaXUPZMgvy+pUWi1a32 5vFIOAtDqitA+tVoaJi6S3oY71Kexc6IeC/uDLW3rgyQxkP1A36CAQ= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=QC81qiU8UCvwus1mzOWP5U3Feio=; b=c5q8k28y7D90MOa3sMH8 e4H8klKrCHT4x991Yyr0l5o3MAIf41ZrjyrE8ZHFzor9YUQ3fdkjB11Bfdib5zvW SH1sZqqjxVeKEUcEeuG8lMLDeCtn8RAV48GGkWfkcUV/0cHRP0213JB68ocT/09i RzHfWnNZOJ4mm1K6ka2F/Ro= Received: (qmail 113976 invoked by alias); 13 Oct 2017 10:39:28 -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 113681 invoked by uid 89); 13 Oct 2017 10:39:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=enlarge X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Oct 2017 10:39:25 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B19E7AAC8 for ; Fri, 13 Oct 2017 10:39:21 +0000 (UTC) Date: Fri, 13 Oct 2017 12:39:21 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH][GRAPHITE] Some TLC Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Removing a global constructor, a return value that isn't checked and adjusting testcases that spew -Waggressive-loop-optimization warnings when built with different options. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2017-10-13 Richard Biener * graphite-isl-ast-to-gimple.c (max_mode_int_precision, graphite_expression_type_precision): Avoid global constructor by moving ... (translate_isl_ast_to_gimple::translate_isl_ast_to_gimple): Here. (translate_isl_ast_to_gimple::graphite_expr_type): Add type member. (translate_isl_ast_to_gimple::translate_isl_ast_node_for): Use it. (translate_isl_ast_to_gimple::build_iv_mapping): Likewise. (translate_isl_ast_to_gimple::graphite_create_new_guard): Likewise. * graphite-sese-to-poly.c (build_original_schedule): Return nothing. * gcc.dg/graphite/scop-10.c: Enlarge array to avoid undefined behavior. * gcc.dg/graphite/scop-7.c: Likewise. * gcc.dg/graphite/scop-8.c: Likewise. Index: gcc/graphite-isl-ast-to-gimple.c =================================================================== --- gcc/graphite-isl-ast-to-gimple.c (revision 253707) +++ gcc/graphite-isl-ast-to-gimple.c (working copy) @@ -58,15 +58,6 @@ along with GCC; see the file COPYING3. #include "tree-ssa.h" #include "graphite.h" -/* We always try to use signed 128 bit types, but fall back to smaller types - in case a platform does not provide types of these sizes. In the future we - should use isl to derive the optimal type for each subexpression. */ - -static int max_mode_int_precision = - GET_MODE_PRECISION (int_mode_for_size (MAX_FIXED_MODE_SIZE, 0).require ()); -static int graphite_expression_type_precision = 128 <= max_mode_int_precision ? - 128 : max_mode_int_precision; - struct ast_build_info { ast_build_info() @@ -143,8 +134,7 @@ enum phi_node_kind class translate_isl_ast_to_gimple { public: - translate_isl_ast_to_gimple (sese_info_p r) - : region (r), codegen_error (false) { } + translate_isl_ast_to_gimple (sese_info_p r); edge translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node, edge next_e, ivs_params &ip); edge translate_isl_ast_node_for (loop_p context_loop, @@ -235,8 +225,24 @@ private: /* A vector of all the edges at if_condition merge points. */ auto_vec merge_points; + + tree graphite_expr_type; }; +translate_isl_ast_to_gimple::translate_isl_ast_to_gimple (sese_info_p r) + : region (r), codegen_error (false) +{ + /* We always try to use signed 128 bit types, but fall back to smaller types + in case a platform does not provide types of these sizes. In the future we + should use isl to derive the optimal type for each subexpression. */ + int max_mode_int_precision + = GET_MODE_PRECISION (int_mode_for_size (MAX_FIXED_MODE_SIZE, 0).require ()); + int graphite_expr_type_precision + = 128 <= max_mode_int_precision ? 128 : max_mode_int_precision; + graphite_expr_type + = build_nonstandard_integer_type (graphite_expr_type_precision, 0); +} + /* Return the tree variable that corresponds to the given isl ast identifier expression (an isl_ast_expr of type isl_ast_expr_id). @@ -702,8 +708,7 @@ translate_isl_ast_node_for (loop_p conte edge next_e, ivs_params &ip) { gcc_assert (isl_ast_node_get_type (node) == isl_ast_node_for); - tree type - = build_nonstandard_integer_type (graphite_expression_type_precision, 0); + tree type = graphite_expr_type; isl_ast_expr *for_init = isl_ast_node_for_get_init (node); tree lb = gcc_expression_from_isl_expression (type, for_init, ip); @@ -742,8 +747,7 @@ build_iv_mapping (vec iv_map, gimp for (i = 1; i < isl_ast_expr_get_op_n_arg (user_expr); i++) { arg_expr = isl_ast_expr_get_op_arg (user_expr, i); - tree type = - build_nonstandard_integer_type (graphite_expression_type_precision, 0); + tree type = graphite_expr_type; tree t = gcc_expression_from_isl_expression (type, arg_expr, ip); /* To fail code generation, we generate wrong code until we discard it. */ @@ -841,8 +845,7 @@ edge translate_isl_ast_to_gimple:: graphite_create_new_guard (edge entry_edge, __isl_take isl_ast_expr *if_cond, ivs_params &ip) { - tree type = - build_nonstandard_integer_type (graphite_expression_type_precision, 0); + tree type = graphite_expr_type; tree cond_expr = gcc_expression_from_isl_expression (type, if_cond, ip); /* To fail code generation, we generate wrong code until we discard it. */ Index: gcc/graphite-sese-to-poly.c =================================================================== --- gcc/graphite-sese-to-poly.c (revision 253707) +++ gcc/graphite-sese-to-poly.c (working copy) @@ -1194,7 +1194,7 @@ build_schedule_loop_nest (scop_p scop, i /* Build the schedule of the SCOP. */ -static bool +static void build_original_schedule (scop_p scop) { int i = 0; @@ -1216,9 +1216,6 @@ build_original_schedule (scop_p scop) fprintf (dump_file, "[sese-to-poly] original schedule:\n"); print_isl_schedule (dump_file, scop->original_schedule); } - if (!scop->original_schedule) - return false; - return true; } /* Builds the polyhedral representation for a SESE region. */ Index: gcc/testsuite/gcc.dg/graphite/scop-10.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/scop-10.c (revision 253707) +++ gcc/testsuite/gcc.dg/graphite/scop-10.c (working copy) @@ -4,7 +4,7 @@ int toto() { int i, j, k; int a[100][100]; - int b[100]; + int b[200]; for (i = 1; i < 100; i++) { Index: gcc/testsuite/gcc.dg/graphite/scop-7.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/scop-7.c (revision 253707) +++ gcc/testsuite/gcc.dg/graphite/scop-7.c (working copy) @@ -4,7 +4,7 @@ int toto() { int i, j, k; int a[100][100]; - int b[100]; + int b[200]; for (i = 1; i < 100; i++) { Index: gcc/testsuite/gcc.dg/graphite/scop-8.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/scop-8.c (revision 253707) +++ gcc/testsuite/gcc.dg/graphite/scop-8.c (working copy) @@ -4,7 +4,7 @@ int toto() { int i, j, k; int a[100][100]; - int b[100]; + int b[200]; for (i = 1; i < 100; i++) {