From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 13F4F3858409 for ; Mon, 13 Dec 2021 06:40:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13F4F3858409 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BD4wFvw030241; Mon, 13 Dec 2021 06:40:34 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cwykx9jn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:40:34 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BD6dR8Z014251; Mon, 13 Dec 2021 06:40:34 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cwykx9jmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:40:34 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BD6Z9qD005233; Mon, 13 Dec 2021 06:40:31 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 3cvkma1b19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:40:31 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BD6eRuO27001260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Dec 2021 06:40:27 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 822C6A405B; Mon, 13 Dec 2021 06:40:27 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CBC9A4051; Mon, 13 Dec 2021 06:40:25 +0000 (GMT) Received: from kewenlins-mbp.cn.ibm.com (unknown [9.200.147.85]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 13 Dec 2021 06:40:25 +0000 (GMT) Subject: Re: [PATCH] pragma: Update target option node when optimization changes [PR103515] To: =?UTF-8?Q?Martin_Li=c5=a1ka?= Cc: Richard Biener , Segher Boessenkool , Bill Schmidt , bergner@linux.ibm.com, GCC Patches References: <6e9eaac5-3154-6460-1327-5c6afc14e33a@linux.ibm.com> From: "Kewen.Lin" Message-ID: <6bd4f39a-f7fb-ad3c-e7f2-8fcc01306ebd@linux.ibm.com> Date: Mon, 13 Dec 2021 14:40:23 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: sXm75GfSYoZcbpSkWvA8U67-JLoIG3TW X-Proofpoint-ORIG-GUID: 97UxohZq3UDDPez6dfcMdd3_BfLR0YR9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-13_02,2021-12-10_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112130041 X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Dec 2021 06:40:37 -0000 on 2021/12/9 下午11:21, Martin Liška wrote: > On 12/7/21 03:15, Kewen.Lin wrote: >> Hi, >> >> For a function with optimize pragma, it's possible that the target >> options change as optimization options change.  Now we create one >> optimization option node when parsing pragma optimize, but don't >> create target option node for possible target option changes.  It >> makes later processing not detect the target options have actually >> changed and doesn't update the target options accordingly. >> >> This patch is to check whether target options have changed when >> creating one optimization option node for pragma optimize, and >> make one target option node if needed.  The associated test case >> shows the difference.  Without this patch, the function foo1 will >> perform unrolling which is unexpected.  The reason is that flag >> unroll_only_small_loops isn't correctly set for it.  The value >> is updated after parsing function foo2, but doesn't get restored >> later since both decls don't have DECL_FUNCTION_SPECIFIC_TARGET >> set and the hook think we don't need to switch.  With this patch, >> there is no unrolling for foo1, which is also consistent with the >> behavior by replacing pragma by attribute whether w/ and w/o this >> patch. >> >> Bootstrapped and regtested on x86_64-redhat-linux, aarch64-linux-gnu >> and powerpc64{,le}-linux-gnu. >> >> Is it ok for trunk? >> >> BR, >> Kewen >> --- >> gcc/ChangeLog: >> >>     PR target/103515 >>     * attribs.c (decl_attributes): Check if target options change and >>     create one node if so. >> >> gcc/testsuite/ChangeLog: >> >>     PR target/103515 >>     * gcc.target/powerpc/pr103515.c: New test. >> >> ----- >> > > Hello. > > I do support the patch as it does pretty similar thing to what I did in g:ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e. > The revision was about pragmas. > > I can confirm the patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Martin Hi Martin, Thanks for the feedback and the pointer to your previous commit for the similar issue, I've added it in the commit log as one reference. BR, Kewen