From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 960493858401 for ; Mon, 13 Dec 2021 06:24:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 960493858401 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BD5uva8010058; Mon, 13 Dec 2021 06:24:27 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cx0fp0fc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:24:26 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BD6LTFK000675; Mon, 13 Dec 2021 06:24:26 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cx0fp0fbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:24:26 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BD6Hsxo012530; Mon, 13 Dec 2021 06:24:24 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 3cvk8hhbt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 06:24:24 +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 1BD6OLdY28180740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Dec 2021 06:24:21 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55AA5A4040; Mon, 13 Dec 2021 06:24:21 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86A00A405D; Mon, 13 Dec 2021 06:24:19 +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:24:19 +0000 (GMT) Subject: Re: [PATCH] pragma: Update target option node when optimization changes [PR103515] To: Jeff Law Cc: Bill Schmidt , bergner@linux.ibm.com, Segher Boessenkool , GCC Patches References: <6e9eaac5-3154-6460-1327-5c6afc14e33a@linux.ibm.com> From: "Kewen.Lin" Message-ID: <2cef3528-fb0e-9e5a-447c-8fc2f19f857b@linux.ibm.com> Date: Mon, 13 Dec 2021 14:24:18 +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-ORIG-GUID: _jRfk_kgJwQaTI8o_uge8LVMtYCOlByq X-Proofpoint-GUID: Yud4zESGfumFJ0dgrRQ60H_J42cc4XZZ 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 clxscore=1015 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 phishscore=0 bulkscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112130038 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_H4, RCVD_IN_MSPIKE_WL, 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:24:29 -0000 on 2021/12/9 上午9:43, Jeff Law wrote: > > > On 12/6/2021 7:15 PM, Kewen.Lin via Gcc-patches 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. > OK > jeff > Thanks for the review, Jeff! Committed as r12-5920. BR, Kewen