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 BFD4C3889E3F for ; Thu, 15 Dec 2022 08:33:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BFD4C3889E3F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BF8ELKX022887; Thu, 15 Dec 2022 08:33:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=6o54NjmtbExf+QSXVCN6FC3ZqnH+hKQ9h5ZSbFlMEBE=; b=ghN/NsIe3VZ4LGGf8wOVemXr8iChtP4OSqk/k/ZwiYbzzFtk9pvCD1pWP5RzZYSX+y9H w2LzXfGm9f9uOGC6vs2EbTR4Y1amoxEwXmAWqmyUuH7hPUefu2oz2Z5r1CwEwCh9AGqC 1UYB3WP7y+E1HeHcN9olNxmB/ZZUkkNTZL7+bUp00hTbWRl6N3wchAdFAWqYLA5FB1UL cCmQoB1eFe/lOSeRSpDkoahmBzmOo+aylCnG7nwrhXMz2U8L/WYV4URnuYK9y0NBRQSG ZGH9K541qTXizlyN4zWK0+Buh+0iB8CCt2koWzxaw1RnHdfLnUQ1suDuY8WtcELFTmKf mQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3mfyvu0dq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 08:33:33 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BF8GQMY028936; Thu, 15 Dec 2022 08:33:32 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3mfyvu0dpq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 08:33:32 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BF89NLG024557; Thu, 15 Dec 2022 08:33:30 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3meyjbjns5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 08:33:30 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BF8XQqD42467584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Dec 2022 08:33:26 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F6B520040; Thu, 15 Dec 2022 08:33:26 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D02E20043; Thu, 15 Dec 2022 08:33:24 +0000 (GMT) Received: from [9.197.253.236] (unknown [9.197.253.236]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Dec 2022 08:33:22 +0000 (GMT) Message-ID: Date: Thu, 15 Dec 2022 16:33:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: PING^1 [PATCH v2] predict: Adjust optimize_function_for_size_p [PR105818] Content-Language: en-US To: Jan Hubicka Cc: GCC Patches , Richard Biener , Richard Sandiford , Segher Boessenkool , Peter Bergner References: <64451523-8036-6d9a-b990-e07746867efd@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: eeYEYRXi2Qdi_2oe1ymawZjkyJPy1slO X-Proofpoint-GUID: TGSmdJLuJ4XfO6qL3IB7GljuhmD14mWh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-15_03,2022-12-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 mlxlogscore=805 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212150068 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Honza, Thanks for the comments. on 2022/12/14 21:22, Jan Hubicka wrote: >>> PR middle-end/105818 >>> >>> gcc/ChangeLog: >>> >>> * predict.cc (optimize_function_for_size_p): Further check >>> optimize_size of fun->decl when it is valid but no cgraph node. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * gcc.target/powerpc/pr105818.c: New test. >>> * gcc.dg/guality/pr54693-2.c: Adjust for aarch64. >>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr105818.c b/gcc/testsuite/gcc.target/powerpc/pr105818.c >>> new file mode 100644 >>> index 00000000000..679647e189d >>> --- /dev/null >>> +++ b/gcc/testsuite/gcc.target/powerpc/pr105818.c >>> @@ -0,0 +1,11 @@ >>> +/* { dg-options "-Os -fno-tree-vectorize" } */ >>> + >>> +/* Verify there is no ICE. */ >>> + >>> +#pragma GCC optimize "-fno-tree-vectorize" >>> + >>> +void >>> +foo (void) >>> +{ >>> + void bar (void); >>> +} > So the testcase starts with optimize_size set but then it switches to > optimize_size==0 due to the GCC optimize pragma. I think this is > behaviour Martin wants to change, so perhaps the testcase should be > written with explicit -O2. No, both the global context and the function context are to optimize for size, Martin also clarified that. So the issue is the inconsistent information on optimizing for size when parsing bar, at that time cfun->decl is available but no cgraph node, it says OPTIMIZE_SIZE_NO. > > I also wonder what happen when you add the attribute later? > /* { dg-options "-Os -fno-tree-vectorize" } */ > > /* Verify there is no ICE. */ > > #pragma GCC optimize "-fno-tree-vectorize" > // marker A > void > foo (void) > { > void bar (void); > } > > __attribute__ ((optimize("-fno-tree-vectorize"))) void foo (void); There is still one ICE with this additional decl. Same ICE if I moved it to "marker A" above. > > I think we should generally avoid doing decisions about size/speed > optimizations so early since the setting may change due to attribtes or > profile feedback... > Good point, I'll make a separated patch to move optimize_function_for_speed_p uses out of function rs6000_option_override_internal, but I think it's a separated issue which just results in imperfect "optimize for size" decision. Fixing it can cover this exposed ICE, but IMHO this exposed inconsistent information on "optimize for size" exposed here is still an issue, like: all the context is to optimize for size, but it still returns OPTIMIZE_SIZE_NO. Do you agree? BR, Kewen