From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93069 invoked by alias); 21 May 2019 05:50:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 93058 invoked by uid 89); 21 May 2019 05:50:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=valuable X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 May 2019 05:50:44 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4L5lmTF130106 for ; Tue, 21 May 2019 01:50:43 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sm87fec1h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 21 May 2019 01:50:42 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 May 2019 06:50:40 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 21 May 2019 06:50:37 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4L5oam454263954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2019 05:50:36 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21BDCA405D; Tue, 21 May 2019 05:50:36 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 450F2A4051; Tue, 21 May 2019 05:50:33 +0000 (GMT) Received: from kewenlins-mbp.cn.ibm.com (unknown [9.200.147.25]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 21 May 2019 05:50:32 +0000 (GMT) Subject: Re: [PATCH v3 2/3] Add predict_doloop_p target hook To: Jeff Law , Segher Boessenkool , Richard Biener Cc: gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com, bin.cheng@linux.alibaba.com, jakub@redhat.com References: <1558064130-111037-1-git-send-email-linkw@linux.ibm.com> <20190520102439.GT31586@gate.crashing.org> From: "Kewen.Lin" Date: Tue, 21 May 2019 05:50:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit x-cbid: 19052105-0012-0000-0000-0000031DD137 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19052105-0013-0000-0000-000021568063 Message-Id: <343d46fd-eac3-0531-458e-d1e31e0c88fe@linux.ibm.com> X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg01347.txt.bz2 on 2019/5/20 下午10:43, Jeff Law wrote: > On 5/20/19 4:24 AM, Segher Boessenkool wrote: >> Let me try to answer a bit here... >> >> On Mon, May 20, 2019 at 11:28:26AM +0200, Richard Biener wrote: >>> On Thu, 16 May 2019, linkw@linux.ibm.com wrote: >> >>> So the better way would be to expose that via a target hook somehow. >>> Or simply restrict IVOPTs processing to innermost loops for now. >> >> I think we should have two hooks: one is called with the struct loop as >> parameter; and the other is called for every statement in the loop, if >> the hook isn't null anyway. Or perhaps we do not need that second one. > I'd wait to see a compelling example from real world code where we need > to scan the statements. Otherwise we're just dragging in more target > specific decisions which in fact we want to minimize target stuff. The scan is trying to do similar thing like default_invalid_within_doloop. It scans for hardware counter register clobbering. I think it's important and valuable to scan especially for call since it's common. if (CALL_P (insn)) return "Function call in loop."; if (tablejump_p (insn, NULL, NULL) || computed_jump_p (insn)) return "Computed branch in the loop."; But it's a question whether to make it as part of generic. I double checked that most of the doloop targets use this default behavior, only 5 targets are using their own TARGET_INVALID_WITHIN_DOLOOP, so it might be a good thing to make it common to share. Thanks, Kewen