From patchwork Mon Jul 1 20:13:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 93147 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 548E038A1401 for ; Mon, 1 Jul 2024 20:14:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::601]) by sourceware.org (Postfix) with ESMTPS id 1C0363858CDA for ; Mon, 1 Jul 2024 20:14:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C0363858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1C0363858CDA Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::601 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1719864842; cv=pass; b=Gv/TElNb4pva7BkK4IHwqJM0nLrVAByQ732egKYUxYndodr7dXyY9hlOabidaDO2upQiQdShZaK/HWuGn3mpDq1IYAVlNkcbZafQldOgMhaoZlNA+POEmCcKOmd8F+wAejuD85d88e5RutGQ4P/8Pm/13F/HHwnP0qnyhjqogQ4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1719864842; c=relaxed/simple; bh=RY2RziaYhq5clhbfrGFfZiWKEKyo1dUBVh5hLNzgG8Y=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=QbHVpb+fUVMYtFjhnxGOX6cRJCaOv0U3KPeaDH7axxUNIyov/AU/ATXH4hIAcz9K7zgAeUtWpCqIpNC8CX/+JcJQizJTJayRtCTRYOftuWMmexxQuTRcebDRnqCOTUZCE+qGLhTF0IERl8zQ0Hqtd4jFFlycjPFFnHDKyX3LxOI= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UPK0DTUu4fNtKyoFooHu2MjJyGdDUtkR/gt7BFGt6RcSNvbQA8h1DCK5hjtGmZ6jJS9SUK1yqHyDJ8m6lE/BStLYh98EvPVNErs65TNyKIoK0ZaVtN2qBOJ4FWIwIDF/tb7TXfruPvYvECKRg3pP8Ii09VLN+DuxBlW/p78QIuToe4x1BaAmghB3AxoUwAQOZ7MRn8u6U33JpZRjD4eCxcYr8taeKsGnn7AjkQBUUeFTZPrBnva/gTWNcd76t7jPJbjJC5OSfQSR4JIjXaEIE97XXjFaNlOITvBM+4kJobvFmjNyw4YqtR78FmCHtS8tSc3wJKO0qfb4CL7vKe6XTA== ARC-Message-Signature: i=2; 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=al5RoJ8n5I3ZMQBBOgM+mUxr3Q/wsxA1g2MnSA9aW0o=; b=EKug09V/psNPkG1HTarb6guL6itiAUvlfTmDOkqUMiTBDzDHQVfgiP/Ms/8uO1FM8knkgE/1pg3N8KDNRMxHv5hIaJXJFy2Tlc6lTn2yeNiW0+DkYrrBufN+tgE1SKWBkrfmCqV3zKRvFrAyTfS4gD1h6RypUrbUJFqpbAdv2N1AdVh287jOrbqqX3XGVCYQQlnV2M5F8pY0Z93FDMZPEfCxQXlWS5V1XUUaulQjoNHbo1deZQUFPIkg/18N5/VyKE5sj2A1T8RyHgSuS7gKWUQ8XUCYSFXij6p6CkcsslSaq1RkKV21NZ0pnmTLR/DSlzi8PtyTgjBgCXYg1No/Sg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=al5RoJ8n5I3ZMQBBOgM+mUxr3Q/wsxA1g2MnSA9aW0o=; b=gYTPZ/mvBtBjeBIAIIIbSCK1V3By8eqDtnIWOEQ/8MOMmlZCkyTL9yRQ2RnlE6DE9lUyqMsF86JMeVwjdtyM5lz7NLXYbqvZaiAw59YlPzsdQax1xSR5nsJpX+2sFQx1xXGSbXK+aofFz4K5lIjV3rYV4tHxuWVncYu1igteV6E= Received: from AS4P191CA0018.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::14) by DU0PR08MB8662.eurprd08.prod.outlook.com (2603:10a6:10:402::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Mon, 1 Jul 2024 20:13:55 +0000 Received: from AM4PEPF00025F98.EURPRD83.prod.outlook.com (2603:10a6:20b:5d9:cafe::c2) by AS4P191CA0018.outlook.office365.com (2603:10a6:20b:5d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33 via Frontend Transport; Mon, 1 Jul 2024 20:13:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM4PEPF00025F98.mail.protection.outlook.com (10.167.16.7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Mon, 1 Jul 2024 20:13:54 +0000 Received: ("Tessian outbound 3a274c9b26ce:v357"); Mon, 01 Jul 2024 20:13:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 043e59c7020e3053 X-CR-MTA-TID: 64aa7808 Received: from d4b96dbaa51a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 561417CD-2663-45B0-89DD-92D867761661.1; Mon, 01 Jul 2024 20:13:47 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d4b96dbaa51a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 01 Jul 2024 20:13:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=URfQFWQ5Hju23P3FtAWNobOsDzQKv1LY/myF3kbx3+AMaji4u8NJnW7i5NVgMTGoRuUqJpIgKdgli1m0nq0VkI3utfwm8v5eg36+vBd+/y6JJ/NWfkfppecU82J7zzmZKxfkgza0WlYW0HwKHOk52ESSW8mzv2FqG5Yx79H926g5FMsJcFsanmAsqwrWyTW///Yd5iEP4Gv61IuFziPQN1XUFHpgMZ1+XFuZEK3h6FDkuLnQ4Z1BiyWFlcZltJETbSEhBFbR23Ky7FoHBpauVZ6kGs/HJbfCrXX18Bz/WtFsMSIK8H4KgMzZygf3vcVGGvNvl0Mz0VnN/4EXXNQd3A== 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=al5RoJ8n5I3ZMQBBOgM+mUxr3Q/wsxA1g2MnSA9aW0o=; b=JQaMMQDa/OUYjFeU37OpO7I2XYAk/OYdlUdW1INYVqNPeyE/n9L8/WEh+hfukSsGDJs8T3xwF6bb4I7mpILZQtkS/gaYql9+8LoVxMgpjsSACvaUMBXIjJmwGrIv/B5QO/JDGNIfAkA9DIm/cbApsr1QHkgmTmVcwY+tchhpYX/AMppnWgl9sXz7TnIK9aAM1vo7oZmq5W+SErv7oZUsAtdEBLoIqi/O5cZ1RZsNyoF5jIfRYcmDtps7UWnm5mTsWsrvD2Fk1HujfRM/7tX/Wap0d5k0ZYInV3oqmLvHFCcoR+0vRPwb3Gp/APrntwYAUoydGAMsWU8x2Xlk+birOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=al5RoJ8n5I3ZMQBBOgM+mUxr3Q/wsxA1g2MnSA9aW0o=; b=gYTPZ/mvBtBjeBIAIIIbSCK1V3By8eqDtnIWOEQ/8MOMmlZCkyTL9yRQ2RnlE6DE9lUyqMsF86JMeVwjdtyM5lz7NLXYbqvZaiAw59YlPzsdQax1xSR5nsJpX+2sFQx1xXGSbXK+aofFz4K5lIjV3rYV4tHxuWVncYu1igteV6E= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by AS8PR08MB9043.eurprd08.prod.outlook.com (2603:10a6:20b:5c1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Mon, 1 Jul 2024 20:13:45 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69%7]) with mapi id 15.20.7719.029; Mon, 1 Jul 2024 20:13:45 +0000 Date: Mon, 1 Jul 2024 21:13:43 +0100 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH 1/2]middle-end: fix wide_int_constant_multiple_p when VAL and DIV are 0. [PR114932] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO6P265CA0025.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ff::18) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AS8PR08MB9043:EE_|AM4PEPF00025F98:EE_|DU0PR08MB8662:EE_ X-MS-Office365-Filtering-Correlation-Id: 9dd20120-4129-44d7-cc26-08dc9a0a5507 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: RTOTAMMMRheYTrLp/jTfKSegDnfx5U195FMWS4RtI0UTdEHKujoLrInA4fPWpNEAM6rptzsB9AqWyJ7v9rbgKHxu86lryrSDZARfKUesX0q0Li4ofqp5syb7pO5hwP9JDMAJ0c/2qKyJq7RPwnGkZx8nLrefiszW0Z/n6SfN7UbuvBuiV409IprYcALxJSiDuraMmspjGJf7y1E9h8VvK/JgMTHHhXnosF3u2p9k2EzOZmoEbEcLHp1ILkv7xcj54Bypgss+1lSkzUDUb2Tyu4FCje09qJRjsuHUkS1qsItbICR2bAb0hLllSOQztfbt090uPm+OihoMbXO7YHG4scNCF5yHEapILbhQs1lv2R5z+oukzcDQtfdGmKsD6oj954tmXIa8prH7Cv3/zz3c5tWKbPZtqhIH2f8PNFJY4Nn/3J5AIfnEJvTwcFC3jFDyx6zNrT1lF8wR41l/Uqn6cfvQYbwHYmZ7RwpkQsfPtdbLmwsoOYWc9Jvf0uRszTXzcW2WLO/q5fe1IdPoeDRbwcw89LYa8ODKKX/LzL/0itTq68BP3tWqnBNhVep91CAbc9HDyKWV0AZdZvt+bsU/o4UPH09IhIbgUoLFxs3wVwUdq+m5j6qptkfwmmAeQB1/Jo/1TkwxSMTsrSE7fGYXrVgXQHTxUvLVnhEA8gGCC1N3VpXi2DPwZHXYh8cu/9eU05WnVC2lcWFFzI0v9++UmtMO7QspoVezKeWCYNbwO0RLPzKV0nXbxYiPVHfm9sUm9lohHAPldYL+AFO7I5oWaCxM2Vbk7LAKk+fe147ZAbGdcSGrb0+6jJsPvTk5nGkRCacpm7eLBN2Tcj68BBj+BWO17co0zzHFEsco0T5jL+aK07xUHOHMqOaYsijfftVqFuLzajvYG4hZxE6SYHbmrPTRoBd3sFJjv54baeQ/HffI1FGjq+m+oE8HkdFwJXvK3D1I3Yvo1jbxJtyrPkeL1hAC7YK+ZnxpvCHKwisb0CSWFtaNLlAwb3tduvqN0Bz63EfBAnxHoJILE+6+sJjrThEwuLr2Uo4NEeqwFL7JHjFVhiG7lZq/ykOWewA6FrTv7o8CJRB3l47PnVNaOHk0sPiuQ+cM+5098aLOMT79PrehO1l1ekUfFKmis20b1pdzkAXMNQ6jucgCRs6yeN2TB8nxS8oK7H0yh8iPz9rykTWIiR0bbu/GW+5Cc+oeVby1g0WmlxK3a6RNK21dBliDVkvbjYYXNfLtvdrUTVGcrOi/+OHitjcRjpUSqbhCmJndBnP/Jm/QdYeOmqCT4iIfAL9j5wBshb2BK7pwxqDBwuAA5f9sDZNqpMwapXM8HE3tMM04Q00jTKhDCARF1Hz1qA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9043 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM4PEPF00025F98.EURPRD83.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 13ca1dec-3636-4daa-3262-08dc9a0a4f77 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|35042699022|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6H1BQRfQ0BLqXlmfCRw6tWX0UHkTC5d?= =?utf-8?q?wB2ANYYiDod4oM7fnLnWdTwT7VjyqtLZ+48KmowpGUuqy88jcrOWAEEc2T/o/ZQdS?= =?utf-8?q?GsYLsf15BidyBoX73Jh6ayyLY8PA1hPjgYS825xMrbYNft4UPGSRSutDHIVKxa9m6?= =?utf-8?q?AvviK3ZvlDqsaVyWC/pPmW7hoXvyTOX/diYMGZ+7zgT7iAydzkRe4U3ilunSRwFif?= =?utf-8?q?8E4ZFmzEKW3HL6HfLCT3JSaOyd+UL+Z1uz0aexde7Hyp0iBz8/gtYv2+EvjQm46xf?= =?utf-8?q?1NpCcDLPouC4/Xb6WbWihifXlqoUPOAkM5q5S/THE6O8bdJGVg1dYvCTSGWSpDerV?= =?utf-8?q?iODEBWQZw/P8qYuoB9Zdb7VaadXUzDs0D7frvcUumPiANUsr321GR9quFgl4/7Lpy?= =?utf-8?q?d74DS+brt3HlJTVH1yItvA9PqfNFZgM27znT+lcMTeRC2AajCB8VJjvwU6iBBaj+3?= =?utf-8?q?UK6hPRya7XHKRpJrPK1tFlBxJ3+jSauMmZ1lPShm0dHsTEZchZYI8if81F0Rm9npU?= =?utf-8?q?j7YTu9hxJ6mxyrZxA4RWBx8Gr82Mm0qdp7q4rDMFHHBytBVkwBTqPSDUvTop0dHu0?= =?utf-8?q?/94jvR9nZKOl+nU54wnI/EdfggC6udw+ADhNN8xHDreGblxhGsQzGjS3lN1SGrjl4?= =?utf-8?q?HFoiZffp90dPZQUZafcpp0ufVhDry5jpzA2k2Kaz1VOKiVDsYONIG2XjLoBe0rgIN?= =?utf-8?q?jd6xk8hgbsHck3zuXrs32TclJ5Jr+4zibc1VZj3aAgi6YEEL5j7MrNBmnsvznkNPq?= =?utf-8?q?3iOXJ7aI5Z08FZYmZ2rmEICk7tHVxJr8QzgDwVW6RcRTsgsLYk+7duan/m6YLuH9z?= =?utf-8?q?AlIseUQ4haZ6M6qeALDTatOJD2jNzZY6MeX99xiqSDVS1EMNFhrEfAfMeFGKTQ9NM?= =?utf-8?q?NV3OE9mj90+gSJeylYLbDmor8vjBtb2OkJZlmA/WOg4dNayvfD8zcpZbXFdb2Rip3?= =?utf-8?q?HzEYKAQo0JGI7YvGAZs7AnTmXKddmexwB4wnpYbj0cJcGMP5g6SpMttVkRoZdd4fU?= =?utf-8?q?KnvRNFbas6ztWi9QaqueNf/yQSzh8Dz6SWUcLjNSRZzFmQ63P0Cn2/ynuVgHIv/um?= =?utf-8?q?1frvUPwjQtMPNJU1AbD//FPNIs/di5HvAV5q0bFSYDcOQ8Lx52EPAssWOu54Uyhjr?= =?utf-8?q?7T0kM7hn8TFSUvnZMM1zVFD5dNnbj/tkp3uDqtVEvHjPX/Cl6bGdGsMCx8vskWlAx?= =?utf-8?q?rlre7C+cfCQ67j6lzYx3AeBIdtxW+JQhQ8T1+TfhXYdbieKW3eQtoG3WIMiFz6Dgu?= =?utf-8?q?vR3PzwDbh6hGY/JF7nD3ywXQT73ZzAKkYvynChiFPjh9fSvZpGDsrz0OVpdrnvYe7?= =?utf-8?q?fBE4gQhlYCfxUofNUv51fXQKTA5cKPiH6X4f2b3cQgRMO77riWLgH/xwcaQFpXS2b?= =?utf-8?q?AT2Lp3sRpjs?= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(35042699022)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 20:13:54.6067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dd20120-4129-44d7-cc26-08dc9a0a5507 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00025F98.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8662 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Hi All, wide_int_constant_multiple_p tries to check if for two tree expressions a and b that there is a multiplier which makes a == b * c. This code however seems to think that there's no c where a=0 and b=0 are equal which is of course wrong. This fixes it and also fixes the comment. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu -m32, -m64 and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/114932 * tree-affine.cc (wide_int_constant_multiple_p): Support 0 and 0 being multiples. --- -- diff --git a/gcc/tree-affine.cc b/gcc/tree-affine.cc index d6309c4390362b680f0aa97a41fac3281ade66fd..bfea0fe826a6affa0ace154e3ca38c9ef632fcba 100644 --- a/gcc/tree-affine.cc +++ b/gcc/tree-affine.cc @@ -880,11 +880,10 @@ free_affine_expand_cache (hash_map **cache) *cache = NULL; } -/* If VAL != CST * DIV for any constant CST, returns false. - Otherwise, if *MULT_SET is true, additionally compares CST and MULT, - and if they are different, returns false. Finally, if neither of these - two cases occur, true is returned, and CST is stored to MULT and MULT_SET - is set to true. */ +/* If VAL == CST * DIV for any constant CST, returns true. + and if *MULT_SET is true, additionally compares CST and MULT + and if they are different, returns false. If true is returned, CST is + stored to MULT and MULT_SET is set to true. */ static bool wide_int_constant_multiple_p (const poly_widest_int &val, @@ -895,6 +894,12 @@ wide_int_constant_multiple_p (const poly_widest_int &val, if (known_eq (val, 0)) { + if (maybe_eq (div, 0)) + { + *mult = 1; + return true; + } + if (*mult_set && maybe_ne (*mult, 0)) return false; *mult_set = true; From patchwork Mon Jul 1 20:14:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 93148 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA47C381028D for ; Mon, 1 Jul 2024 20:14:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2062b.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::62b]) by sourceware.org (Postfix) with ESMTPS id B087638114E8 for ; Mon, 1 Jul 2024 20:14:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B087638114E8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B087638114E8 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::62b ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1719864857; cv=pass; b=ouuKDzKFJSub79ziMPwG6hlatX0roEbD3A53uqcWySvizb6Folg0+MzqvR2vg/4VmavT3yiw1MuztXRZytsWCWjozRFJ8/a8XPvS5zjKyMXn/4KO5xsWEydngVVR3Ip3eYcjbGV7PTG7UySPRdUixeHk0DmVU6mm4TKxwBgQO1M= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1719864857; c=relaxed/simple; bh=OMdXMt2VUlXesRRJn3cBjAN3KU0OjbNx6d1JZskfdH8=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=P6bg36SlENi7+Pzz87Ce/az8ireL9cxbKs8fdIiYbLHU953rQ8Et4xGNvolP8tnUFJGZUkQv4ddPtBzO78C4kv58P5tOCLQfROJgIvDtA3CFalW3dzqJ1vLlbsXb2tn07BeAb3qQResE2zkw3bryB8m6X/CHOwWfl7lLOug8yHQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=oDiy9re1qg6mjJeVUMr6ci+4db62gbR86DL0oFqT6VTtoNT+p87ar7MSSEz0VTUYeX8VeVIN9UBfuqIG8H8dR04XuA/sNB6OdsiupEZuy40pAVGGUO1Zq2r/yKpjK7TWJwiYsRG/+j2WYv3f7KpIBOAt6ohCtNUxvo+vkIPG0YLGKPlaFSWZrp9nDUy4Te1hb7oeasuS8E6rVaUdjB8VinhPhTux+SxCFX9al9IFoQL2Gv/8LFcNa0CX2s5A4sGrZ6lCFjnd5ruPcJZgliJp9XLcKWl1zbAY9k0eSmPJgOVpOCGNWac9hIJEqxYGNe3TSq5HOo5tT8FTs9PITSnjqQ== ARC-Message-Signature: i=2; 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=sKkwkR3yAmhvoIyHWJE7tt37SnMeqR/4I76jz4VAcUU=; b=cx1w2VeAphkYChezcq6HTgXIgpU48v9lyYEg6n0eA+5Tx7lsTGENY83m6MrXGH2ceyEro47Rl2a+Km0gba0F81qLdkasExaUqNdqNArXS4Cx0o4RRkCUo1+T7XJmyoGNdjWQZ32evc7vxUTCYj3p6saqtHeuLq2YI8J/DTaQpIfuQ9mmghpL3xBVVcAGQiF6bGqt9TLArU+kkDPjh75GYf5U5OD23eq9Ry5i1NZ3MQLtYDnpTxioZJjyFgeqH2wd9dAvXBLomdmmfDN3h3Q2rArjvymEHQikZn44akbyMstv6NiM4vobA9gAZfJ+isc2vE9S+QWCGKu4SU0XPr5O3w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sKkwkR3yAmhvoIyHWJE7tt37SnMeqR/4I76jz4VAcUU=; b=JBpPN3x//kn/8+Y3xFsQhjaSVebholdYMP0O24pzJXiNWiGs1gZGNFXkja18XadLJVK8ObZNyB4EIqjZdx/qWD3YHE7ZixWBDCJ5ba0KDfkUKa+O+lOjIpHkSG+AGNPLhXqeyoqZEFvrCCdI0Vh+bZA5AuSVJUzskzFM7rGQSe0= Received: from DUZPR01CA0150.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bd::7) by PAWPR08MB9592.eurprd08.prod.outlook.com (2603:10a6:102:2ec::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Mon, 1 Jul 2024 20:14:13 +0000 Received: from DB5PEPF00014B9A.eurprd02.prod.outlook.com (2603:10a6:10:4bd:cafe::eb) by DUZPR01CA0150.outlook.office365.com (2603:10a6:10:4bd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32 via Frontend Transport; Mon, 1 Jul 2024 20:14:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5PEPF00014B9A.mail.protection.outlook.com (10.167.8.167) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7741.18 via Frontend Transport; Mon, 1 Jul 2024 20:14:11 +0000 Received: ("Tessian outbound 826180819ba6:v357"); Mon, 01 Jul 2024 20:14:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 29c7a1f8a90a0896 X-CR-MTA-TID: 64aa7808 Received: from 64f734714396.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7F350CE4-79E0-4544-BE6D-47BC928929CC.1; Mon, 01 Jul 2024 20:14:04 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 64f734714396.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 01 Jul 2024 20:14:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQtZy7xy49UzNYYATtxUA4OcUdbQMOCHBSsQpg8XiX4qljy/aSLQIa0fDjwDywbIlpLDZzAwLzisjS7228AzIV38dmJiUijRlVzaMqvtnx+xAS85J0Nto4oVTj3Rn9Ps6V6m+p22aGwfl1xtLEkSD0VYGDlZLvHpMyM4bYhs2qL6/DnYvzWuaEP7CFs23H6EV7J9JYysIYN8t1sg75biIPKDnqzVZ07V57S0WtA9FjbBn5nkF3dgJZGpimY7MaFQpiapkZTP6tnBnwHf+C1ZhnM2oW2iljr/14/H19IfVzSDBNdqREI6hT6FDgT5sNW3C5xoA84TAlzh84GocNSVVw== 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=sKkwkR3yAmhvoIyHWJE7tt37SnMeqR/4I76jz4VAcUU=; b=gsOBGJHRC1dKGdtGKG8cgdp5pDptzYE4oy93Bo1g+fXXFHyMmfE1DYXFAhT6FUaQ1etzpHfvfEUWyzQ85soS9B81VJq3NZwsshyf4TG8PeOZBkaWqZ/lZ6YscSofdu0/QwKJV3E7wBYUM4t1RyB+r+3/TkS+UDzpbcotkY6dBa8Gw+tLzatrip+8OOoG8Oll4CDwgm2DGOhwzRJbZQ/3oZ8AYcrnHdwjr7uRq3Z2eBqStxXEaZ34SnDTCAfhsIdN5czVPrN2Wl34nXWIVMLk4p1nolhvbPJFWBg5YZarMd9cgCEmjEPKoOMxvvUAlGCQzlll9XZntaHNPdqeCecYgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sKkwkR3yAmhvoIyHWJE7tt37SnMeqR/4I76jz4VAcUU=; b=JBpPN3x//kn/8+Y3xFsQhjaSVebholdYMP0O24pzJXiNWiGs1gZGNFXkja18XadLJVK8ObZNyB4EIqjZdx/qWD3YHE7ZixWBDCJ5ba0KDfkUKa+O+lOjIpHkSG+AGNPLhXqeyoqZEFvrCCdI0Vh+bZA5AuSVJUzskzFM7rGQSe0= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by AS8PR08MB9043.eurprd08.prod.outlook.com (2603:10a6:20b:5c1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Mon, 1 Jul 2024 20:14:02 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69%7]) with mapi id 15.20.7719.029; Mon, 1 Jul 2024 20:14:02 +0000 Date: Mon, 1 Jul 2024 21:14:00 +0100 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH 2/2]middle-end: replace constant_multiple_of with aff_combination_constant_multiple_p [PR114932] Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P123CA0272.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::7) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AS8PR08MB9043:EE_|DB5PEPF00014B9A:EE_|PAWPR08MB9592:EE_ X-MS-Office365-Filtering-Correlation-Id: dbcb66bd-aaf4-4ad1-783a-08dc9a0a5f2e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info-Original: KF2Bp1SAvqHBPG/4tcWqtaYwZfqVcwKdDL1QK4+Mf5gHAie9J+Kxke3Q3I8dUhGVw1HHLIpIRCfZWULIw66jLxm5xoB1+DyvCEjqd0Ak/B3DbdMxea5UtFLkw2YUm71cfAZhk9vto4kyIwYpeNgn8SItgCvT067GqSsDK5Ggo5ylpydmcIw/ZJKuUtlB9W+Tlkv7ItNfvWzF+yCbsX6lCdb5c8TX97bVJP9oW8uQ+VcEaJEKmx8wxLFiSIQ9gr0W2GwaQjELra6jXqwp7dla5+F3MA0Fz7F11GVwRjBMBHKrkpTfujgqfY1rV24OKEQF32gGrBXxLWgsbOswwC1WohTSMwrhBUdZ1x5tVgZ8yzWgid829g7FYUUvuZfBC6+KSsG2t+NT/D+DPh58vntMoX5H5PfGd1K9Xu1eBEQlpCQd8sFmz1NfUDYsTm5vx2RxQGEw8l6EmhRoz5dThPjudtuv25IM2Bxa9pWptz+8IB8wXw5vxtNhDGtDdfI9X6IM6pAKA4rhqKyt8Gsiq+FJOHCayQMisy5wqNZ5MPjEa435nTvMqpZoenDVKGUaP+JWu96x5to0A7hWDU6ygIP+KMHChyG4hqWrUXX80TgYVqTv1qLZ8klmjqfDKR2+ttIFcSDSfCjczg9AMRC0dNze739PXa8Hl3q+CvZkJX6kPW5YJUJJKcjPkGsubJ+xsoN1rNFipwwMs1/ASh0BKIba5jPfMbauQW3a9g5O/jGBTaGwXz3NRi5fco9BI8/EiGQc1JV3YOUhDPjk80meUg1xXnrbkgIxkx3pnCuXizxbLBvHNqOtVwVr/6obKxAzyHJDwAtAIky7K/LR+Z1dczujIw8cTcoWQWFw8sGuctMfswRJDa3K24buoNBfjsCFJgy/LhYgf9tlZoEA4/E3jruqlnIcLvL1Lv1sHE+2rjnVpxYmRx5MWXMYCS/hzE4KiIZyHOi3OY1sIEbwELZ0wBdHUNoVD7TnZN0YvddLQbcKhA48rhhKAahq5fbG+I0rCH8w8gB1Kyk0M2MsCf/XAtEywAB6CJNwjKWBBO0teXTLqcD3mL8QZfF3hLVTkxDkT1U4ZfSptqlUWKsi8R38rvZX9cLHKU5+SDeTwfbTj7KD4G3+LQpDxFIHEBZtLzMtQcJe218wxsOXUkZv/5h7gtKR6X0YX8gG+YY8LIkmg6Tj3Q4AlMt/JpMEePLSFfDnwX4Fo1L8/bxdtYbK3HoB4a912VoubzZMxbpW0pXnKYJxti1FdZw0s1dawzHcHu1sNTbJKpKE1GBgho/p/ZhP3d7/L9RQjSKtyFaqFdph+huge5p+xEhAKm84tNMJkoTVnLtkcpfmb4VLtBEK+8HkAwVLBw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9043 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B9A.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9bf10a67-cd13-42e7-e606-08dc9a0a59b3 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|35042699022|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BljZHOpV5ZAk8vL7cVaM5OSX/tB8+Q/?= =?utf-8?q?HG5n7UursSEyy2jemOIm/wEXVjWYz0tj3O6/iTb7FC2qfPZ/RmjiX4tuB9COuHT4M?= =?utf-8?q?VVTZWJx6T56QQgTdz5ck1RzmcTfI+Hs683+siQRTK02V+Vlx6+J2VwtIssts+lc0P?= =?utf-8?q?UtTGTTKA+KQUudVGTF5jJS4VVYT5+GiFA+m+Fquk5f6tSEZtsJkn1kcIjK7Lei8ac?= =?utf-8?q?clwrVi4+/8YYC4M7NbRA5MWUHTe+TQrJJEDH7K1KkBcxl0N6QB/8JWuqHOwD8jXmb?= =?utf-8?q?bmBZk+LGAoIZfN/onoS5rRe0jw1Y2n/OdHdGjlkpPMO7Toa3kfnUeDBgvhd8mXGM5?= =?utf-8?q?lT0/IS6lYerv3yHjF9Zxo+jtN5f5D2pRGTwy4iuR/z3RkQpRuUB3KhvxqXOBlgc4m?= =?utf-8?q?iiMmazsjCfSYQOn9L4UEuPDbxL2Crq7bDptL9YufvGMJawKTgDWTqfMeIlhhSwyS4?= =?utf-8?q?dFm61pWLz5HEzSCm6ixRtozeeC3uGm8oRQUtADruSatI3LTgQfia7DgP+ptJdL1fG?= =?utf-8?q?g83MheZpmWiuGHSzOz9Gn4vzOTIkaCQF0+FwhPqboDMVwtie7zvhuc4i2eVpsnGRq?= =?utf-8?q?uLq+2EHn05/ctXvWSDUwXVv4WrHCjLddtIi/Quef4zDHelRv2WDiz5XHsoP1Vt/De?= =?utf-8?q?miXJcV1dqdSKoILVSL/uJvXAcQZGXfxzxke0jiWbLG27szDbBkiiPK24yTnT1VZbI?= =?utf-8?q?qaImeLeTWSRGB73/EgdeGD18UwIldK5ACywY7edZAn+agUHy/Q09/t9dGJLP1OoaG?= =?utf-8?q?GkeehFuIENJFqQXFj3vPut8jPEZdRVcJOFKqSXzm5hTM2plCZkB80wIMG/mSsr72F?= =?utf-8?q?eRq/8pSJnSgZgJZs1IrUrZ630UuIOREC7BKO6c2KmC8ZNhbeciZPEMpq7g7ev3oMJ?= =?utf-8?q?+H5FCcrQ391bmXlr4sHcNtI7/fi1LIMuJDK3xJK4G73CilZSgNyMVyjpNhyI1CgO4?= =?utf-8?q?AS0DLL3GbQw6jlprijn6yJja13OVT5xvuechf6DV6D0+SGFby06fp3/TZjW8LjrQa?= =?utf-8?q?R1peioH2TstQWlOzVLpucYikj/CrSDP0gXWHvrWjIpMuyjCkWwsbfk83ZdplWnLg7?= =?utf-8?q?5NEcIBhumKsB7CAfXx/oygnHimcLlauL5RqxTjHP1bWlArpFEcebo636qywtUcrij?= =?utf-8?q?0gKJKvNcM84wX3yXaUoxbiH8ftafYCfi3XU4qQad0whJGi9XJWljAcl407+P6LZwO?= =?utf-8?q?wqiOnqwm0zNAhy2tjREra9/bHu50yXAekuRzu2jNzfMOUIhScSo2/D7mNRD+zd0Os?= =?utf-8?q?LnnQn7TM6ppvbZVQ1WlADpI3tyot93OnTMINc5bRSLjIvzupcyYiFo/SYD7fdTEe/?= =?utf-8?q?Q/eBdrDEVwe1R9TfuFVTu5KHdzjqyVBMSLK6O99if4ATUe5KmzppK7vqtHl6D7qrb?= =?utf-8?q?MxAtyFSay0d?= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(1800799024)(35042699022)(82310400026)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 20:14:11.6843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbcb66bd-aaf4-4ad1-783a-08dc9a0a5f2e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B9A.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9592 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Hi All, The current implementation of constant_multiple_of is doing a more limited version of aff_combination_constant_multiple_p. The only non-debug usage of constant_multiple_of will proceed with the values as affine trees. There is scope for further optimization here, namely I believe that if constant_multiple_of returns the aff_tree after the conversion then get_computation_aff_1 can use it instead of manually creating the aff_tree. However I think it makes sense to first commit this smaller change and then incrementally change things. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu -m32, -m64 and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/114932 * tree-ssa-loop-ivopts.cc (constant_multiple_of): Use aff_combination_constant_multiple_p instead. --- -- diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 7cae5bdefea3648ddde238a357af527a934a569e..c3218a3e8eedbb8d0a7f14c01eeb069cb6024c29 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -2146,65 +2146,15 @@ idx_record_use (tree base, tree *idx, static bool constant_multiple_of (tree top, tree bot, widest_int *mul) { - tree mby; - enum tree_code code; - unsigned precision = TYPE_PRECISION (TREE_TYPE (top)); - widest_int res, p0, p1; - - STRIP_NOPS (top); - STRIP_NOPS (bot); - - if (operand_equal_p (top, bot, 0)) - { - *mul = 1; - return true; - } - - code = TREE_CODE (top); - switch (code) - { - case MULT_EXPR: - mby = TREE_OPERAND (top, 1); - if (TREE_CODE (mby) != INTEGER_CST) - return false; - - if (!constant_multiple_of (TREE_OPERAND (top, 0), bot, &res)) - return false; - - *mul = wi::sext (res * wi::to_widest (mby), precision); - return true; - - case PLUS_EXPR: - case MINUS_EXPR: - if (!constant_multiple_of (TREE_OPERAND (top, 0), bot, &p0) - || !constant_multiple_of (TREE_OPERAND (top, 1), bot, &p1)) - return false; - - if (code == MINUS_EXPR) - p1 = -p1; - *mul = wi::sext (p0 + p1, precision); - return true; - - case INTEGER_CST: - if (TREE_CODE (bot) != INTEGER_CST) - return false; - - p0 = widest_int::from (wi::to_wide (top), SIGNED); - p1 = widest_int::from (wi::to_wide (bot), SIGNED); - if (p1 == 0) - return false; - *mul = wi::sext (wi::divmod_trunc (p0, p1, SIGNED, &res), precision); - return res == 0; - - default: - if (POLY_INT_CST_P (top) - && POLY_INT_CST_P (bot) - && constant_multiple_p (wi::to_poly_widest (top), - wi::to_poly_widest (bot), mul)) - return true; + aff_tree aff_top, aff_bot; + tree_to_aff_combination (top, TREE_TYPE (top), &aff_top); + tree_to_aff_combination (bot, TREE_TYPE (bot), &aff_bot); + poly_widest_int poly_mul; + if (aff_combination_constant_multiple_p (&aff_top, &aff_bot, &poly_mul) + && poly_mul.is_constant (mul)) + return true; - return false; - } + return false; } /* Return true if memory reference REF with step STEP may be unaligned. */