[Backport,GCC14] tree-optimization/116585 - SSA corruption with split_constant_offset
Message ID | 20241001185342.1330657-1-qing.zhao@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> 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 E11D93861820 for <patchwork@sourceware.org>; Tue, 1 Oct 2024 18:54:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 1FF3E3861005 for <gcc-patches@gcc.gnu.org>; Tue, 1 Oct 2024 18:53:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FF3E3861005 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1FF3E3861005 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1727808832; cv=pass; b=SBeTl8YVXlYi0uvvCSNFB/k9RIm8wDnM0vRljKwfWdE8f2vl1+ltaGRwVRB6QlDebKMVH5CmOBb7AKNwxGX4kqDARnNE1A9NJ/DOdj9KDEg2N/4wt/5J1LwzyMP1hJD0jR3PCD4vgJ+1O+6EP1uT/zu1BLZBnizMwrUXe/izZgc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1727808832; c=relaxed/simple; bh=xxhBuqiz8oIPjb2qtdUF02oOIobKeCAXIklYRDzRFm4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=T614mCgYmOSSRF9CEfgyW6AkSgpooer3wxqb9k/L0fKjqviLKNA4qFXvEe9Nh+Urjtr9PSTjWiY/GCJUfFfVl63XenIRsGpBwAQUH8wLFFl4R/R5D6FmGqSyVx87n1uNfct9u3nvquCbuwp/fw/0e382F+RkakdhMBDvmfUB1PU= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 491Ig03A021514; Tue, 1 Oct 2024 18:53:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=corp-2023-11-20; bh=fDL9922XONCZP7 53WVQUiTfvhDRXB+p3VOvVurLlgdE=; b=SC/MM112PjSWFSLjLnKNopcDsm6TZq OVPudw0O28Vo4h0AzuHzFvkEGTd5fvb1X33RtSCjINlxvWTrLxgwDhm49TYWqpV6 Hqo28xqpTsxhvWYjl201MXiT3gNLWxAk99NkyJFWuQ0AWmg84urcO5kbwmB7NRQ+ imP+7QdvZ6AIFNYKTIoOVSmzixvRJx+0hDyxGbQFYohOAEGGoPvHkJGaMOaUZkhJ FWvD9vJBTOUYFua0rmByv56yeZJUDgIt1HIE6PsopBT/fLbApPOH0qI7R1gYckhA IVfvnwQ8cy2kUmHe6d5zLJRmC6CL3jEy6FRgVnDOnm8VALVirhvRwQ0g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41x8d1f3ky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Oct 2024 18:53:49 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 491HH5Hg012616; Tue, 1 Oct 2024 18:53:48 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41x887qdg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Oct 2024 18:53:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rPMlKR7DZED1RATzCgQL0v95/pTWoRWB6tUWU9Zjr6D+4LNf85he9zARe7hEiQ8JCz+UZciBJB4jpXFNFmGoLPuE2VNhth6yAYRyBKdRRXSWppMIhYup1DG6WKeSmeG4jRHMwLB6WmTevbaZweybSt1vIgrLeg99PGVuEHKqbL1rQJKTatlOoPXp3M9J3SJOf7eeqI+cbix8VHHhN4vbM32nv6fntQeOjY9zBDRto3C2tlfFzWwUW1DqHkVsJsEyEXjl775lUOEuyswvJtoURpPNGSxuatreUjxN6M4NjzCCCzEahDFluCRJsQWJ5TYSgcj1noTRobOmQAmhooUPTA== 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=fDL9922XONCZP753WVQUiTfvhDRXB+p3VOvVurLlgdE=; b=uEyU0gy+HZ0uuQQB2yNvw6bOIIHarGXuS9QMOyT4Va3nl91HwKEhWSWV0kP/eIzLeyhHJdgCuonKxryzVUSpjVXS6St0UXz1Wo2OjN1eApAknOP1ZNt4kDgcwFPJ7x8SOnjfAv84p8sHslffRvQUq536GvfPFIduUeeuYeE3CmDfhdISr4o+IntF8W12r4CxhuKXqkeKFGs5UJItM/mvFl64RH05UQaJ0YyZmIrLdP66ANrlnMOLa4tBWb4cHJsulf65jaxVT8HcqVXBlt5RDRHoM2b1f3DXLglzA4NKd3cpuTh+mI6AX7wr10ASHrVxH0f/smAxJKnuMBliA+Mzyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fDL9922XONCZP753WVQUiTfvhDRXB+p3VOvVurLlgdE=; b=RQGGrIchGmTRIq+Ouem6jxvnxl+bCoC4onYSU1wpGoEsbL/ziHockuTQpxbaBqQ4VyHEltujI0xagkCMhixP1mLSpXYffXwb+nc4JkRVJ3OKcsPZkQo2TeDHcfa5M0tT9CCuGVaozUdElxxtb12qofbBbrt8Tsb9yFaiRSadbfo= Received: from CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) by SN4PR10MB5589.namprd10.prod.outlook.com (2603:10b6:806:204::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Tue, 1 Oct 2024 18:53:46 +0000 Received: from CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47]) by CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47%4]) with mapi id 15.20.8026.014; Tue, 1 Oct 2024 18:53:46 +0000 From: Qing Zhao <qing.zhao@oracle.com> To: rguenther@suse.de, gcc-patches@gcc.gnu.org Subject: [PATCH][Backport][GCC14] tree-optimization/116585 - SSA corruption with split_constant_offset Date: Tue, 1 Oct 2024 18:53:42 +0000 Message-Id: <20241001185342.1330657-1-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LV3P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:234::10) To CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB6538:EE_|SN4PR10MB5589:EE_ X-MS-Office365-Filtering-Correlation-Id: c50b88f2-5de4-4313-b6e4-08dce24a611e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: 29w2saWF+pRqVdN+W9+ARDHlk/y+hV/MpfXHz/w4+n1HViDUHgcMg3UdLObp1q3QON177jatUHP4cXDhM79A1XKAjZKsy9Kmw4CJuur5q8iZRvn67qRBwE3kgvPJSlDOh33CU3aBGy6vsOtJDYkiKfeYu+5BTN/Kx5rSC1x5hDCCQmjQ4H8gvBfwqsaTb+zzl7oO+XPxPqOU75JKADLPxSSLSUXhEB+6HRLKtrCOsO5PsainM6CXgQALQ8hDlRXpucPLImY+6RguPdAz1iChrleA2r0MYPDDVkHwYQju1RVBdVviprkw9f9GAnK7l3XYFhExHDiwAVYvsg2pZomf3BjP4wGki5Ccxr3J8JqCr15pvddXIjwZgoYkUcdQ/RHo6GT7Vu3xkk4sgXOjR4ia0SLZjUoaz/ZwshleMHeFVFKythu2957y93PBpirTM5WMXvZmmUVSQJi7mOqZb5iA1rN/2vnJ4YUj9uzvRLmS7ALhyRt0hIGSNCU5Dlw64XDzGUVysoWj6/gkqUbh7Dikt/2gTAJYjHr8iZoqN5REzvS/sOm7yzJ9j7wBndNyu3mlF+xksImBENTiZJHaEp0Ub0JZb5dHICX5Pgzl8ZpiRxl0tr3VbHS2yMjfj8K4UpChQsF0pAXZCFAzBctqzePuWbTMN1j+x2iwcJtiGMomxXRqXdARQD6PQS8y72uNGDLKVUsENGNZPcAi2BNhjDovt3sgpRojiKoG0T793QcHRl8QNelP9pWAi25caC0gGJ8TMbk4Lrh3gOKYBjmE5quX0ThrwCXte92ICUo5jvxpHgRD7lt7xzRHMgzih8JWbMMYWRSB6B2e0PH2+X0IPYlXzxvZRb7o/5PJSR587JymqShmMtGBHJSNs5pMXKExWOOCer4UxO/IMIx90GiE4qQcpmDe2zQAQN+NBYY4Ol0ajybcgkqZ77yjlLDcitZVN5IcAzcnlQcQzJz7BONKy0A1uoDY1Hb529TGSdJXdNMyc+Vb5qHllcx+nnFQ9ZOIPHKe5mHt9GXRExG/i4hxoPHuhmrT4ZxBJXJOeHpbAiGbfmthr2ghD/gVoKplY11hMWiL2kbgMe/htvZWflMAv/RHcfOm33eFXHugJYPOMmBDCFccAg2x5S8DZKKtQqVuAt+OHzlN/dk5KgPiyPJe9jw3ywS63ShJpMKc/lfOxf9ok2Q4+h8ejcs8AKGmA0tlgB3/7xX0n2PWX4aC22eC+jS0z6otwQ5SM91O7CYxX35PXdY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB6538.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wDUcTf6pUKOJ8bWELxHk8PBBZL52nmAxwj0HzaGMtoWvMZ+2AI0//XMCiZlRwiKhmtGd2OQyyz75fkpf3YImehL3eAgJ3sGLXSYdhNJRWaak6e6o0M/iyKB5+E6z7rxaE7/oyocxGbsLEOaBbbqSfo2g8Dhu5NVog7ssstN2ipsTyUDJAcuZbKk39CS/TmJICbzeMv41coy+vEX8pzzn10piE4HR12viSU5fMRt5/qiBx5yiASy0GE0H1nK/SoS0KUBV96ZnXwm/v6tWgroZpd4BPFEoNYg7I4SKZhDWU4F8WObg/7UOf+yrZgeny9hMboTPtiUWZKf5AeOPTFHuBeQu+fWTLm/CGVP7sKQHso7tQKtyOc3SoHBaqCZ/LcEkmNwEPbfEG3a2jDbaKZBdcFCD8VmpxZJuO0LW12OGNENjJfzcLAaRlKiZ/gQ+dCcqNGTvihIuj7Q8SjCzO0mm0BJfH1giEJQ/t/qLT1W82QS7KrsK3sdmorJDNSOH5eQc6TuSFnlS7bHWz4UuWsjMjg0lo9uMutRNJOyZCIUBBVIUvdJxSRXTUxIdQq7MEtLiYkIgnOny0pOFN14v6jpS6+Zy6FWyVZxVuRCSND6wnvQOCY4g0+W9rCZVwgcVqTIoLnVRl6/tWoL89cW4TGuFLkhwRXmsDgHrJg/NTvqk1wypLox66Njd533/7kF/KtYlAFWw6kAwXTyFdfvGftq0GqLa38IJmIfS7xUXVXGRrcIEuDFzjtFrlkQp1B32kKNI7z3j58+spFAeBSYWOHnjmB4VWMB0oeahy+I8joLhg/vwJrbl1+yS/v4W4DfuXeaFoAkwkMB/jKlBfEDTkkWMhjRiwuwCwk1561U/LXxCRKshxu2/jKVcZZ/P4BsWjRCFU5jUZhOaoWdmQj4WfWkbsmrkT+wu7zHfAKFoGwVOaMJ/weYkDN2VEeP0I9ZZaHc4gwQNgE0hCgqo2L8kaWSG4NfNzIf2YnS7nRB5EwT5DMt60PUTYmsgs73u7Byh0Vud6fgMibFrE8wlYZw3Xg3KQfsrTy+4cSDD9Uo4MqDnFavXA7sXCmy53qrQMswRnfovoRbJE9nN5JY87ZMqyGS1UTrJJqQwp9XrNceNtORF54li9W8HfAD9Henos2VmmzTXy80iXxJWg00SwTSZpY05MULnsLVVEjhYpLoJIjjCXv8B3PnkMKB3NFS6waSvdnB9C2Qub67tAUO8/QlZnMqUIcknFM3HNoIIGG9BDq0rIFubvh3I3tYldSUTL7cKfNw2e82hyshKpEi03bGtnVtl01XKcBwZTsvPAxf3A9PUNyycGCo9gftHa29hfxjBBHsHv4RqbG3xrMGI/tALgNIHYxszJ0dN049Zpg0Zp8aBA1dU6/SkbRR1Da/uq6X0XgQjWRnUcRF026H/VPvsEPxV47+jJ+BtCR+eC8Ivmnb0qJcyyScLier7VOOZz2rzxaWTyJIyrbIGBfFtHfCgyt5mPs+6lJ45qwyjt8aqR8/QCZbuTMV1YXzbi15eqWlkCcFMTkZEkmEBKTxkEn2njyDbDVLbIc+L+2Kp0D9MQZCHClTNgmdbTXXduY7R4WobK/e7 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oT0/Q7o7tGg0Aeu9mx5otbEsSsp8uqiiU+0+cLDMhNINI4q9+A/jNxevh9AppvvBUYDWBe6WNFi4Eh0ECo1pKAM40UjUGLS0Zpcb6hkWXb5X/B5PKp82X7IxqVQbJ3IH9V3WttX1Gco4bQcHBFD4Qj2HMi0J93H75cgDVgbaHqRfTR2SJNkuUqXQoZB9LwMk+F0Dh9UGrXsffroY6S1UsCidYFAi6aWrqt3ISOo4FWsQucZnqIomBbXi4EIjG7IuVf9KjVgAlixDnB1m1nm0Dr0w0zK0FF+WhEG7TluwSW/FkaH805J4ES8z3xk4DD/cNHo8v7jYZZH41+Hacyp3C+AbB/5J12SKsy61blnbBaOjwsIJ3asuQcmDo29GasT7m9jfXPhoTKP1wAV8Cl4Oml3Wmo6zwLF2SsA1R07C0ZBLm2CRSshKsAzGj7NuJSzUW1vYiFys6dKmFmVpi5bvUvdZgsOTxL72OleMHVpUXQmXXZd/fANJgLN9YPXSpkHzQlFL8KdszP3Zy0/41pV1IrdDPQ8QaKM+PwsekK1hYD5j+VrYtsHKQwLlS75WyHovIpXzWyeOCYo53H6QJi657f44rkByBEd/YhgumFj+0rU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c50b88f2-5de4-4313-b6e4-08dce24a611e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB6538.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2024 18:53:46.5657 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0JDoDM6q/gXpsOct0C/wnWK5cMZu5B5RyGrJhDwiaE5ZjMjvTBX9r89ylve3l1IPnC1l+LMqBkZokcbvHZKveg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR10MB5589 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-01_14,2024-09-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2410010123 X-Proofpoint-ORIG-GUID: Tkcva5E3cjnfH6Q6DacBv2nw32YbRnZ4 X-Proofpoint-GUID: Tkcva5E3cjnfH6Q6DacBv2nw32YbRnZ4 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
[Backport,GCC14] tree-optimization/116585 - SSA corruption with split_constant_offset
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-arm | warning | Patch is already merged |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | warning | Patch is already merged |
Commit Message
Qing Zhao
Oct. 1, 2024, 6:53 p.m. UTC
From: Richard Biener <rguenther@suse.de>
Hi, this is the backport of the fix for PR116585 to GCC14.
bootstrapped and regress tested on both X86 and aarch64.
Okay for committing?
thanks.
Qing.
===============================
split_constant_offset when looking through SSA defs can end up
picking SSA leafs that are subject to abnormal coalescing. This
can lead to downstream consumers to insert code based on the
result (like from dataref analysis) in places that violate constraints
for abnormal coalescing. It's best to not expand defs whose operands
are subject to abnormal coalescing - and not either do something when
a subexpression has operands like that already.
PR tree-optimization/116585
* tree-data-ref.cc (split_constant_offset_1): When either
operand is subject to abnormal coalescing do no further
processing.
* gcc.dg/torture/pr116585.c: New testcase.
(cherry picked from commit 1d0cb3b5fca69b81e69cfdb4aea0eebc1ac04750)
---
gcc/testsuite/gcc.dg/torture/pr116585.c | 32 +++++++++++++++++++++++++
gcc/tree-data-ref.cc | 11 ++++++---
2 files changed, 40 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr116585.c
Comments
On Tue, 1 Oct 2024, Qing Zhao wrote: > From: Richard Biener <rguenther@suse.de> > > Hi, this is the backport of the fix for PR116585 to GCC14. > bootstrapped and regress tested on both X86 and aarch64. > > Okay for committing? OK. > thanks. > > Qing. > > =============================== > > split_constant_offset when looking through SSA defs can end up > picking SSA leafs that are subject to abnormal coalescing. This > can lead to downstream consumers to insert code based on the > result (like from dataref analysis) in places that violate constraints > for abnormal coalescing. It's best to not expand defs whose operands > are subject to abnormal coalescing - and not either do something when > a subexpression has operands like that already. > > PR tree-optimization/116585 > * tree-data-ref.cc (split_constant_offset_1): When either > operand is subject to abnormal coalescing do no further > processing. > > * gcc.dg/torture/pr116585.c: New testcase. > > (cherry picked from commit 1d0cb3b5fca69b81e69cfdb4aea0eebc1ac04750) > --- > gcc/testsuite/gcc.dg/torture/pr116585.c | 32 +++++++++++++++++++++++++ > gcc/tree-data-ref.cc | 11 ++++++--- > 2 files changed, 40 insertions(+), 3 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/torture/pr116585.c > > diff --git a/gcc/testsuite/gcc.dg/torture/pr116585.c b/gcc/testsuite/gcc.dg/torture/pr116585.c > new file mode 100644 > index 00000000000..108c481e104 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/torture/pr116585.c > @@ -0,0 +1,32 @@ > +/* { dg-do compile } */ > + > +char *s1, *s2; > +extern int* my_alloc (int); > +extern int _setjmp (); > +extern void bar(); > +void foo(int s1len, int s2len) > +{ > + int e; > + e = _setjmp (); > + { > + int l, i; > + int *md = my_alloc(((sizeof(int)) * (s1len + 1) * (s2len))); > + s1len++; > + for (; s1len; l) > + for (; s2len; l) > + for (; s1len; i) > + { > + int j = 1; > + for (; j < s2len; j++) > + { > + int cost; > + if (s1[1] == s2[1]) > + cost = 0; > + else > + cost = 1; > + md[j * s1len ] = ((cost)); > + } > + } > + bar(); > + } > +} > diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc > index 654a8220214..69b421f3c94 100644 > --- a/gcc/tree-data-ref.cc > +++ b/gcc/tree-data-ref.cc > @@ -765,6 +765,14 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, > if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)) > return false; > > + if (TREE_CODE (op0) == SSA_NAME > + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)) > + return false; > + if (op1 > + && TREE_CODE (op1) == SSA_NAME > + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op1)) > + return false; > + > switch (code) > { > case INTEGER_CST: > @@ -860,9 +868,6 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, > > case SSA_NAME: > { > - if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)) > - return false; > - > gimple *def_stmt = SSA_NAME_DEF_STMT (op0); > enum tree_code subcode; > >
diff --git a/gcc/testsuite/gcc.dg/torture/pr116585.c b/gcc/testsuite/gcc.dg/torture/pr116585.c new file mode 100644 index 00000000000..108c481e104 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr116585.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +char *s1, *s2; +extern int* my_alloc (int); +extern int _setjmp (); +extern void bar(); +void foo(int s1len, int s2len) +{ + int e; + e = _setjmp (); + { + int l, i; + int *md = my_alloc(((sizeof(int)) * (s1len + 1) * (s2len))); + s1len++; + for (; s1len; l) + for (; s2len; l) + for (; s1len; i) + { + int j = 1; + for (; j < s2len; j++) + { + int cost; + if (s1[1] == s2[1]) + cost = 0; + else + cost = 1; + md[j * s1len ] = ((cost)); + } + } + bar(); + } +} diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc index 654a8220214..69b421f3c94 100644 --- a/gcc/tree-data-ref.cc +++ b/gcc/tree-data-ref.cc @@ -765,6 +765,14 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)) return false; + if (TREE_CODE (op0) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)) + return false; + if (op1 + && TREE_CODE (op1) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op1)) + return false; + switch (code) { case INTEGER_CST: @@ -860,9 +868,6 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, case SSA_NAME: { - if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)) - return false; - gimple *def_stmt = SSA_NAME_DEF_STMT (op0); enum tree_code subcode;