From patchwork Tue Apr 18 10:51:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Cheng X-Patchwork-Id: 751786 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 3w6hlH0b2hz9s3s for ; Tue, 18 Apr 2017 20:51:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pi//vTnn"; 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:content-type:mime-version; q=dns; s=default; b=B83b/VALR/SFUzNhZzMsez5oVnnrPVLOrATHwcnQzuJCiV8hOo EWQx+A4ecP+xX35M3a9jkuvbGKUfOHDdC5UgbkzZ3M3FUwJWq4llwVS7F25M4jH2 D6Ka4DpPD/GW8GmqsyqGWzdVnjYknDgk/GH7NxRF0/QZ1rnOX4V302qZc= 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:content-type:mime-version; s= default; bh=JivPjHSdoP9ltdm2TSlqnU/M210=; b=pi//vTnnrb7dflglYX93 bIfGlQbUvuhzKLtHlFeS9mHkKR0zcTFRqJDz3aJ3BDuGXTnbbPRIJZZRgD3nC5zj kIBHktGpH5OMHXn7UUwekIOq6K0jMRvoVZh9CYNFzAo4nLYOgQ3b51HyrppQZ+Ix 2sXkcYO+x98xuZM0Xkof6QQ= Received: (qmail 22734 invoked by alias); 18 Apr 2017 10:51:19 -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 22711 invoked by uid 89); 18 Apr 2017 10:51:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=2486, Hx-languages-length:3317, H*c:HHH X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00079.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Apr 2017 10:51:15 +0000 Received: from VI1PR0802MB2176.eurprd08.prod.outlook.com (10.172.12.21) by VI1PR0802MB2173.eurprd08.prod.outlook.com (10.172.12.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Tue, 18 Apr 2017 10:51:14 +0000 Received: from VI1PR0802MB2176.eurprd08.prod.outlook.com ([10.172.12.21]) by VI1PR0802MB2176.eurprd08.prod.outlook.com ([10.172.12.21]) with mapi id 15.01.1034.013; Tue, 18 Apr 2017 10:51:14 +0000 From: Bin Cheng To: "gcc-patches@gcc.gnu.org" CC: nd Subject: [PATCH GCC8][25/33]New loop constraint flags Date: Tue, 18 Apr 2017 10:51:14 +0000 Message-ID: authentication-results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=arm.com; x-microsoft-exchange-diagnostics: 1; VI1PR0802MB2173; 7:cd9YFBuEdKAvZb5pxkwikQJPBqMo0uJrcj1jWpRh6FiSTnhPytIp59OqGgk20wbdiHThIidYKq/AE0Iq1SzdZZy+z5xkGDMl/HEyi3Mo92fnLp4SosCikmDvKDCpwZGPNbNHBsKghnj/6QmYtJ7uv11cAF/ndzshkJDDlNZrfNRM4kHVqOugE/lwN4r0cb5jIPrERr7LS+GKYgaroypmR+6d7QaDPhYjENKWxkytdB88EQq7xHqKaqMGGRwbIlD9K50R5a30DE7NNXeKyTnVCpAOtQCoXP2/noHWYO11yse/eAm5YxfC4kScNowsZ8AJKU7NveA2kszKixo85EGQOA== x-ms-office365-filtering-correlation-id: 6849685e-da71-4a60-4ba3-08d48648d598 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081); SRVR:VI1PR0802MB2173; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(6072148); SRVR:VI1PR0802MB2173; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0802MB2173; x-forefront-prvs: 028166BF91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39450400003)(39840400002)(39860400002)(39400400002)(39850400002)(5640700003)(9686003)(2906002)(3846002)(33656002)(54356999)(3280700002)(305945005)(7736002)(50986999)(38730400002)(55016002)(6116002)(99286003)(102836003)(8936002)(81166006)(122556002)(66066001)(74316002)(86362001)(53936002)(4326008)(6436002)(110136004)(189998001)(99936001)(6506006)(8676002)(2351001)(3660700001)(25786009)(5660300001)(2900100001)(2501003)(6916009)(7696004)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2173; H:VI1PR0802MB2176.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2017 10:51:14.4076 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2173 X-IsSubscribed: yes Hi, This patch adds new loop constraint flags marking prologue, epilogue and versioned loops generated by vectorizer, unroller and versioning. These flags will be used in IVOPTs in order to differentiate possible hot innermost loop from others. I also plan to use them to avoid unnecessary cunroll on such loops. Is it OK? Thanks, bin 2017-04-11 Bin Cheng * cfgloop.h (LOOP_C_PROLOG, LOOP_C_EPILOG, LOOP_C_VERSION): New. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Set LOOP_C_EPILOG for unrolled epilogue loop. (vect_do_peeling): Set LOOP_C_PROLOG and LOOP_C_EPILOG for peeled loops. (vect_loop_versioning): Set LOOP_C_VERSION for versioned loop. From 432006f72b95826eadb4c972a55b1aeb89c9998b Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Thu, 30 Mar 2017 10:56:19 +0100 Subject: [PATCH 25/33] new-loop-constraint-flags-20170310.txt --- gcc/cfgloop.h | 6 ++++++ gcc/tree-ssa-loop-manip.c | 1 + gcc/tree-vect-loop-manip.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index a8bec1d..90be4cc 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -248,6 +248,12 @@ struct GTY ((chain_next ("%h.next"))) loop { #define LOOP_C_INFINITE (1 << 0) /* Set if the loop is known to be finite without any assumptions. */ #define LOOP_C_FINITE (1 << 1) +/* Set if the loop is peeled prologue loop. */ +#define LOOP_C_PROLOG (1 << 2) +/* Set if the loop is peeled epilogue loop. */ +#define LOOP_C_EPILOG (1 << 3) +/* Set if the loop is versioned loop. */ +#define LOOP_C_VERSION (1 << 4) /* Set C to the LOOP constraint. */ static inline void diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 22c832a..0559904 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1233,6 +1233,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor, scale_unrolled, scale_rest, true); gcc_assert (new_loop != NULL); update_ssa (TODO_update_ssa); + loop_constraint_set (new_loop, LOOP_C_EPILOG); /* Prepare the cfg and update the phi nodes. Move the loop exit to the loop latch (and make its condition dummy, for the moment). */ diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index f48336b..faeaa6d 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -1735,6 +1735,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, gcc_unreachable (); } slpeel_update_phi_nodes_for_loops (loop_vinfo, prolog, loop, true); + loop_constraint_set (prolog, LOOP_C_PROLOG); first_loop = prolog; reset_original_copy_tables (); @@ -1799,6 +1800,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, gcc_unreachable (); } slpeel_update_phi_nodes_for_loops (loop_vinfo, loop, epilog, false); + loop_constraint_set (epilog, LOOP_C_EPILOG); /* Scalar version loop may be preferred. In this case, add guard and skip to epilog. Note this only happens when the number of @@ -2400,6 +2402,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo, prob, REG_BR_PROB_BASE - prob, prob, REG_BR_PROB_BASE - prob, true); + loop_constraint_set (nloop, LOOP_C_VERSION); if (version_niter) { /* The versioned loop could be infinite, we need to clear existing