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 218A63858D1E for ; Wed, 4 Jan 2023 12:15:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 218A63858D1E 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 (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 304AqiMO024827; Wed, 4 Jan 2023 12:15:12 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=QMpv8E7Rvvf3zQEOsagR1ejbd/fDI2Aw9KpLzfDAcII=; b=cxGXxy9SbhndAcVfOkk4bbo4/V9oP3Ipefocey40Cl4cdPhcKkgjxrzEvMuaNLLnx5KQ uuXITaUpkdnNEs3fsAFyTT+Y9N7si/0W66nCl6a02LUeMrkt0abChbMY85dEBU1B+UFQ FIjrFYEbMB8Vj3W0PwL/nwKmZFovA7oRBgBuU0FNm59jQELtVgp4V7jv/IkGF+Ipj6kE MWJxlVeo/6kLl1zupBJ7PEi84I5i7X8yn6ODA5Xhx4f1TzQQz0brNEWElpJxtMKO3Ns3 BAa0xKRwciG9/Ybp0GsfUJIsPh9gqVdYI05uqH5kYWbFgzLD+SVbvIAqllPnzCbDS6rH Qw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mw83bhury-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 12:15:12 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 304C7Fti024678; Wed, 4 Jan 2023 12:15:12 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mw83bhur3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 12:15:11 +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 303MHciH002397; Wed, 4 Jan 2023 12:15:09 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3mtcq6d8yf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 12:15:09 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 304CF7jV44826984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Jan 2023 12:15:07 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4475920040; Wed, 4 Jan 2023 12:15:07 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 843E320043; Wed, 4 Jan 2023 12:15:05 +0000 (GMT) Received: from [9.200.36.187] (unknown [9.200.36.187]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 4 Jan 2023 12:15:05 +0000 (GMT) Message-ID: Date: Wed, 4 Jan 2023 20:15:03 +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: [PATCH] rs6000: Don't use optimize_function_for_speed_p too early [PR108184] Content-Language: en-US To: Segher Boessenkool Cc: GCC Patches , David Edelsohn , Peter Bergner References: <197abd1f-081c-3206-4dd5-45f0b098612a@linux.ibm.com> <20230104104648.GI25951@gate.crashing.org> From: "Kewen.Lin" In-Reply-To: <20230104104648.GI25951@gate.crashing.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: u3NjNfW9bvnunBmnTKoPJ_y4pUJQSPJX X-Proofpoint-GUID: 6RHHBq3CdQYJ0vJQYiVjTSDmn71asKtL 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=2023-01-04_06,2023-01-04_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301040102 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,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 Segher, Thanks for the comments. on 2023/1/4 18:46, Segher Boessenkool wrote: > On Wed, Jan 04, 2023 at 05:20:14PM +0800, Kewen.Lin wrote: >> As Honza pointed out in [1], the current uses of function >> optimize_function_for_speed_p in rs6000_option_override_internal >> are too early, since the query results from the functions >> optimize_function_for_{speed,size}_p could be changed later due >> to profile feedback and some function attributes handlings etc. >> >> This patch is to move optimize_function_for_speed_p to all the >> use places of the corresponding flags, which follows the existing >> practices. Maybe we can cache it somewhere at an appropriate >> timing, but that's another thing. > >> @@ -25604,7 +25602,9 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx tlsarg, rtx cookie) >> >> /* Can we optimize saving the TOC in the prologue or >> do we need to do it at every call? */ >> - if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca) >> + if (TARGET_SAVE_TOC_INDIRECT >> + && !cfun->calls_alloca >> + && optimize_function_for_speed_p (cfun)) >> cfun->machine->save_toc_in_prologue = true; > > Is this correct? If so, it really needs a separate testcase. > Yes, it just moves the condition from: --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -3978,8 +3978,7 @@ rs6000_option_override_internal (bool global_init_p) /* If we can shrink-wrap the TOC register save separately, then use -msave-toc-indirect unless explicitly disabled. */ if ((rs6000_isa_flags_explicit & OPTION_MASK_SAVE_TOC_INDIRECT) == 0 - && flag_shrink_wrap_separate - && optimize_function_for_speed_p (cfun)) + && flag_shrink_wrap_separate) rs6000_isa_flags |= OPTION_MASK_SAVE_TOC_INDIRECT; here. I tried to find one test case before, but failed to find one which is not fragile to test. And I thought the associated test case has demonstrated why the use of optimize_function_for_{speed,size}_p is too early in function rs6000_option_override_internal, so I gave up then. Do you worry about that we could revert it unexpectedly in future and no sensitive test case is on it? BR, Kewen