From patchwork Tue Aug 20 13:06:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1974407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=NasLGy4A; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=NasLGy4A; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp8rq2kM0z1yXZ for ; Tue, 20 Aug 2024 23:07:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3C7BE386D60B for ; Tue, 20 Aug 2024 13:07:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20607.outbound.protection.outlook.com [IPv6:2a01:111:f403:260d::607]) by sourceware.org (Postfix) with ESMTPS id 16F0F3845140 for ; Tue, 20 Aug 2024 13:07:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16F0F3845140 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 16F0F3845140 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260d::607 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1724159231; cv=pass; b=FHmnRGZltIoVSrpAItKwoQCpJDo2j+flTV5OUVLt+5r5BtQF/ZNPqFtj9gRMs5fuyNxibMEwWsxGWxGiNctb/e18W7tKa+Wf86vj70tdBNKO5n5bJJPw0voH3C6Bji4hrnKY1AdfJ6Q5KemkSGYOrGNVS/MxpIea28UwLH8RFdI= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1724159231; c=relaxed/simple; bh=Izfcy3HxyoTW01/am+uOLhcZFnFP2xKmN8iYSc69v84=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=LlVqDhWa8pCLtO010++s00dqkiZsC22BEGGN6mLZY4TFJBxQeo9SnQyc0siq25k7fQHcTOnW1AxIxheA6l9cYAd1W58/OclpcyW4ddcG2FXkvwFYV5gbf6XZFczRYrVitsVoCudeWuN+XKg+wV3IpEjyAkLdHZR0Y2t79YVfU+Y= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=MDycce5tugM6erBvhT4qmEnX8EhrLphU0MQ1hQejsnTuA2Cmb4jAoiA2YN8JPsDxts5cqWRSH2mOD7yck0t378rr/ZlxU0mFA8rZ/bUakzrhOF2Hy5M+4on1euv22u1lXH+O82Z1gvrxUt/kPaMEhX2tTai5y00YpMbaexBhVxep8bSfu5HgXilMvhNMeIOGWWMYFoO/rEa+GYOHsL5j/Moy2tiY3bY/A9q14KtS9UkTaaE1zdBWndr3IBdlDSLWDIBRUAf7kJtzGeA2BpY+VjCnLhOozi2HCjbLzu6gIupqcydW4JTWcmSFkEyl/wz0uqEYvNZGs6JNw82tft5h7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=xLb1RFAdNRQNAa+yKdDQkj441D4TvxvZRS//dBDN7hM=; b=VjLa17vQQMm8EDM59emG8ue4C2FSoJTjJA1MjAWF3jdhM6+drMaE4tmpfVfZExO4h0SpAO1OloeBtIMnlB3FusVtofV69DwvNg8E0esEqsmScOebWB1cdQuMlNpBYKxDyPJiccke4GgRZuaNA5Dz05hYyYe+jKuanvZAyX0tqUzotvbOFNDvEEzgd0S+OMVa+RwneFzTBp/xHYz0WIZawqMHYNoQX3vm5QTQVNkMEzUheGpDOEpZKFoAN32mA35ioXiHoPvKtPKCAZ6xm5oqEsZxGMAn+zZsm+eT/cM4wgbM5dVgjsfVZlZGLoLOZIIjZ6NyUb58NoZheSyuCy5lGQ== 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=xLb1RFAdNRQNAa+yKdDQkj441D4TvxvZRS//dBDN7hM=; b=NasLGy4AVlApv298ONFk2MFzqFJ6zc7jW9Ve07BoehVpA4LWyanvlNB4nHeOxVCIOhl/CcVcUhCxQSXpdclpWp8ZZq20JcHwfofYTN+Z5DlD/c151gOGoIpJjJta27v42qPqtzcWTbta1kYTtaQ3BiF/GhIOMvGK3teUPH02hKc= Received: from AS8P189CA0038.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:458::13) by AS8PR08MB8466.eurprd08.prod.outlook.com (2603:10a6:20b:568::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.12; Tue, 20 Aug 2024 13:06:15 +0000 Received: from AMS0EPF000001B4.eurprd05.prod.outlook.com (2603:10a6:20b:458:cafe::b1) by AS8P189CA0038.outlook.office365.com (2603:10a6:20b:458::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25 via Frontend Transport; Tue, 20 Aug 2024 13:06:15 +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 AMS0EPF000001B4.mail.protection.outlook.com (10.167.16.168) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Tue, 20 Aug 2024 13:06:15 +0000 Received: ("Tessian outbound f2759ff2c19a:v403"); Tue, 20 Aug 2024 13:06:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4bed3ec0878380bf X-CR-MTA-TID: 64aa7808 Received: from Lafc01e25976a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4DBF2D3B-4375-4636-89F4-0BBBEB424AEF.1; Tue, 20 Aug 2024 13:06:08 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lafc01e25976a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 20 Aug 2024 13:06:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YwqGGY5EWpIZukvbvRxuFrJ34vt/WWgDLHwJgVrD6ffuPY7onhQAIDQLF6PMVNzyNxYywudwLQjsGZVUHq/wj6Q6tQ1EigJdgn/EqCBwncVLovPhupEcaaPZDLvW9kpXO4yvxs2oLZiZ+eqeY/pNYvoKb8N8FC0dIdIMQfttfhiWC7o+VAgHy0embbgbD+WBvy6HmPQM71HPT3GABQG7Z7IRf3sWx2utahDPboWeZbg8Mqve4ZJPvFSTKfvK1CwTZP7gBgFZRUIxjZXbkxd1K9JlYzIfEciiH2w+DJ/r6UaqusqcvVenpFnYvm6ImXDCYeRu/vuSKVMprLxB92Lv8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=xLb1RFAdNRQNAa+yKdDQkj441D4TvxvZRS//dBDN7hM=; b=kK1r/ZB4deYMqkVEO1HDhIx4CMBdHG+L3VAw6RHe3m6F1nYc4yGf9mffj29nl8fm8qhcHvZ6SWs0VPSVGYuPvRfx8yaS2T6NGvCuXTj8F/+ROfAjd+8+6WqAyZGMa21s57heLjncV8ZaQ89Jwc/Y25BF47TK+tmLBgFPvRYI0LqstCauQaKkiKeICdN4LrIijoKSfuXBY2HZKfU4IquWQ7A25A2WuA2hXBPRJtLyy8rQpR2O2yCjwKxmIkYxm6OG+0oaWz5lztiODKo71dy3USjJtF0BKxmtntvlL8QaIntdAdten9vaIzSt9iKvPzLv5s2jlc69is6WZcGrBFbsXA== 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=xLb1RFAdNRQNAa+yKdDQkj441D4TvxvZRS//dBDN7hM=; b=NasLGy4AVlApv298ONFk2MFzqFJ6zc7jW9Ve07BoehVpA4LWyanvlNB4nHeOxVCIOhl/CcVcUhCxQSXpdclpWp8ZZq20JcHwfofYTN+Z5DlD/c151gOGoIpJjJta27v42qPqtzcWTbta1kYTtaQ3BiF/GhIOMvGK3teUPH02hKc= 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 AS8PR08MB8779.eurprd08.prod.outlook.com (2603:10a6:20b:5be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Tue, 20 Aug 2024 13:06:06 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69%6]) with mapi id 15.20.7897.010; Tue, 20 Aug 2024 13:06:06 +0000 Date: Tue, 20 Aug 2024 14:06:04 +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: refactor type to be explicit in operand_equal_p [PR114932] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0092.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::7) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AS8PR08MB8779:EE_|AMS0EPF000001B4:EE_|AS8PR08MB8466:EE_ X-MS-Office365-Filtering-Correlation-Id: 8df05cc4-b6a6-45d9-eceb-08dcc118dfa5 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info-Original: bapsUH6m8TXGJ6h+M/FyKSjr8tAGZ8hd/lPpYHA8IVjHkdJIAX07t+4GgPxIRw4xTQSgI7YdK5H2yOgfHU2fUSIn4ys5AhhlJCPansA6CBeUnzYEQsKIstO1KvFujUI1IchaJR6Fi/juv9wE+OpGE6GRNAFPPM0gdUNezvFUPG0hBLjiwf3x2GpdY1ipCrgCTfquqOLPGAmwKgbQs2wiJ3oxZLTq/MmF0uDXZz0/QdMRi4bnzIhxbWqMsVT+aQZh5JX3fe1fjsHhHFSn6HfDiYVGk58Hj1Z6gNSjBQTyK23Y++NcH3jD1VWR8Cc3MHUItx3+BEF1iGgOKgDCyrQSqr1IgSG9ki7xczWyF82hmHB09eS8IY5tHGotVmPfCv39cr1aFWQ3hPk4P2WhxqFeEnsaXpaR2C4xmlrj6wtnQDdKAelO95r5yt1yySJJNFy/9RZZUyVeRB0hWtVLd+OLhdbgRxfDG1X8koNyuv8qEK+aHr766TeBcUFyCcryr2VRMS3btuIFSO+UNS5Qk928Y2LLLZHBRBD+eTyjVP4sODH3LkqqujtA2r65g+clXbMQYuSrmQNlvEErn2IzadvkxZwLtZ6qgO6O0DEIYSbt8H97mIfpisvjyyo89K5fCHmPxA7ORo7/cBC4p8wE/vkDjEeWIHuGaZvsOChfy2epyZZO9ZkKMuJcaq7zJYwyZ1ekmpW8lFwYAo3Fw0jAZ7OBppyX39x/chyboT1ROSq5mBuH8+BrS3as0ShRwtLC8AG1Ago7MkUefW0i9lzt2yPXYdRiU2de7e9B7B8lMN65dhlWFkkNLzkMQK0/rEm2HPUBE0nJFcRuonC65k40W1JEQitWdBr6VgtBeEw4tbj4uhDvGscNfeMuONt/r/WTmT0jFKTjteXPXeQ7Ik8oL/SjUUR8JJbpwMXqWjRA8JcZ9t9kquOdXeMSQHaZhXe5md3IK61P2k4pGiZ0+gyZREnIylDM2rlrqs7f8bG0hMxV9AADsYOO1xR07LFNq2tWWHPAhg+PFtWxhlFXv0Mz4NLrVnZKLRGFiQ+YqbabKXR/vPJgeq//ZJ9QBfWjMFgb1JPsKI1jQ0pDSGKhX7tDYu3JBa1SWwsVuiWSgN20MMJwyo5xrJlTpxluuttJ2QewGrhyURPkn8IeuB4ba2oxlZcKubkSr1jzfpUwIK2eoMZBWM2xuqyugxHB3FSdoNuctNW8Liy9QPHcw/MVyxtTmI6mP2VekEghGzspfgLT1ClYYAywJCrBzpwZRutVNLaqZcGHQxYODXiNEWEcHllWAx5AtJdMH527XbPRosTImRH70EzZE5AJuXzYiaYqSHZRd2HCu7CRByQSuuFOwJVt6qjPwg== 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)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8779 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-SkipListedInternetSender: ip=[2603:10a6:803:13e::17]; domain=VI1PR08MB5325.eurprd08.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001B4.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f498df7-479f-4ddb-6ac3-08dcc118da17 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|35042699022|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?REUOfdwwKsl4Q5Ln/L5hUrmrRUpVaiz?= =?utf-8?q?mKrqJqs6Ww21qEu3BxApaY6JYn44XBnXoZSFHO61dEwLdziMcWJe/mwRJ1NIqKbvw?= =?utf-8?q?uwWQ0sLVn+7BKh3CFUSM04AZoQn7FU1px/z8nH7DIkUdJbAnQ+PYU5TSmolh904Xz?= =?utf-8?q?GRRKHexS4c7f+70y2wKjzKaT0uBegvCnoQHEmxvou9jccSVL1wqcuFAPY03+Fjmn+?= =?utf-8?q?Giv/wX6RHzO2XbbjZcKoIvgoPsmIqOTpPwY08fbXGvHjFk5HhINtYGTElNpaF91y/?= =?utf-8?q?XNcfMlr64K0q25QBLuf+lughfC3JkHmUH1FXuZTAeCywAGHJQEmv+6jf4xlp8+Iyf?= =?utf-8?q?BkwetrlwCxht6m19k1zl5IUeP6L+VpLNTy+Pw5qF9/V51xOPKHLWMUPCE932jHKRl?= =?utf-8?q?4Ef0d9J35x0Tax5YLbHjDsnm6xCnR25szPPsqy/NuNm0yX1x7VNuAZx4Gri8c0dfz?= =?utf-8?q?JTOWjGp/o/fo1KJXkJ696Vmssn74A8aq5vqeVeHv6zdatugy2R3bkwZqUH34UA6zW?= =?utf-8?q?3jLbgvuxuEOZmW+F1fcIZIo9RBHozanv/bdNvEymFDpebrt7gVZPBovMEkrESnb8V?= =?utf-8?q?WAnGum/49rqsMN0oXevfLhMZICsTn5WOMF/Eym9JrnFnv9t8xGcIyoINdNnBDsO7C?= =?utf-8?q?4ewBtnq4xet8zKbJIB6gNu2uP7qazpR/b1+SYR9wGcTEW96NzUatYYVmzEW/c+MjO?= =?utf-8?q?eoSh/WC7XBdmbjlCj3tOA/ycYWfqP9IjHwBEOUudfpws6uZz/f6nB0x4nPb8xx91q?= =?utf-8?q?2Bi4pUk14AeUwIC7fAKKTZJyE1gF9aAPZj6lXuTXscPbQMatiRkw/gO48G4/YsRwv?= =?utf-8?q?kP9a3oxpGXKW64+2hCcRNy+qeFjA2nNHCNN8iTzq6EwHoOBkBLjYkw4XXeeiZAPLO?= =?utf-8?q?Vog2LCLYkenZr7xgSPC+iS+nHlw3RpIZYLFEgRVMklExcM2Xy6cvJ4tiExUl3+Uu/?= =?utf-8?q?CHqieosCR2465/JOXcqxl71wU2m3MYQynTJFpu2v0KHVH/Z9qU+1o+m2fZEoGieUz?= =?utf-8?q?K/fRf0Gzge+4ZCh953v9lHm4kqCz22br8p6KgJUjda/pAZ1HMGOBbngLOh4b9pMJ8?= =?utf-8?q?PH5NtwWELtChkgvhGxiyhKribg6I4qLI6/PfAO1+vuedfwGEOFXYi7H71kRFeLYoK?= =?utf-8?q?Aa4REhXF/bMgEGTny0gNUPLye35blBX9y+MFxOJbjFxvgD4hYtDAb722PkJ9989RF?= =?utf-8?q?v7pVFfCz8G2+baedP8Qjdh8l9caNglVIcmsvtpF2M7EUduw4j642jpFyZQdrENYss?= =?utf-8?q?SiJwU+nWZkjjY8nHLnpoQ8P4CYF2pHQX2ABAYA7la/dyyQ8Jf871j8lxIVrV4+jin?= =?utf-8?q?vmtc3V4xwprIr/FdkgiPmRlVzRFLr+iwbpy2N93Jcd2wvDTENrYI3rfp715fKATpa?= =?utf-8?q?ReLgTVOV/UD?= 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)(376014)(1800799024)(35042699022)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 13:06:15.4711 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8df05cc4-b6a6-45d9-eceb-08dcc118dfa5 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: AMS0EPF000001B4.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8466 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, This is a refactoring with no expected behavioral change. The goal with this is to make the type of the expressions being used explicit. I did not change all the recursive calls to operand_equal_p () to recurse directly to the new function but instead this goes through the top level call which re-extracts the types. This was done because in most of the cases where we recurse type == arg. The second patch makes use of this new flexibility to implement an overload of operand_equal_p which checks for equality under two's complement. Bootstrapped Regtested on aarch64-none-linux-gnu, arm-none-linux-gnueabihf, x86_64-pc-linux-gnu -m32, -m64 and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/114932 * fold-const.cc (operand_compare::operand_equal_p): Split into one that takes explicit type parameters and use that in public one. * fold-const.h (class operand_compare): Add operand_equal_p private overload. --- -- diff --git a/gcc/fold-const.h b/gcc/fold-const.h index b82ef137e2f2096f86c20df3c7749747e604177e..878545b1148b839e8a8e866f38e31161f0d116c8 100644 --- a/gcc/fold-const.h +++ b/gcc/fold-const.h @@ -273,6 +273,12 @@ protected: true is returned. Then RET is set to corresponding comparsion result. */ bool verify_hash_value (const_tree arg0, const_tree arg1, unsigned int flags, bool *ret); + +private: + /* Return true if two operands are equal. The flags fields can be used + to specify OEP flags described in tree-core.h. */ + bool operand_equal_p (tree, const_tree, tree, const_tree, + unsigned int flags); }; #endif // GCC_FOLD_CONST_H diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 8908e7381e72cbbf4a8fd96f18cbf4436aba8441..71e82b1d76d4106c7c23c54af8b35905a1af9f1c 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -3156,6 +3156,17 @@ combine_comparisons (location_t loc, bool operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) +{ + return operand_equal_p (TREE_TYPE (arg0), arg0, TREE_TYPE (arg1), arg1, flags); +} + +/* The same as operand_equal_p however the type of ARG0 and ARG1 are assumed to be + the TYPE0 and TYPE1 respectively. */ + +bool +operand_compare::operand_equal_p (tree type0, const_tree arg0, + tree type1, const_tree arg1, + unsigned int flags) { bool r; if (verify_hash_value (arg0, arg1, flags, &r)) @@ -3166,25 +3177,25 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, /* If either is ERROR_MARK, they aren't equal. */ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK - || TREE_TYPE (arg0) == error_mark_node - || TREE_TYPE (arg1) == error_mark_node) + || type0 == error_mark_node + || type1 == error_mark_node) return false; /* Similar, if either does not have a type (like a template id), they aren't equal. */ - if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1)) + if (!type0 || !type1) return false; /* Bitwise identity makes no sense if the values have different layouts. */ if ((flags & OEP_BITWISE) - && !tree_nop_conversion_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) + && !tree_nop_conversion_p (type0, type1)) return false; /* We cannot consider pointers to different address space equal. */ - if (POINTER_TYPE_P (TREE_TYPE (arg0)) - && POINTER_TYPE_P (TREE_TYPE (arg1)) - && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0))) - != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1))))) + if (POINTER_TYPE_P (type0) + && POINTER_TYPE_P (type1) + && (TYPE_ADDR_SPACE (TREE_TYPE (type0)) + != TYPE_ADDR_SPACE (TREE_TYPE (type1)))) return false; /* Check equality of integer constants before bailing out due to @@ -3211,12 +3222,15 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, /* If both types don't have the same precision, then it is not safe to strip NOPs. */ - if (element_precision (TREE_TYPE (arg0)) - != element_precision (TREE_TYPE (arg1))) + if (element_precision (type0) + != element_precision (type1)) return false; STRIP_NOPS (arg0); STRIP_NOPS (arg1); + + type0 = TREE_TYPE (arg0); + type1 = TREE_TYPE (arg1); } #if 0 /* FIXME: Fortran FE currently produce ADDR_EXPR of NOP_EXPR. Enable the @@ -3275,9 +3289,9 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, /* When not checking adddresses, this is needed for conversions and for COMPONENT_REF. Might as well play it safe and always test this. */ - if (TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK - || TREE_CODE (TREE_TYPE (arg1)) == ERROR_MARK - || (TYPE_MODE (TREE_TYPE (arg0)) != TYPE_MODE (TREE_TYPE (arg1)) + if (TREE_CODE (type0) == ERROR_MARK + || TREE_CODE (type1) == ERROR_MARK + || (TYPE_MODE (type0) != TYPE_MODE (type1) && !(flags & OEP_ADDRESS_OF))) return false; @@ -3364,8 +3378,8 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, return true; /* See sem_variable::equals in ipa-icf for a similar approach. */ - tree typ0 = TREE_TYPE (arg0); - tree typ1 = TREE_TYPE (arg1); + tree typ0 = type0; + tree typ1 = type1; if (TREE_CODE (typ0) != TREE_CODE (typ1)) return false; @@ -3444,8 +3458,8 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, { CASE_CONVERT: case FIX_TRUNC_EXPR: - if (TYPE_UNSIGNED (TREE_TYPE (arg0)) - != TYPE_UNSIGNED (TREE_TYPE (arg1))) + if (TYPE_UNSIGNED (type0) + != TYPE_UNSIGNED (type1)) return false; break; default: @@ -3481,12 +3495,12 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, case INDIRECT_REF: if (!(flags & OEP_ADDRESS_OF)) { - if (TYPE_ALIGN (TREE_TYPE (arg0)) - != TYPE_ALIGN (TREE_TYPE (arg1))) + if (TYPE_ALIGN (type0) + != TYPE_ALIGN (type1)) return false; /* Verify that the access types are compatible. */ - if (TYPE_MAIN_VARIANT (TREE_TYPE (arg0)) - != TYPE_MAIN_VARIANT (TREE_TYPE (arg1))) + if (TYPE_MAIN_VARIANT (type0) + != TYPE_MAIN_VARIANT (type1)) return false; } flags &= ~OEP_ADDRESS_OF; @@ -3494,8 +3508,8 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, case IMAGPART_EXPR: /* Require the same offset. */ - if (!operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)), - TYPE_SIZE (TREE_TYPE (arg1)), + if (!operand_equal_p (TYPE_SIZE (type0), + TYPE_SIZE (type1), flags & ~OEP_ADDRESS_OF)) return false; @@ -3509,15 +3523,15 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, if (!(flags & OEP_ADDRESS_OF)) { /* Require equal access sizes */ - if (TYPE_SIZE (TREE_TYPE (arg0)) != TYPE_SIZE (TREE_TYPE (arg1)) - && (!TYPE_SIZE (TREE_TYPE (arg0)) - || !TYPE_SIZE (TREE_TYPE (arg1)) - || !operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)), - TYPE_SIZE (TREE_TYPE (arg1)), + if (TYPE_SIZE (type0) != TYPE_SIZE (type1) + && (!TYPE_SIZE (type0) + || !TYPE_SIZE (type1) + || !operand_equal_p (TYPE_SIZE (type0), + TYPE_SIZE (type1), flags))) return false; /* Verify that access happens in similar types. */ - if (!types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) + if (!types_compatible_p (type0, type1)) return false; /* Verify that accesses are TBAA compatible. */ if (!alias_ptr_types_compatible_p @@ -3529,8 +3543,8 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, != MR_DEPENDENCE_BASE (arg1))) return false; /* Verify that alignment is compatible. */ - if (TYPE_ALIGN (TREE_TYPE (arg0)) - != TYPE_ALIGN (TREE_TYPE (arg1))) + if (TYPE_ALIGN (type0) + != TYPE_ALIGN (type1)) return false; } flags &= ~OEP_ADDRESS_OF; @@ -3802,16 +3816,16 @@ operand_compare::operand_equal_p (const_tree arg0, const_tree arg1, indexed in increasing order and form an initial sequence. We make no effort to compare nonconstant ones in GENERIC. */ - if (!VECTOR_TYPE_P (TREE_TYPE (arg0)) - || !VECTOR_TYPE_P (TREE_TYPE (arg1))) + if (!VECTOR_TYPE_P (type0) + || !VECTOR_TYPE_P (type1)) return false; /* Be sure that vectors constructed have the same representation. We only tested element precision and modes to match. Vectors may be BLKmode and thus also check that the number of parts match. */ - if (maybe_ne (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)), - TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg1)))) + if (maybe_ne (TYPE_VECTOR_SUBPARTS (type0), + TYPE_VECTOR_SUBPARTS (type1))) return false; vec *v0 = CONSTRUCTOR_ELTS (arg0); From patchwork Tue Aug 20 13:06:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1974408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=kRMnnwf2; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=kRMnnwf2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wp8sX0s2vz1yXZ for ; Tue, 20 Aug 2024 23:08:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3125384515A for ; Tue, 20 Aug 2024 13:08:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on20631.outbound.protection.outlook.com [IPv6:2a01:111:f403:2607::631]) by sourceware.org (Postfix) with ESMTPS id 0A5193846092 for ; Tue, 20 Aug 2024 13:06:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A5193846092 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 0A5193846092 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2607::631 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1724159204; cv=pass; b=XNai3GSu4U0zPWcB7mrjFHDatnvXskT9o+IEGqPmQRw6bpX+HYXKDyCikopbqqmhpR9ixhzSIHTG791NpYuKOydiJbvnJ/DqpORojVy95cHMGdk7FBDxJC9dIZkQp3ikT/Rcn347t9QPd2VeAtZAXYz3zTXLrCoCqtYiZCSGpWg= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1724159204; c=relaxed/simple; bh=UgKnITeajEuBnzSILrFApYpJWIe4YLocyqwGIUUpFK0=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=eCgubNfAONh13GPPd5dx8q0G6xPMNLh7sT8SEfsbihq/j1/7tvIRmV1HnXRo8VE5m+9iraWoM+kj+BLa8wrZ3xaCv8qT4wt4RKdc4CneTOs3qpHhyNzdvERJt19RwMCzVTh4+Cmvl5lfVljAc7MMu8ncsD7ovVFm/TH7+sppRQ8= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Ycp/QbS5nLQjU2Mj7rSVOfboNXqyk27Q61e4PfdXOnEQj6xuhAfQ3umvw56YzkVAZOK/fLBmk7BFnOH88B9ubUx/4LdFPbSebdMinMraMJS6j2DV36afTom/OF5ZUwA54fb9rKH9CDk+ZrRETptP6ABffRVj8hGZdyRA84Czwkkm/6kfTAy7F21wHagcldygLBT+tmdsann8aA6OfVtjEYpaMgH4jn8vdg8bpwg1KJWkQmrJwgzQ7mxdOHfvMGU1beO7M2RPuwgHxF5LGXnHxkPxj/VM6oziAUMDrBifmc1TIu0FVHpEAT5ptDKYma6R7J+N0wLEpDYXS4s8jOdyxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=n+Mr/IhxBhLWvytmhTbyNmYnfHa+ifB4sj8rEReW4Qs=; b=k5p/oOGSALo6KdId6IIv7pDX+Qw8Vh1W8ldYt0YHWC61UUsyxWmXkQ3AA19Q3hVnbI+m9gJ4Sjg4C2/qNp6uNgqFX1POo0zz/g7pL5v/lSZJ1Mux7+ke5AOhkJI//dA8uuz3o2iYQia0vZvDCxOhgCDM5eQOrKVEGxmMyW0p7/izjI+Z/NZ8JlFUfheXJpFr/npe8f/j5fw5pNt7H3LH2z+pIdR/SUl8hPgaKRdwYGu10rMAGOO0+iKS+c4resjjLuVDjOc9GevGsGJq1Rbbpa9Trh9+6+OVpL1bIZp/QZjfKNDoeIY4oR8mUaFLWHFT1Kn8QEIz19Z634i7os+kwQ== 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=n+Mr/IhxBhLWvytmhTbyNmYnfHa+ifB4sj8rEReW4Qs=; b=kRMnnwf2mW8birxw5dbRKiQNHy3w8w5mhaZXca0vyajtl7UraV8TQ1KoxEUZ9dMdMk3FGpER5JwuMZ1YtCSthpU22ozYZP/mlXvU3Ay5tYL+1kpyuuc2kQWKrbLjM1V7JbM9hq/OvDmcrKUkgWQ/t+YDzhXufyL97QGfNQmamkI= Received: from AS9PR06CA0380.eurprd06.prod.outlook.com (2603:10a6:20b:460::34) by DU0PR08MB9726.eurprd08.prod.outlook.com (2603:10a6:10:446::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Tue, 20 Aug 2024 13:06:34 +0000 Received: from AMS1EPF00000046.eurprd04.prod.outlook.com (2603:10a6:20b:460:cafe::4) by AS9PR06CA0380.outlook.office365.com (2603:10a6:20b:460::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Tue, 20 Aug 2024 13:06:34 +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 AMS1EPF00000046.mail.protection.outlook.com (10.167.16.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Tue, 20 Aug 2024 13:06:34 +0000 Received: ("Tessian outbound 3d5aa05142a5:v403"); Tue, 20 Aug 2024 13:06:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1f3c93d401798709 X-CR-MTA-TID: 64aa7808 Received: from L510b4abee8e7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A4289071-2A92-4F88-B5DE-EBF2D5910BFB.1; Tue, 20 Aug 2024 13:06:27 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L510b4abee8e7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 20 Aug 2024 13:06:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=amPRazzKivn9LhGtsdAtraauH/dOrHfCxOTajoqQxVifQHqz5/u8zzmjk5mnkT2M6y0kbSJmQgYiALsec1Vwx/3bYCEps7CgqbsdrNYF9S/pMTXsejhxI4n/MVowHjmd+Xgvfj/wepXwW+kWp5GNgXC9sas6frsJi0QoG5iNOy6OkY2Wmu87J5/Za6/djRZO+BZrfwricjgCbF7dCkHlvdox5VjwzZqbUfeIMcc9joBxxsKu/mrZGJDIVpOxBZ8LOgbv2BnmNvJrULGPNajrnz3APKOd6uuTkcKH0AXufz5ryX256V73Mt1LcxQOqyzi6udicLTDs+Bxm29jQOgBpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=n+Mr/IhxBhLWvytmhTbyNmYnfHa+ifB4sj8rEReW4Qs=; b=Te7PY/nrHPD/V+dPRP7asFDtZvluFLgrwVcjOR9naJ/DkBYcjtx/+XA1cMdNRYlZKq4JLquLTuvSYvOHkhUD2mNl4z8jjwSkjDhdoYKcz6VvGWLa3Xeu5gfFEg0bdDyzNX7rAaz5SpRdUo1C8D2ozK/X0YASfjqZvSXspSNPdsIMR/2vQ0LH/HNPIKXQ9Z51+cKtuM9JeU1adJWooG46VqszEYRifMJaJzPMIA6wnyXTg0GIObeijwsMDDJLK7rwKqMUso3/QGc2gJ5FeBz7bri0juGbavMbGV4MHnrMb3muZgj2JIkta4V2d5FkDChlsuuDyJ/pwwHw83N/z/8eYw== 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=n+Mr/IhxBhLWvytmhTbyNmYnfHa+ifB4sj8rEReW4Qs=; b=kRMnnwf2mW8birxw5dbRKiQNHy3w8w5mhaZXca0vyajtl7UraV8TQ1KoxEUZ9dMdMk3FGpER5JwuMZ1YtCSthpU22ozYZP/mlXvU3Ay5tYL+1kpyuuc2kQWKrbLjM1V7JbM9hq/OvDmcrKUkgWQ/t+YDzhXufyL97QGfNQmamkI= 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 GV1PR08MB7827.eurprd08.prod.outlook.com (2603:10a6:150:5b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Tue, 20 Aug 2024 13:06:23 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::89dc:c731:362b:7c69%6]) with mapi id 15.20.7897.010; Tue, 20 Aug 2024 13:06:23 +0000 Date: Tue, 20 Aug 2024 14:06:21 +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: use two's complement equality when comparing IVs during candidate selection [PR114932] Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO2P265CA0367.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::19) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|GV1PR08MB7827:EE_|AMS1EPF00000046:EE_|DU0PR08MB9726:EE_ X-MS-Office365-Filtering-Correlation-Id: ffbbb1c5-dcae-4650-ecbe-08dcc118eae3 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info-Original: MXN8QlUF2NuguqiGfPEDZUBZLGm0vuxGYAKAED/NVTBmbY4V93bb96RmESzYCLFTmdwDM0fdsohl3D8me3Mgmg7mOj/MT2GVSBzDOF6pCdMtWZuCVQ3XpNk1QfLt6mIqde7/vrMZd7qwegRwZHBViBzsNsCpVGIdNwhOCbZA9wPL9glZheaR0ohYP4ZkSiKyURWwQsbcQXeuxM9BB0gDExWuE4WyFeGyNciA9ihe2FajS2DqX5lrEs+hvqmu0/EUrQnD31Cq8HszTehEpk+cAOJzY1cYzJbNxFSd7OQ1Xaze5QGeRCCJWjtDTEjGmbIBOY9BdVzVi3aeTLqMmG4vxvMibCz3x1XA+Ou1NrETghAXilv1xJsd9D0P6ebrkRQXtZtfvpSK6pq30PcZiYGID8gbWW35ODsIK0gxgWD/mDC/vdXZS8sBRPTkPmrK7WgbFP/xWGVycdwdaQiL4ZzdQubWAb05gzerIHn1IsHCHgDyIPAsQhnVuHD79KL3xqjbsY2d0a4DOan/Z5+ekdfTCrxKra239mU5JUqc9yJqti813eQlhGW+LuGuzugzeBc8GPxe8N09HXYwDvnjZIzlnc+zguWdcl5bGhlnNUvl5wJhaKw1/XKQrmVM8CNyxpHTZXYcxvVGZFBKMVdv4O0vQCtaKSF0+WZSgOEy7+sCLTTA8sues/bElINnhRnNLQb630rpLP0YnWISOwXadfJMLv3+SLORTaCGKXXvXMUhhCu70izB4LbduTbLP42UCwNQFzMSYzSWGeP6+P6Ne51RKtXZ/X6f6yz4KmxCLNrKRXTtRfYw+09pdl8myOQNDuG6awFLaHY3aWMHRilpGdv5REoKSX4bg/+8K01Up5utt0wnOkV3q2Kjjs4pjuHEpQ56VHQwrO+9yAWRzFFn3cV3IDnZMXFDoNcwgO+nJK+w2XnrzmLvhLFIgmMi8begUmZUD2KwsVnApXR8gse8uEvoJt87Cjdq1RtIuTbx7EPMhEpaQhZTx49zNDD0DgwzWQBOrEBykkBUyTHvnMGukueDwZz0fRTyRAUwK7Q6/xvYNBMAujw5JT0+tfCqmwgM0qOrsZxAzIrI/fSgU+VeFywyFxrxgd0L0occ6jzlKNDAJlMoJJzYXnoscEZl5UU4bJ0VHPo1VNVahocVjiwgkbG/FyCdWCihV2MQFHRE4yNplp0Q+ahN2pbUV8bjzkDijUisDGxaCUpevNcWdoPsKxxdiXvHcJ/hHb4690AHrFOQsY4TsIsrbLxtim2p+37h6s+xzvVJxOww0jIOIkAnbHhrosuC2J5yqjYf1o+hd6M+7ZM= 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)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7827 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-SkipListedInternetSender: ip=[2603:10a6:803:13e::17]; domain=VI1PR08MB5325.eurprd08.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000046.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ddc3dd94-d0db-4f32-68de-08dcc118e423 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|35042699022|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vjxOL91v4RPGDus1qLAJkW2IYxGctmw?= =?utf-8?q?G/g3ueqPHU5JSVJCGyaFXjneCr+Bd22SKhy08l3+UIgXl49jD7YdYmTMnmGODECLx?= =?utf-8?q?EDQOJfJ8+YxfKwiZck4ygZNtMkU7kozl19KSktgq6BmQrKEzWDPDaokHg39+Q+oXv?= =?utf-8?q?qcC2evaPXqyRxz27Nc+VnZUDYgXfQXtIxPr6WBvLrWogNX0w0DYmhn4f12QNY+2GP?= =?utf-8?q?CXWqkDTyLjsEDZ7V2ZCDcgSL1famkW+Yni7bVHFpFoldZFFXfKtYZZEv0lIkhQ5Al?= =?utf-8?q?EyopH3351TMoumwYkhTSEdQHEvGBTXV+PCoV8L1rzeCANvXp9+AfZDemj/klDGNsX?= =?utf-8?q?m1D5D/ntKmVOezoNQ0OmOkQuNV7r46w27MJt3wlNsrcYJjX3E+pZpxoUv98ZaGCdL?= =?utf-8?q?czDLaAlaHGVYi6Y3U/oZ20CpK97gWqtihvMbdPjmAV0kviD4yxfWFozlqOOOiwxig?= =?utf-8?q?UP2NwGDK+PcZXn3xwqT51f+TBwgip+LR0Sm9DouOqkakgiLgBq0vsCm3sHv0UgRcS?= =?utf-8?q?2mZLILP6BsQIAVWHr+Kd6zOc7m+My9uddjhmuM568RojYO6OYW2QN+/ME1yXWxDLd?= =?utf-8?q?E5pDvFDPCPsyVZssD0rc8TRuFNt65NCuacjNOvUksf3oqh7UOZVznkA3rG1WvJXlA?= =?utf-8?q?K2XWDlI12jjNO5RtSqwOoJZbQxAScCS8X6Dj2CfEfdTyvE6IDBCc4yPZRsfo4Ezgo?= =?utf-8?q?apfW/gBlKk6VnEAEMwG16fm/JE4kULvB1RD2PaICgi/puv10HVV3BJNEHZUNc2qNX?= =?utf-8?q?avlqLZNmQzrbY0fvDPppJ8LZ1n0YgikUAlbvCUZg6+XXkjmX3dTjKi+rQXmSR4P7N?= =?utf-8?q?gYmWG8E3ZGi8I0dGMOPD8lXVE4ldkL4oxGUueknoxLueF2vnsZ/OWWE45XOlqyiLT?= =?utf-8?q?d22j+LjTuri6HACedLGchw+JtoXtOixfR2Zmf2spZCh95+rIsCPmbMSvV2MEozLqc?= =?utf-8?q?3EZLvgswIIZpfaijPPh9ZmB4d/bUhAr6AxONT2HbPmja8qNu5x+fewJoQteTcnIR5?= =?utf-8?q?kw/5AwcYjna1bUpumFvNBIG5Ohr7/0j4PQADgAdoO3w9nVFT7PrMgtDpSGBTr344o?= =?utf-8?q?xB9LcELPkxS+uqjA/mXl64jwQKy4jw6TqoW+wrBfGCXgjUR5le0BblFlkxfNSroCQ?= =?utf-8?q?MFDKk8y1KCsZNXw6opokOaSdTqd1dVoBXFSs6r5UzwAULHNOJO3l7qz4pT9HvLPaB?= =?utf-8?q?3MmPIJGA3kolmr7ZM8AExYRtkCoI2PTERa86dfXdXOac15FKm+C/uVKJF11CtXelw?= =?utf-8?q?wzA8pWoHmvpfKDrS63TgIGkKbof+qI8Gt/bIaAmwmjnuJozEey1yCTk5phqFr2V9r?= =?utf-8?q?EB4WUoyWAMKrgIAQER3FCNjiWGKCxFtsEw=3D=3D?= 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)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 13:06:34.3168 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffbbb1c5-dcae-4650-ecbe-08dcc118eae3 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: AMS1EPF00000046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9726 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_LOTSOFHASH, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi All, IVOPTS normally uses affine trees to perform comparisons between different IVs, but these seem to have been missing in two key spots and instead normal tree equivalencies used. In some cases where we have a two-complements equivalence but not a strict signedness equivalencies we end up generating both a signed and unsigned IV for the same candidate. This patch implements a new OEP flag called OEP_STRUCTURAL_EQ. This flag will check if the operands would produce the same bit values after the computations even if the final sign is different. This happens quite a lot with fortran but can also happen in C because this came code is unable to figure out when one expression is a multiple of another. As an example in the attached testcase we get: Initial set of candidates: cost: 24 (complexity 3) reg_cost: 9 cand_cost: 15 cand_group_cost: 0 (complexity 3) candidates: 1, 6, 8 group:0 --> iv_cand:6, cost=(0,1) group:1 --> iv_cand:1, cost=(0,0) group:2 --> iv_cand:8, cost=(0,1) group:3 --> iv_cand:8, cost=(0,1) invariant variables: 6 invariant expressions: 1, 2 : inv_expr 1: stride.3_27 * 4 inv_expr 2: (unsigned long) stride.3_27 * 4 These end up being used in the same group: Group 1: cand cost compl. inv.expr. inv.vars 1 0 0 NIL; 6 2 0 0 NIL; 6 3 0 0 NIL; 6 which ends up with IV opts picking the signed and unsigned IVs: Improved to: cost: 24 (complexity 3) reg_cost: 9 cand_cost: 15 cand_group_cost: 0 (complexity 3) candidates: 1, 6, 8 group:0 --> iv_cand:6, cost=(0,1) group:1 --> iv_cand:1, cost=(0,0) group:2 --> iv_cand:8, cost=(0,1) group:3 --> iv_cand:8, cost=(0,1) invariant variables: 6 invariant expressions: 1, 2 and so generates the same IV as both signed and unsigned: ;; basic block 21, loop depth 3, count 214748368 (estimated locally, freq 58.2545), maybe hot ;; prev block 28, next block 31, flags: (NEW, REACHABLE, VISITED) ;; pred: 28 [always] count:23622320 (estimated locally, freq 6.4080) (FALLTHRU,EXECUTABLE) ;; 25 [always] count:191126046 (estimated locally, freq 51.8465) (FALLTHRU,DFS_BACK,EXECUTABLE) # .MEM_66 = PHI <.MEM_34(28), .MEM_22(25)> # ivtmp.22_41 = PHI <0(28), ivtmp.22_82(25)> # ivtmp.26_51 = PHI # ivtmp.28_90 = PHI ... ;; basic block 24, loop depth 3, count 214748366 (estimated locally, freq 58.2545), maybe hot ;; prev block 22, next block 25, flags: (NEW, REACHABLE, VISITED)' ;; pred: 22 [always] count:95443719 (estimated locally, freq 25.8909) (FALLTHRU) ;; 21 [33.3% (guessed)] count:71582790 (estimated locally, freq 19.4182) (TRUE_VALUE,EXECUTABLE) ;; 31 [33.3% (guessed)] count:47721860 (estimated locally, freq 12.9455) (TRUE_VALUE,EXECUTABLE) # .MEM_22 = PHI <.MEM_44(22), .MEM_31(21), .MEM_79(31)> ivtmp.22_82 = ivtmp.22_41 + 1; ivtmp.26_72 = ivtmp.26_51 + _80; ivtmp.28_98 = ivtmp.28_90 + _39; These two IVs are always used as unsigned, so IV ops generates: _73 = stride.3_27 * 4; _80 = (unsigned long) _73; _54 = (unsigned long) stride.3_27; _39 = _54 * 4; Which means that in e.g. exchange2 we generate a lot of duplicate code. This is because candidate 6 and 8 are equivalent under two's complement but have different signs. This patch changes it so that if you have two IVs that are affine equivalent to just pick one over the other. IV already has code for this, so the patch just uses affine trees instead of tree for the check. With it we get: : inv_expr 1: stride.3_27 * 4 : Group 0: cand cost compl. inv.expr. inv.vars 5 0 2 NIL; NIL; 6 0 3 NIL; NIL; Group 1: cand cost compl. inv.expr. inv.vars 1 0 0 NIL; 6 2 0 0 NIL; 6 3 0 0 NIL; 6 4 0 0 NIL; 6 Initial set of candidates: cost: 16 (complexity 3) reg_cost: 6 cand_cost: 10 cand_group_cost: 0 (complexity 3) candidates: 1, 6 group:0 --> iv_cand:6, cost=(0,3) group:1 --> iv_cand:1, cost=(0,0) invariant variables: 6 invariant expressions: 1 The two patches together results in a 10% performance increase in exchange2 in SPECCPU 2017 and a 4% reduction in binary size and a 5% improvement in compile time. There's also a 5% performance improvement in fotonik3d and similar reduction in binary size. Bootstrapped Regtested on aarch64-none-linux-gnu, arm-none-linux-gnueabihf, x86_64-pc-linux-gnu -m32, -m64 and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/114932 * fold-const.cc (operand_compare::operand_equal_p): Use it. (operand_compare::verify_hash_value): Likewise. (test_operand_equality::test): New. (fold_const_cc_tests): Use it. * tree-core.h (enum operand_equal_flag): Add OEP_STRUCTURAL_EQ. * tree-ssa-loop-ivopts.cc (record_group_use): Check for structural eq. gcc/testsuite/ChangeLog: PR tree-optimization/114932 * gfortran.dg/addressing-modes_2.f90: New test. --- -- diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 71e82b1d76d4106c7c23c54af8b35905a1af9f1c..52a4465de0355220befa6d6b3301e21e038e3e41 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -3208,7 +3208,19 @@ operand_compare::operand_equal_p (tree type0, const_tree arg0, return tree_int_cst_equal (arg0, arg1); } - if (!(flags & OEP_ADDRESS_OF)) + if ((flags & OEP_STRUCTURAL_EQ) + && (CONVERT_EXPR_P (arg0) || CONVERT_EXPR_P (arg1))) + { + const_tree t_arg0 = arg0; + const_tree t_arg1 = arg1; + STRIP_NOPS (arg0); + STRIP_NOPS (arg1); + /* Only recurse if the conversion was one that was valid to strip. */ + if (t_arg0 != arg0 || t_arg1 != arg1) + return operand_equal_p (type0, arg0, type1, arg1, flags); + } + + if (!(flags & (OEP_ADDRESS_OF | OEP_STRUCTURAL_EQ))) { /* If both types don't have the same signedness, then we can't consider them equal. We must check this before the STRIP_NOPS calls @@ -3439,6 +3451,22 @@ operand_compare::operand_equal_p (tree type0, const_tree arg0, if (flags & (OEP_ONLY_CONST | OEP_BITWISE)) return false; + /* Check if we are checking an operation where the two's compliment bitwise + representation of the result is not the same between signed and + unsigned arithmetic. */ + switch (TREE_CODE (arg0)) + { + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + break; + + default: + /* Clear the structural comparison bit. */ + flags &= ~OEP_STRUCTURAL_EQ; + break; + } + /* Define macros to test an operand from arg0 and arg1 for equality and a variant that allows null and views null as being different from any non-null value. In the latter case, if either is null, the both @@ -4218,7 +4246,7 @@ operand_compare::verify_hash_value (const_tree arg0, const_tree arg1, { if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK)) { - if (arg0 != arg1 && !(flags & OEP_DECL_NAME)) + if (arg0 != arg1 && !(flags & (OEP_DECL_NAME | OEP_STRUCTURAL_EQ))) { inchash::hash hstate0 (0), hstate1 (0); hash_operand (arg0, hstate0, flags | OEP_HASH_CHECK); @@ -17357,6 +17385,95 @@ test_arithmetic_folding () x); } +namespace test_operand_equality { + +/* Verify structural equality. */ + +/* Execute fold_vec_perm_cst unit tests. */ + +static void +test () +{ + tree stype = integer_type_node; + tree utype = unsigned_type_node; + tree x = create_tmp_var_raw (stype, "x"); + tree y = create_tmp_var_raw (stype, "y"); + tree z = create_tmp_var_raw (stype, "z"); + tree four = build_int_cst (stype, 4); + tree lhs1 = fold_build2 (PLUS_EXPR, stype, x, y); + tree rhs1 = fold_convert (stype, + fold_build2 (PLUS_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, y))); + + /* (int)((unsigned x) + (unsigned y)) == x + y. */ + ASSERT_TRUE (operand_equal_p (lhs1, rhs1, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs1, rhs1, 0)); + + /* (int)(unsigned) x == x. */ + tree lhs2 = build1 (NOP_EXPR, stype, + build1 (NOP_EXPR, utype, x)); + tree rhs2 = x; + ASSERT_TRUE (operand_equal_p (lhs2, rhs2, OEP_STRUCTURAL_EQ)); + ASSERT_TRUE (operand_equal_p (lhs2, rhs2, 0)); + + /* (unsigned x) + (unsigned y) == x + y. */ + tree lhs3 = lhs1; + tree rhs3 = fold_build2 (PLUS_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, y)); + ASSERT_TRUE (operand_equal_p (lhs3, rhs3, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs3, rhs3, 0)); + + /* (unsigned x) / (unsigned y) == x / y. */ + tree lhs4 = fold_build2 (TRUNC_DIV_EXPR, stype, x, y);; + tree rhs4 = fold_build2 (TRUNC_DIV_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, y)); + ASSERT_FALSE (operand_equal_p (lhs4, rhs4, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs4, rhs4, 0)); + + /* (unsigned x) / 4 == x / 4. */ + tree lhs5 = fold_build2 (TRUNC_DIV_EXPR, stype, x, four);; + tree rhs5 = fold_build2 (TRUNC_DIV_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, four)); + ASSERT_FALSE (operand_equal_p (lhs5, rhs5, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs5, rhs5, 0)); + + /* (unsigned x) + 4 == x + 4. */ + tree lhs6 = fold_build2 (PLUS_EXPR, stype, x, four); + tree rhs6 = fold_build2 (PLUS_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, four)); + ASSERT_TRUE (operand_equal_p (lhs6, rhs6, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs6, rhs6, 0)); + + /* (unsigned x) + 4 == 4 + x. */ + tree lhs7 = fold_build2 (PLUS_EXPR, stype, four, x); + tree rhs7 = fold_build2 (PLUS_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, four)); + ASSERT_TRUE (operand_equal_p (lhs7, rhs7, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs7, rhs7, 0)); + + /* ((unsigned x) + 4) * (unsigned y)) + z == ((4 + x) * y) + z. */ + tree lhs8 = fold_build2 (PLUS_EXPR, stype, + fold_build2 (MULT_EXPR, stype, + fold_build2 (PLUS_EXPR, stype, four, x), + y), + z); + tree rhs8 = fold_build2 (MULT_EXPR, utype, + fold_build2 (PLUS_EXPR, utype, + fold_convert (utype, x), + fold_convert (utype, four)), + fold_convert (utype, y)); + rhs8 = fold_build2 (PLUS_EXPR, stype, fold_convert (stype, rhs8), z); + ASSERT_TRUE (operand_equal_p (lhs8, rhs8, OEP_STRUCTURAL_EQ)); + ASSERT_FALSE (operand_equal_p (lhs8, rhs8, 0)); +} +} + namespace test_fold_vec_perm_cst { /* Build a VECTOR_CST corresponding to VMODE, and has @@ -18150,6 +18267,7 @@ fold_const_cc_tests () test_vector_folding (); test_vec_duplicate_folding (); test_fold_vec_perm_cst::test (); + test_operand_equality::test (); } } // namespace selftest diff --git a/gcc/testsuite/gfortran.dg/addressing-modes_2.f90 b/gcc/testsuite/gfortran.dg/addressing-modes_2.f90 new file mode 100644 index 0000000000000000000000000000000000000000..8eee4be3dc4d69fecfacd4c2e24a4973c8539fae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/addressing-modes_2.f90 @@ -0,0 +1,20 @@ +! { dg-do compile { target aarch64-*-* } } +! { dg-additional-options "-w -Ofast -fdump-tree-ivopts-all" } + +module a +integer, parameter :: b=3, c=b +contains +subroutine d(block) +integer f, col , block(:, :, :), e +do f = 1, c + do col = 1, c + block(:f, :, e()) = do + end do + end do + end + end + +! { dg-final { scan-tree-dump-not {Selected IV set for loop .+ niters, 3 IVs:} ivopts } } +! { dg-final { scan-tree-dump-times {Selected IV set for loop .+ niters, 2 IVs:} 1 ivopts } } +! { dg-final { scan-tree-dump-times {Selected IV set for loop .+ niters, 1 IVs:} 1 ivopts } } + diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 27c569c77022227643151fa4a909a95f3d45bf55..fe398d99bcaa9e8fcec45e5e07d133bc393aa4a7 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -962,7 +962,9 @@ enum operand_equal_flag { /* In conjunction with OEP_LEXICOGRAPHIC considers names of declarations of the same kind. Used to compare VLA bounds involving parameters across redeclarations of the same function. */ - OEP_DECL_NAME = 512 + OEP_DECL_NAME = 512, + /* Check for structural equivalence and ignore NOP_CONVERT casts. */ + OEP_STRUCTURAL_EQ = 1024 }; /* Enum and arrays used for tree allocation stats. diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index c3218a3e8eedbb8d0a7f14c01eeb069cb6024c29..b05e4ac1e63b5c110707a8a3ed5e614b7ccc702f 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -1623,8 +1623,8 @@ record_group_use (struct ivopts_data *data, tree *use_p, /* Check if it has the same stripped base and step. */ if (operand_equal_p (iv->base_object, use->iv->base_object, 0) - && operand_equal_p (iv->step, use->iv->step, 0) - && operand_equal_p (addr_base, use->addr_base, 0)) + && operand_equal_p (iv->step, use->iv->step, OEP_STRUCTURAL_EQ) + && operand_equal_p (addr_base, use->addr_base, OEP_STRUCTURAL_EQ)) break; } if (i == data->vgroups.length ())