From patchwork Fri Oct 11 12:36:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1175136 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-510748-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hDeLu9il"; 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 46qSBt6HkDz9sP4 for ; Fri, 11 Oct 2019 23:37:08 +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:from :to:subject:date:message-id:content-type:mime-version; q=dns; s= default; b=R5a4IoyIhZRJVuPzDtgFNVsrHfhq/mwhK7uBb1WPF9PpmDkQDjRUh yIIQHz8s71XXFHFeTvHYOTGkLf0BmiGJETgx1+Olk5jZh4ZEAwTqyxqRGSr1ilM6 oS+Llv2vbqa9fNtI8QcWE+2YXXhxMCVyLQxQG3FUuINn3MNpJz0xwk= 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:subject:date:message-id:content-type:mime-version; s= default; bh=jwT/SYUaxqXwI6tBm0rxHxnDc4g=; b=hDeLu9ilEty7XZ8CSVMJ 7O5LUHSsF77OgjHp70z9SHGApvf/TqT03nQhWWhOwY4XK4lZEwkaNThORhJQy64Q LVDgdB2NTShQM1lNymg56Ae5OCtF84OlOkkzVEPWC/AQS6GBjjKnUtdesc5Wfdus hxckGWS4mljUY/pELRxpr94= Received: (qmail 21883 invoked by alias); 11 Oct 2019 12:37:00 -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 21864 invoked by uid 89); 11 Oct 2019 12:37:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=ok, sk:STMT_VI, GSI, sk:stmt_vi X-HELO: EUR02-VE1-obe.outbound.protection.outlook.com Received: from mail-oln040092069067.outbound.protection.outlook.com (HELO EUR02-VE1-obe.outbound.protection.outlook.com) (40.92.69.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2019 12:36:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WPr77Z0qRqEau04UsjR9btDz7FeIzzkPiA5vtQ/PYkJa7vV4di4orHZIVGDtTiOzS+PCiiitObGErCEL3mVZwcis6FfHkJA19tSop/4smlbsUB0cp5QnslJc1Z3kKZSd/Y5ujHPL/cj/V883DRB/faNmb9nkpCvjmFGvgQh2O9NaYnAcqXdArlkGXWu+/SwxKkQN3yUs3Wpb/dOusu6dlTgO/5ifMokVPm8XOUqni3FY46UGMcsXE6S3VHJHu+1dtrsrmgCVYH2r9U5q2ks4TqUK2y41AfxTmMPTVXjzst6/VqJZnW5wRxHzlY/opiou4362In1UTpazlqW9S73R0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zkDv6LPTXaATXorGfYr6pWoUWcu6djVAteA0Pd1Puqc=; b=c3B5IXDwQ3+JG8sTsQ9ydc9KUwFl+bZMS2NQbVkTCcTwUixZ4XbvQjo83Cbh4hCZXLzIFFQRLbNo1GLkMTtXzGYCRqs+3sJNHHUR18kT6gkcJxxBq6C1WKSfO5igpNZBTqwgPKIpiR71RyCBGdGES/aSU+LekudO41YFAPOBOdjwMt3xXSx55mVlz8R9FlYHiWhcdxkGugB1t0civeklF5kBuLSnMYn1J0zwwUTJ5z4WvhUgUrkyZYsODrePbk+dGuG+S1rV8NHas7FZDiHG1J2sLDPh8astxJen9N2NAvXqhBdaE81TJiEt8USFCPMHYIlNb3xRiknopRkioBwxqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AM5EUR02FT060.eop-EUR02.prod.protection.outlook.com (10.152.8.53) by AM5EUR02HT046.eop-EUR02.prod.protection.outlook.com (10.152.9.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 12:36:46 +0000 Received: from VI1PR03MB4528.eurprd03.prod.outlook.com (10.152.8.54) by AM5EUR02FT060.mail.protection.outlook.com (10.152.9.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Fri, 11 Oct 2019 12:36:46 +0000 Received: from VI1PR03MB4528.eurprd03.prod.outlook.com ([fe80::1917:2b45:72b0:548a]) by VI1PR03MB4528.eurprd03.prod.outlook.com ([fe80::1917:2b45:72b0:548a%7]) with mapi id 15.20.2347.016; Fri, 11 Oct 2019 12:36:46 +0000 From: Bernd Edlinger To: "gcc-patches@gcc.gnu.org" , Richard Biener Subject: [PATCH] Cleanup parameter of vectorizable_live_operation Date: Fri, 11 Oct 2019 12:36:46 +0000 Message-ID: x-microsoft-original-message-id: x-ms-exchange-transport-forked: True MIME-Version: 1.0 Hi Richard, I became aware of this while looking at the -Wshadow=compatible-local warnings. The function vectorizable_live_operation uses a parameter called "vec_stmt" that is shadowed by something also called "vec_stmt". But in this case, the vec_stmt actually only used as a boolean, i.e. pointer is NULL or not. This changes the parameter vec_stmt to vec_stmt_p, and propagates that change to can_vectorize_live_stmts. Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd. 2019-10-11 Bernd Edlinger * tree-vect-loop.c (vect_analyze_loop_operations): Adjust call to vectorizable_live_operation. (vectorizable_live_operation): Adjust parameters. * tree-vect-stmts.c (vect_init_vector, vect_gen_widened_results_half): Fix typo in function comment. (can_vectorize_live_stmts): Adjust function comment. Adjust parameters. Adjust call to vectorizable_live_operation. (vect_analyze_stmt): Adjust call to can_vectorize_live_stmts. (vect_transform_stmt): Adjust function comment. Adjust call to can_vectorize_live_stmts. * tree-vectorizer.h (vectorizable_live_operation): Adjust parameters. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 276843) +++ gcc/tree-vect-loop.c (working copy) @@ -1566,7 +1566,7 @@ vect_analyze_loop_operations (loop_vec_info loop_v && STMT_VINFO_LIVE_P (stmt_info) && !PURE_SLP_STMT (stmt_info)) ok = vectorizable_live_operation (stmt_info, NULL, NULL, NULL, - -1, NULL, &cost_vec); + -1, false, &cost_vec); if (!ok) return opt_result::failure_at (phi, @@ -7628,9 +7628,9 @@ vectorizable_induction (stmt_vec_info stmt_info, bool vectorizable_live_operation (stmt_vec_info stmt_info, - gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED, + gimple_stmt_iterator *gsi, slp_tree slp_node, slp_instance slp_node_instance, - int slp_index, stmt_vec_info *vec_stmt, + int slp_index, bool vec_stmt_p, stmt_vector_for_cost *) { loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); @@ -7652,7 +7652,7 @@ vectorizable_live_operation (stmt_vec_info stmt_in validity so just trigger the transform here. */ if (STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info))) { - if (!vec_stmt) + if (!vec_stmt_p) return true; if (slp_node) { @@ -7721,7 +7721,7 @@ vectorizable_live_operation (stmt_vec_info stmt_in } } - if (!vec_stmt) + if (!vec_stmt_p) { /* No transformation required. */ if (LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo)) Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 276843) +++ gcc/tree-vect-stmts.c (working copy) @@ -1449,7 +1449,7 @@ vect_init_vector_1 (stmt_vec_info stmt_vinfo, gimp Insert a new stmt (INIT_STMT) that initializes a new variable of type TYPE with the value VAL. If TYPE is a vector type and VAL does not have vector type a vector with all elements equal to VAL is created first. - Place the initialization at BSI if it is not NULL. Otherwise, place the + Place the initialization at GSI if it is not NULL. Otherwise, place the initialization at the loop preheader. Return the DEF of INIT_STMT. It will be used in the vectorization of STMT_INFO. */ @@ -4484,7 +4484,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_i Create a vector stmt whose code, type, number of arguments, and result variable are CODE, OP_TYPE, and VEC_DEST, and its arguments are - VEC_OPRND0 and VEC_OPRND1. The new vector stmt is to be inserted at BSI. + VEC_OPRND0 and VEC_OPRND1. The new vector stmt is to be inserted at GSI. In the case that CODE is a CALL_EXPR, this means that a call to DECL needs to be created (DECL is a function-decl of a target-builtin). STMT_INFO is the original scalar stmt that we are vectorizing. */ @@ -10474,12 +10474,12 @@ vectorizable_comparison (stmt_vec_info stmt_info, /* If SLP_NODE is nonnull, return true if vectorizable_live_operation can handle all live statements in the node. Otherwise return true if STMT_INFO is not live or if vectorizable_live_operation can handle it. - GSI and VEC_STMT are as for vectorizable_live_operation. */ + GSI and VEC_STMT_P are as for vectorizable_live_operation. */ static bool can_vectorize_live_stmts (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, slp_tree slp_node, slp_instance slp_node_instance, - stmt_vec_info *vec_stmt, + bool vec_stmt_p, stmt_vector_for_cost *cost_vec) { if (slp_node) @@ -10491,7 +10491,7 @@ can_vectorize_live_stmts (stmt_vec_info stmt_info, if (STMT_VINFO_LIVE_P (slp_stmt_info) && !vectorizable_live_operation (slp_stmt_info, gsi, slp_node, slp_node_instance, i, - vec_stmt, cost_vec)) + vec_stmt_p, cost_vec)) return false; } } @@ -10498,7 +10498,7 @@ can_vectorize_live_stmts (stmt_vec_info stmt_info, else if (STMT_VINFO_LIVE_P (stmt_info) && !vectorizable_live_operation (stmt_info, gsi, slp_node, slp_node_instance, -1, - vec_stmt, cost_vec)) + vec_stmt_p, cost_vec)) return false; return true; @@ -10712,7 +10712,7 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool * && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type && STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type && !can_vectorize_live_stmts (stmt_info, NULL, node, node_instance, - NULL, cost_vec)) + false, cost_vec)) return opt_result::failure_at (stmt_info->stmt, "not vectorized:" " live stmt not supported: %G", @@ -10724,7 +10724,7 @@ vect_analyze_stmt (stmt_vec_info stmt_info, bool * /* Function vect_transform_stmt. - Create a vectorized stmt to replace STMT_INFO, and insert it at BSI. */ + Create a vectorized stmt to replace STMT_INFO, and insert it at GSI. */ bool vect_transform_stmt (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, @@ -10945,7 +10945,7 @@ vect_transform_stmt (stmt_vec_info stmt_info, gimp /* Handle stmts whose DEF is used outside the loop-nest that is being vectorized. */ done = can_vectorize_live_stmts (stmt_info, gsi, slp_node, - slp_node_instance, &vec_stmt, NULL); + slp_node_instance, true, NULL); gcc_assert (done); return false; Index: gcc/tree-vectorizer.h =================================================================== --- gcc/tree-vectorizer.h (revision 276843) +++ gcc/tree-vectorizer.h (working copy) @@ -1653,8 +1653,7 @@ extern opt_loop_vec_info vect_analyze_loop_form (c vec_info_shared *); extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *, slp_tree, slp_instance, int, - stmt_vec_info *, - stmt_vector_for_cost *); + bool, stmt_vector_for_cost *); extern bool vectorizable_reduction (stmt_vec_info, slp_tree, slp_instance, stmt_vector_for_cost *); extern bool vectorizable_induction (stmt_vec_info, gimple_stmt_iterator *,