[Backport,GCC13] tree-optimization/116585 - SSA corruption with split_constant_offset
Message ID | 20241001185654.1331694-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 EAFC1386102A for <patchwork@sourceware.org>; Tue, 1 Oct 2024 18:57:34 +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 9D197385EC34 for <gcc-patches@gcc.gnu.org>; Tue, 1 Oct 2024 18:57:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D197385EC34 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 9D197385EC34 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=1727809025; cv=pass; b=b6Hk/j2ovV/GqRrPE53hU/PMNJi/+WVKf2J5Occ0Dr10h4qX2S89jPprhk0j270dRoJwT5ZZnQFE2TVOPDy/XZjzl7OGtwM99xsMXUrlbjxsST4zQhx+H8gAaeLI9aVTPDb+7s/aCi3Q8shTwtfs3WsF0HEKlcBO/6XksAukLIo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1727809025; c=relaxed/simple; bh=9SiZsdiUyGLjXwxAezzGtaXfIy5nqgVWmSlJTA/881k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=fDYK/W6Xe9CkSbgH+XvT2XgwEqfy4hie/MHgNYqMRHRSZad+de/q9xz73+SHBcfFsrmYKZBMswOvMi6veNc2gzi7JtSOC3Muf4QsMn60HCFmYa3rXVBd/PZFcEoSUdLl/SodSeYR9OoyDQ0ZTpIcjtLDV38AixOyykaBSX8gZpU= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 491IffR9000919; Tue, 1 Oct 2024 18:57:02 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=cRWzWmMehLYG01 Q9/rbgmdLSFGkGwfSxOkIJE7GIC6k=; b=SFzdpEg1hKbuGURmCV+8SJyPBxtINg 4CcRzguxKnKptZaH/yztNcat1F2zLgsBQbP3d71WBBW1ukgBonaFkQLg1t6v9XSU x4nnVoc9AqFeOWjxQ64/P2nQM6v3KcPk7Gdu3Zw5erTJadIvIfkcmFfzcJOdTbMD C9nzrHwHLjIRe3Cgbl/JmYZytbVzcr3KNqf/cv94e+78n9OeG3L0bCS6ny+dWYAr xcptTVvDG3FQK4gR+5UDurPf47uJrXVOXYAyAnGPIkhA9n4prYhq1oXsrFJNcX1m oRC7HLT6lDStOBmlzJ5Eo3a91O93PTttqANHb2UaUJvslkhD6tQSP+6Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41xabtq1ww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Oct 2024 18:57:02 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 491IPmZr039418; Tue, 1 Oct 2024 18:57:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41x88800vm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Oct 2024 18:57:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bPLMMoYPClwaMks7yjIVKH5ajnHy7sIKfHlJrYsHWUfrx3hX5OBMAG75+j5RCrfS7oEbQmyPMSGz7qfDbrfCGXxnKntGX/GOU1sj81xWEcOoB3p7gr35bU6VXg+Z726nDfIQ8Cxm6mKqNYwtfJ9v3P9sEMoW3f88V+DVPwCUmH1lgwJDWk7Z+5jPyqgnbO3GXCxCM/aB1Ra3TfHnY5NHByGZDpay5kMYeAp+UgYJrp36T6WMoJC0TaFm2eJeLFUnLrRUZ9sqBy/if+LkmYhtIkufSXTTji6FAw1PHXYWfIEC+wllsXO3eRtl3pQ6fSHDzFWGT01mzmxvKaqmj54c9w== 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=cRWzWmMehLYG01Q9/rbgmdLSFGkGwfSxOkIJE7GIC6k=; b=HG+rXMBjllxF0HsBf6lI1FLyDxTfNNUAnGyjTN9HdTGgWAw+DUukqP4wpfhUWDhqP32fBmXaBTsqd5a8r5fRPXs3rItA6eYSlQVqL5VpKlE7Y7Baq2zecz3Yed0hkdDlerw7195cgYp9qxE46THvXHNYSA/a8onOFRJyb3CxbsSIxcizB0QO6YQ0UOsSzjCYcWVib6QQKMGIpufgl+OyC8PuYUe3UCH0+TpQ3Xo+dX056Opbj5D2YzpKu8zAQVy/nWLJACEW2y0F1USBhdz2CsPXYPdUFhdfhRq8LYIQSXO1OrtDptAIdBQbneemMkaWm06j185DoRCjH4SH5vREmQ== 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=cRWzWmMehLYG01Q9/rbgmdLSFGkGwfSxOkIJE7GIC6k=; b=VCO4ejBJWeb4TVMs/mW8D8cEQCyDSxr8vvK8183o746N5RIbTf+KIIt4nyV700lzsUxvAUG5h54/oSlcdK8ipjArd0hqoQKCxlnkQj7MfqRDudrrQa7/PtDITlKRQt4hJNN28xT2JqtNw2ainMHQgSdG4bPfQj8CB4UnGHvC2+4= 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:56:58 +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:56:58 +0000 From: Qing Zhao <qing.zhao@oracle.com> To: rguenther@suse.de, gcc-patches@gcc.gnu.org Subject: [PATCH][Backport][GCC13] tree-optimization/116585 - SSA corruption with split_constant_offset Date: Tue, 1 Oct 2024 18:56:54 +0000 Message-Id: <20241001185654.1331694-1-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR04CA0005.namprd04.prod.outlook.com (2603:10b6:a03:40::18) 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: 90ce968c-426e-4b69-0c89-08dce24ad371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: avnsg8S2SInv6SI8T7us/YTW53Vty2WGv+F7lyd0NodBD2PTJ4hqwjP897Zhd1RuFhd0dLtdy7IY/mDYZt+bZVNgkavU3eXZsgYy/h24umuviWrIw49lmaqVrfPoQtRrOtpXobHfTE8C01K/jvnbkD6qjEQdJHa8botEDy6pcdU9YJ/LER/cfoKb/7GvJN37lKr9SCgFEHldrRTOnrMgViGjBt0rZ18zYm1hloOEDxaBaMGyj8TKKplmQHrkxovsS/w098PycPF/u3gnDAtKrjJN2QezlzYyA8K1kGvzCktfmvR9U0vUEnrTPxRjwnr1fdfIyAfaNeoQso2jJALYzL7VRPi8vAFEhBfwpItxd+DfkLnMzFQKicNXvxj09tMZjUk6ofvxSM9cFUoLgtYwtNPmFl210wTRfm/zXrbyttpzO3E24oHS3vl2fntHAicb8uruvIHqria7ngztAgNZxZEa2+BrdouAlEUi9F4Ovl1514YoRuTn+BrF63FfKnB9NdRdqlyxYgotLjcXHqjY/XgTvb7j0BEM6Dq2o8/8BJnN4HHuhnhLcL/G36g7WasPv4Vjm020KiZXdSjSYzr7vZ9d9u44lag28zRd+Ygeden4lPRIe6dKgC1gyYBT3VtIutGWUtcm/nBIDzqmPqzrgml7mSP8/CpN5r0jALrE6BIHfVlO9BRcKKrP2aXCAg/S+vH7TK61+C2EpOyU34RB6Ytuw0yTXTMphtIhjxCR1gB9ekGlaavqLAsQwed/rnozQ7dpC3W/6u85xxDMaDw1NqoVF5XltASX7fChoWxdfpjMVuq13aZgOL0kxhTGBh4ulPX+KxdDTWFDvStZvd9+niAeSOuvc/fn10ZMOkvGmMaf7q0srUbK4+Hvf8KFuvjipAlhUhQXmiSTroIh1T0MClAFU5ML0t+8rnXK+uJRvvS+YH863gq6pKdXISos/e3go8pqN53wzX84RT3OzJxkDc5HtJWS4RRxOTBDqGR5RNKanO86zWE1i2cVqmfqAHBiEoNr2ROLPGwnEGRTe35TvjtUjfB8LZK+JwuEbPzVaYDDa1YlvaPv/I8PWNjdVd9IiB0OL9z3qjRx/D2w+58XMZcJ6DSGSt1jSMmeovov2K9xU+gjYUyGSalhgImlpJpNUThUSzeil+4S2T/1bqvB8gf8/tAVkuZTGYT6S768Xrlaug1jJ2uMr+raHKd+h5Wg8bns2Rxnhu87YhvDgcNmQ6tf+AFTjM7SgfbWjGMJgxw= 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)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MOJfPJRRxER/+R72fJxc+PRFIVkKOGkAVU+rw5b3egJoYcaiLSlWRLGFTfjCb2rFELjCyTiNnqBbYDrXvM7S5LXZs+c53tpzNONoeoAuMVh5HEdbFdMrvHsFtVIFbvjCTCpcAaX0APUnxNC6qHp+E95+EdPKZxbP1bwHH0LR2pr/AKqYpBPcpG7cbU0JzN3au9EH67SYeXAKpNv84qQogx/+9hUIBr5fP4icXJJcKNuFL3uqlpjQa7LfCfXWoo0okdPpMbSolC6RfesGpfvJ6yo8+jEawyAT5wW1irlQRSkrpRVcxVRlhdh9tlluKVz4rIjXT7gUqOciNWwpDq40/gQz4f0GjBaK3i2gPL3arjHLCsGfHdcbzv4PLGmle5/DY3Hvknd3lA0G4riyvpIw6oApnu/4b/Pz5jmpLyY2mzSFjxERR4xM936L/VLW3YT81/t+KoJXfejUBK1hZy2hk3/gxhD0ZG9x2YxJoELZ93r9myW+Oq8sVLzcINmNDCrgk3h8XYtqNi6po7avJsNNIvkLa0jXG06IDzR87Jw+1y9xUYdwOb4WhrlBO7Kxni0hSHBzw635FDlINg6y65NQRJh9GolGi0sHkXV35U1FZz8mcA6WOLmwewmyOI+eKZDHOzsYxNoVNk7u+81rl5jVkESbGCKJQweBUWTHu3iGCHzX+M7OYppQj819xp4MuxVRQwpkqCmVG8BzDuL65RGl1xksBCJT6MERl1segfMbm02SbuJY79X9WyGRGrQyZKr04M7h3x6fE2k4fjRE0v1NbKcPZXkq2/m2z4l2KJ55I/ZYGsugSOfHsa3SUqK6zDDFlHaOU/iNR7K2b3UGav1mAu/3a5nlp9M2ZF1ke5qL6lINA5T44L2hg/E/+hlBTio2wOneGUnbXZHMV/uP7v2uPv/yysucdqL/c2Xxi7hGbNo2PtajJm9ISQOUbwjYs2GeXeNUHv6lychkQZpXSTf9GAJTg7ZhTd/RsJc+xcUiD1RMw+AVBipQTBAcCM1TQ4BBtguGP4fisG8hKqla6yusbvpxdA9wbVcoXwAMoqOFl5nmD52RdAJYcdUmj7+7hJZVXz+RJAL19Y7EfMtwsmAlldtCkr+bnJp8LQFFyVEldhZdWT8tLm6iqPo1ZnV25hjiRS7T2Wnvme43HjtVnftsgC3MJIU7i3m3HbIfn0JNANHO7QravsaHhzwStfIrdW/cFjq/OlD9gJummI7EQ+190PXJTsBBnkiWI4O5j04CavwTo6SA0hV1LNO72PYSG/Ab9NP1eAmHk0PVwvdp9jrQfTTzz45Lpq6rzQNUOzQGtvVRLXiGjGNayKg+SMxXB2AZDarGSwL/Zfo1iapy4GYE/ynhZcuTwLomgsAhutJs9UlyGEzEPz8eoIoMgXA15g8fFv5RIWxNACv2O/KYO/Ch3bnrhs8lPisBM4CiJYz/pbxPbAhRDeIfs8Qa+PYuDQwHl4SbXgrX4gXdqAJBSOi5Yd1sMdgJkCkqhlNcygrC3NeMym6AsDSJiMT+KhZYnn55SK/NZ8u/aMOr8KZD7/RQi4PqOUixxCdDNnCsZbu4yj7H0ke3+lyqgrHIQC17pYEN X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lHJzHoLdpks/3zoxiAW7QCBzSzQzWh4i/BsB0c+SyOIUhapaRVANQz52/xT0Xp3dYFTuzx1Ja/rxq2qDnAQmPlm7zBAJstnUP7jVWrEPeuWmTEYPWFZ7q1IPLTxH7S+NYXW+DCI5K0EyEUHjCDfr02ExxGZU6O1RiYV5Z609MSD4wdxCLyNP3FDPS7aELUzTNgb2Q/cH2244FVK07u0yAws6EDDfRNdJIHdOJUeg8/pI3q8H8P/ETulTGnDSZlEibPxIAgYmFZBPN6ZEtVfoJPY+61JP0ijUnR0KDdBrlkQ/pdQFLLESKihyG3bPeNRpjePM8fJp4Dl9szT/xtjVBzNNod/JLuh/olxGo8Es2e6IunUv/2EcDOlCwoBVlqJlf7RRA8ChaXrPF5AZ2FYYM4OYJIZ/C0/tOVmlI/5jwI9Y6jrKDOvzMTox2UNCI7GL/zuuqo/SNGBYBNjp3D4Ptp5lIBWld6FYgM71QZsV7u49f1RFrhBNueUCt7gxph66D+lNndBAhFdZC7ruqKaKmpeES8rPeJrfUdCtwFZ+kgI714RlEOZ4xORKG/BoI44aa1/AW6MlHbtZA5sHIUDfYg02Bj8yVtFkq9e2s5l3J3E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90ce968c-426e-4b69-0c89-08dce24ad371 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:56:58.3418 (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: WduNxN9iZiATlujS+Givmjki9HDqI9rLYGLT7YQEi7jQ4PBex62OHuWNyFOSCiHudedyWgc78D5QesR0II4MPg== 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 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2410010123 X-Proofpoint-ORIG-GUID: 7RCOQioEvl-eFQfHsObHYDIyxKSgqiZo X-Proofpoint-GUID: 7RCOQioEvl-eFQfHsObHYDIyxKSgqiZo 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,GCC13] 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:56 p.m. UTC
From: Richard Biener <rguenther@suse.de>
Hi, this is the backport of the fix for PR116585 to GCC13.
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 GCC13. > 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 96934addff1..7657eeaf9e6 100644 > --- a/gcc/tree-data-ref.cc > +++ b/gcc/tree-data-ref.cc > @@ -763,6 +763,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: > @@ -855,9 +863,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 96934addff1..7657eeaf9e6 100644 --- a/gcc/tree-data-ref.cc +++ b/gcc/tree-data-ref.cc @@ -763,6 +763,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: @@ -855,9 +863,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;