From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2129.outbound.protection.outlook.com [40.107.101.129]) by sourceware.org (Postfix) with ESMTPS id BA57B3858D28 for ; Mon, 7 Aug 2023 19:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA57B3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=purdue.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=purdue.edu ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=do1s6amqdULuUNTuhEDQtbckM/VhOJAHSJmoCKXTY/3T8J1vl09ltgGz/XjmQ8erNBYQtSPZqKuo8gzJV0bp7O5rWgJhoaYGg+GLR65iqfwLEZ8ALqjotpklZG/UafIGvT3VM2MbgFx3o82S1MjWOfecEf2uck8fuT0SV6yAxSazCGvhtUOISkUkpQP+Iefa3oNea4old1SCth9xChd7wIkfoqbQXvDhu6ZvxnnNZYD8WDGY3JM0o9sD4hQw1jMX7HOZtSWRxQjlZEnSmuiNAfvpdvmBhq3nhpOvvrExaacH04OBo3sYbW3m+/dizaNtGPCjkUXhT/eQiB/H9niEbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=So8Z23vdFhrb0jr7Xamza19p6YhqGpbdUAjCfOb/3HU=; b=cDRzFMz1xMJNgNNOIV0nhQnX09r0ydliXbz8gnJA7toOP54hkXzfaNWeK6ZDD94nrXKkz4T7P3TCcj+Kpl+K1Hem1PqVLuUOMboJ6xtl+ed993K/NMKqnk9mn1zIYrnosaOUtdzcWW0FR8mky25ZZJq81Rp0z5Xa2gQ1yuCagNXLZdCPbIzMJTk9jRAGzG1NLiMBUAKsYkxfEBP2I2P0nJ4KZYawugR8ne6WfuGQAWuNLyvPEyCjaPttfp2xQfhSNIk7hrQCCtYF96uzKeZtiYLbQr78g3hTfju4BupPYDLP1JLd3Zygvmbn3zvSxpm3d2wU4CpT1MCTB3AVGg/xQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=purdue.edu; dmarc=pass action=none header.from=purdue.edu; dkim=pass header.d=purdue.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purdue.edu; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=So8Z23vdFhrb0jr7Xamza19p6YhqGpbdUAjCfOb/3HU=; b=xMcy0Ol7fTJG6T1HfMPZH506YKvACoBK231X2wt8Yn4Ghue3vXXa0e7ZGysuUzw8ag8/mK/Z871pk3IW9Fhp9Ky2D5jTtcOJf66E8Il7eEgACF2ouhn855fZ2hTuE5JvvJI1VwOUUgKtG9f7rCCRsMX7g8og1UxxgPRyFvKtJjc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=purdue.edu; Received: from BL1PR22MB3634.namprd22.prod.outlook.com (2603:10b6:208:392::13) by MN2PR22MB2079.namprd22.prod.outlook.com (2603:10b6:208:200::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 19:04:53 +0000 Received: from BL1PR22MB3634.namprd22.prod.outlook.com ([fe80::3b52:56d9:49c2:e187]) by BL1PR22MB3634.namprd22.prod.outlook.com ([fe80::3b52:56d9:49c2:e187%5]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 19:04:53 +0000 Message-ID: Date: Mon, 7 Aug 2023 15:04:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: lucier@purdue.edu, Prathamesh Kulkarni , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Add -Wdisabled-optimization warning for not optimizing sibling calls Content-Language: en-US To: Richard Biener , David Malcolm References: <07d4723b-d449-ccd1-d3cb-c7ee80bb97a0@purdue.edu> <767a986316b6c934c29af5070cdd5dd4d3ba81e6.camel@redhat.com> From: Bradley Lucier In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: CH2PR02CA0028.namprd02.prod.outlook.com (2603:10b6:610:4e::38) To BL1PR22MB3634.namprd22.prod.outlook.com (2603:10b6:208:392::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR22MB3634:EE_|MN2PR22MB2079:EE_ X-MS-Office365-Filtering-Correlation-Id: d7beff3a-905b-49f4-3a5d-08db97792ec6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ogDFB/CJoZ8gWRDChBw0ROUaRBV7A2cEViM5nLHenip2xSGiGvqJx898ETTTLN0MnyMTZk5ijQaGTUPGO5gFO/VJvG5t8TgUlWctTGb3lYe686y9Fsx/jeVEP4l/BgDWM2WvAwLJBQD7ugGfL6FVcPL/WFZfSCyEH2dmtmPYT1QrMgVhCh4BB2GljqXDu2pGtiOrXJi9krU7+dUjLNkXzIR1lBeyYCo+VNc+mx3ikF+w7GeBlscOr587KkI+sJY2F4MR5H3UAogaAW+HG3+Zgths7kdHe4kkqpf4WDTu8Or36+sWSJICvKR1Y/hUWwAt90IQ+CTg2/UbIlTjV9wCehHrolUP/CxEtei0GqPN48MEYv9TyDbLWt+wD00MQBWpBenxJkU3otPpjYpOUBdyx8avgOqyUM3rYQhY3rJvRtVF7Yoo4t+lloMifGYrO7i79+u3GNZPB8/eClLrXK/3Z6lcTP+UZs3PwIAy+8H4Bix8PtKsXTINO3+T1gXsgzdLNIKvxCyB2mIMZ2dl4z4ELmRJmx5Z3W/P6ZPqpYFA+QuzbnxqkpYw7+4m4SQyb9jOpBsoaaE8kGoKcn0eRk5zdbwXmcn/YjXlAx4LUiNCydZ/laala7i7Eh9RC5ijFYv9Qg5LIyG31AB642hrtdBVTQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR22MB3634.namprd22.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(366004)(39860400002)(451199021)(186006)(1800799003)(31696002)(41300700001)(478600001)(6506007)(8936002)(8676002)(26005)(75432002)(38100700002)(6486002)(2616005)(5660300002)(83380400001)(36756003)(2906002)(110136005)(31686004)(786003)(316002)(966005)(66556008)(66476007)(66946007)(4326008)(6512007)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Kzl0d2owaEpuUUhCclIxeTZMYW50U3pVQjFIb2ZZL1RRd3BPVkRnaTVxTW4w?= =?utf-8?B?U0NYcTFUZVl0WklsZDlhWEZoZlYycEtiUGlQeGlLWVJNN3ltMnU1d254UmF5?= =?utf-8?B?cExzd09Kcmw4dHJRKzNPRFpnZVplTUI5bnhiZEs3elpldUhsUGthK3dEczVZ?= =?utf-8?B?K1grdSsxZHN1cTFkVDQzUE1jV2l1Y0xUaWNYK2JQUURVR2JFeG9jTnArRDJu?= =?utf-8?B?K3ZYMXlZNDhNZE92ZnBCZFpJeUpmeGhOcmVkMnRDN0RLY2F4eWdoZ1E2Vkdl?= =?utf-8?B?Q2lwTVFSN05WUTh6TGNQeUFoNEFXTi95c1hqUFdNMTVOeENxRVI1VTlXeWJD?= =?utf-8?B?UkROVTdXYkdDcEQveWRmNTRCQS90VEk4NHdYR0gvekZNdDd4cDd0TFBRVzRJ?= =?utf-8?B?ZkxZTm4ybHZHVDJraF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?utf-8?B?YVJZK2o4R3Q5d1NtdXZLaHJRdHdvRzd5ZkIrazN0dzh0V0JxaHRmalcza3F3?= =?utf-8?B?N3lXTW9RQXJ1VnpKWFBMcEsvT3lxN1dLajBLTHhpOWh5MDVFdnJkRVdkenRh?= =?utf-8?B?NmdvQTVqaU55WjVhRG5lV0ttS3VXRnQ3bXR1QnZ3cHd6c1dCRk96NUFoS3pu?= =?utf-8?B?YW5WVDRuVlV4RGo5OEt2RFdjV2JUSGIxRTFaaThBR0RVWU9GQTllZis4K2t2?= =?utf-8?B?RHFuSGFKcm5nbTBnTzR2R1VwUUhFT1VKaDhIbk1BQlRNUkQ3Z1hjN0hMMWg2?= =?utf-8?B?RFAzUCtmUVdvZEpDVk9NN0NSN20zTEpId21MVVd5VE9tSUt2OENUWGFWZkM3?= =?utf-8?B?UkRSR2o0cTltY3dWOVlZRldzeGVhZXMxZUJCbUhtV05YSFlhMnduZXB5NGJD?= =?utf-8?B?b1c2YVlNWklObXA2d05KdVlDelVjN3Q1L3l3RWpQanRHN3ozODYrSVJheTZa?= =?utf-8?B?WWlMc3lGc0N5ZlFUL3BQWUo3bC9kQTUxaExFbWtlT283Nzc1KzZxRENDWFd3?= =?utf-8?B?bk1XeXM0WUwvWTB0Q3pJRW1jQ3k5ek9aODA0d243Wk5hSWNuRjdvanVjVm1F?= =?utf-8?B?WjNSY1JGL0hMbitCSHlNVDQ1NzFOSzhyRjA0MWpsMXFXV3R4blhQNHYzMi9E?= =?utf-8?B?K2RDL1BONENpdXBrNUUraHVLR2JiMHg1Uk9HU0FJUFN5eUxrUWJTRi9LWlRo?= =?utf-8?B?Q3JxU1BHWDNLRjFIZGdWNDdieEFSbTF6SWIyQjI5N2lsNVk4K080cFdkeU04?= =?utf-8?Q?20zK5l64nUsWchOfb5PWWR+fX?= X-OriginatorOrg: purdue.edu X-MS-Exchange-CrossTenant-Network-Message-Id: d7beff3a-905b-49f4-3a5d-08db97792ec6 X-MS-Exchange-CrossTenant-AuthSource: BL1PR22MB3634.namprd22.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 19:04:53.5990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4130bd39-7c53-419c-b1e5-8758d6d63f21 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: juap5vjmzoWIZuLsbY+DJA4leWKU5qMBvibZidY7QbXV1WSsB4fhPuAC9tNBKH72KtqVsXc6/UxGCjmxvRWgaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR22MB2079 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,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: Thank you for your comments. I have a few questions. > I don't think this specific case qualifies for -Wdisabled-optimization. > The diagnostic is for cases the user can control and was invented > for limits we put up for compile-time and memory-usage issues > where there exist --param XYZ to adjust limits. > > It would be more appropriate to change this to > > dump_printf_loc (MSG_MISSED_OPTIMIZATION, ...) > > where this was designe to diagnose cases the compiler failed to > optimize for other reasons than running into some --param. I'm sorry, I don't understand what dump_printf_loc does, where does it dump this information? What is the form of information that is usually dumped, and for which purpose? > So, NAK. What does "NAK" mean? When I added the -Wdisabled-optimization warning to gcc in 2000, I was trying to give the user information about when the compiler may not do an optimization that the user asks for. And yes, my idea was that the user can either ignore the warning or do something to the code or change a --param to allow the optimization to succeed. Whether gcc actually optimizes tail or sibling calls that appear in the Gambit source code has been a point of discussion among the Gambit Scheme community for years; sometimes that discussion has bled into the GCC mail lists, there's a fairly long thread here: https://gcc.gnu.org/pipermail/gcc-help/2021-December/140957.html I actually built a profiled gcc to see whether maybe_complain_about_tail_call was called when compiling the output of Gambit's Scheme->C compiler; afterwards I reported to the Gambit mail list that it had not, all sibling calls were optimized. To me, -Wdisabled-optimization seems very appropriate when the user asks explicitly for -foptimize-sibling-calls (which the Gambit makefile does, because it doesn't want all -O2 optimizations) and a sibling call can't be optimized. maybe_complain_about_tail_call is even passed a helpful message that explains *why* the call can't be optimized. With this information, the user can actually do something, rewrite the code to remove the obstacle, or decide that optimizing that particular call isn't important (which sometimes it isn't, if it's in the handwritten C support library instead of the C code generated by the Scheme->C compiler). So I'm really hoping that some kind of information can be sent back to the user in this situation. Brad