From patchwork Wed Oct 30 14:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qing Zhao X-Patchwork-Id: 99824 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 F2BFE385843B for ; Wed, 30 Oct 2024 14:18:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id D26453858D28 for ; Wed, 30 Oct 2024 14:18:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D26453858D28 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 D26453858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1730297888; cv=pass; b=UIcYxkMgfyjDGl7yrwoS7TZiHcUW0uaRHbRykTZdkag0SGmgfM5GAANJwhYODCTO//Vbnl0P7myczDFzxMqqhrcU1NfY9cdt8ejFKPsb7Wxj2aVG8AxBOHKU1QBuVWl3uFymkjV5jNlb5siOSzdLf/6yyRRBKM2a3Clhe58BwVA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1730297888; c=relaxed/simple; bh=bWUfVTQ6//CJhklzyNlU9B5RPTxWsmXGjdtQXPtLRCw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=W4/KktdwC9IdarEH+595ulEnSXftdyzt1lJ1zIiHofrAeT8jNBLTuQy9W3CeUAUFrX++O6SRyfoW0nJiImRxf0ss5y9Kksd3t8ql/8MNJWUlqi3oKhp3YwY8aWuLzUvras5s9F7wEJNPCyiWlQ8wu+d4a0dRCLq7dntj8+pArUQ= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49UEF3Vf007244; Wed, 30 Oct 2024 14:18:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=ulfJrbfHMA+Kbe5ODeHSTQtusM+fvpz3O0reO43+wTM=; b= WlCPR1BI/Yhem6LQGaqUlOPNXGTAFgiGZHGLxlX2XswgoGKFKlXCzMI9ixIRJ+d3 PD6ftPriqmTT2F7lbutjghUUdOmonLzepzr0efjfzelzp08jwBVaun1Q/n3GgwwQ gVGU9h/ojgS0koNHFzn4HtV/dr3QQzmfT42k17FhswqQmhQ6hUzyJAOhs2lnwJJs JGUSLCrC2TIqCSXGzrP6r2bYDuZgIlCS209CEq2AfDGNy5naSW9hZFz6/zUOitiR iz3lQuRbfJ8KQX/hMRuWtlL0nQkk65KmGNGWcgHe0ELO0m8ogGBsqTIgj5SFkA4U l7eOB/3jS6fGzvUxatC/fg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmg6wq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 14:18:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49UDBWMG040215; Wed, 30 Oct 2024 14:17:59 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hnaqm6eb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 14:17:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=shTJGqP5kGKqLHUTODPI/qdwAal2qBQiT6b/FJcG79yW8O1If+/8damE4bNOHI8K/ZmxLD16PV4LPlz7fj+Ajver5tBqdAcp+Wd1wt65Qqp1yjdc8WDbMFnnUgtphPvtYiUr79Nypa6UKXg45Q2u/BXI/lEMZ3xssQwaIMMysUsRC4+aJyRX2z9ghcYGHNeY8IF25TnUlhtfwr3JfSLniMhmWw3F3SzwSe/qTDjcKn30JciZ8SVsftbaSRBsOs5CT/ZaPcTIDdJrL7pNBxJuklJ9C8RPDvAnpbHmiy3goDG46suBiPlO/UDEof4ZSYMQPJr7IdO2rtn8tpRGaJmlRQ== 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=ulfJrbfHMA+Kbe5ODeHSTQtusM+fvpz3O0reO43+wTM=; b=odmJzG0Ua6aICtW/iVO2nLc/0icNsKDLkdQnIVVixXUh/4RxUGuud9k0Fc3YVid9tUi5272w/EUMiq08PtubO52QdK4U1POtIqK42B83O1rAQOeFYRR8Tcp767kszBEGdyeXOUNFdz4JO+t48ogQM4OBtyHN7mHvWuLD8u7ZFz4wwXVyK+zw2XF51N5mIcACsk4V+wm0jXHs142LDe3bdhjBfMhaslWPw2CXsLXbCI8EKIvVjoXZR5k/968J3W8g6wJMoIavRPeEdRQvH5TPR6oU++Ff71NohC54tQkaRlvg4XVq0mBka8LZAhTaqvLFYUpA/HWEPgLQDMf62cnqvA== 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=ulfJrbfHMA+Kbe5ODeHSTQtusM+fvpz3O0reO43+wTM=; b=duBCRTgRNPkepFznry42gCCHICvJbuHLUStR/FITy+O87BlywQyCTTJALCTkRKBwrd7lu1Xrjsj0PSTtardj6x/yXOkMHBPQ7sFrK6U7jA248yVpIXzioWhV0WC4f4C2Qz8wCdOXG7CqZr9mvhWgO11fV+68n6ykIYnCgUU0lfI= Received: from CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) by SJ0PR10MB6328.namprd10.prod.outlook.com (2603:10b6:a03:44e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 14:17:56 +0000 Received: from CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47]) by CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::8a:61cd:764a:e47%6]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 14:17:56 +0000 From: Qing Zhao To: richard.guenther@gmail.com, dmalcolm@redhat.com Cc: sam@gentoo.org, keescook@chromium.org, pinskia@gmail.com, gcc-patches@gcc.gnu.org, Qing Zhao Subject: [PATCH v3 2/2][RFC] Add debugging for move history. Date: Wed, 30 Oct 2024 14:17:49 +0000 Message-Id: <20241030141749.4029995-3-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241030141749.4029995-1-qing.zhao@oracle.com> References: <20241030141749.4029995-1-qing.zhao@oracle.com> X-ClientProxiedBy: BL6PEPF0001640E.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:15) To CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB6538:EE_|SJ0PR10MB6328:EE_ X-MS-Office365-Filtering-Correlation-Id: ec264eff-7f71-48ac-b294-08dcf8eda64c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: 4F+cowuWSE0bOFX9e87xQ4QlAlrokh9WWmIEBDTy7t5/nIF9RxyZht/qm4s9hfGayZ8/GaxVDLaSwVIKdeiCxZgl02A4KSWkFoWZX5VYUd1mmc6JEl4S4dAVZjMPYNYXvnSegoGrfNFyQzSHiHDmySUgih10Lz5kvQxcbuBIOVQmImU8A7z/A1DcjtzEptq6KqwZve4MiH/zFsh/QZC8lMltoQgyq7QpqQm817mDBMfHgY7M0OZwB+zX9iE2PZtiRvzrNUGVzbovPS14TsSpUKpnIOKJofX81jssgniaYLSZbBjhRabJqzW8GE35+nK15aY6CHpTmF31Y0EARknvYRKfrdfpNMA6013FCKY0hwTEwOZEWRfGPG9Bsl0nuLFMQr558bRggGQU74cAjjMZq5hycmcU5kMaWgueKAp2UKTJ97jGx7XSfgcB+FvCEDdUIX44Fys7FwR01N9DT/yGd3dUsAKuqh88EM7oyU5LPY364A43HZfYGvuuwA/OzEGMGOwVsratd2NVi7Dx5Cqo5qHy9EO/Qo9lmeGjREif0wp4vQlXWfzH/4AnIpnS4txlsTvebN44onlyildeWrjjOmCCCiewh2TdEelUWYPhc3d1hZbRA2LFdY2WbbkveJLRl3H99wMefCAWw41O0nrknO+fTY693Vy5B0IYupbePLOCAhHBacpnf57l9Rcae7l2gj3bAYeOs2PGXm1/ITPiX+GSiEBiqBinPfBgFHvOggkNnsVFLfbUjkBAMJ5pp0BIMy6KphgLsblt7ZD2uPhipaKtgz0gBPhhm7F8/RmJlIubxL3NNXhe/rINYUhZBkiep9OfVGv6LEZ1LsvtgKizmH/KxtV5UQffPh72p5qpTeBnR84SxAAs5laTF0tRt0EdnTrAZeRCeAl5Y/7ze7cSYWec+ZwPulJh7mQ41526B1/VIihyDtVZ0g+aXKXRUSEhiJhpnEay4GQcK+F+6SURIMM9KUxppj9zvl8BM2R/b8/aGL1d3LJ2bttKaZNkmOc5vMibaIXysN0kqAtML7yF6VgcaotdbwAIwrv7N4fAYk5kFmAJ8Y/n88varRUXvexZV0suBrjQkot9d8ppWnLmgtvu+DJMNlhxxD52alRdOIb6JVqmNNEaY94KtUqu+z7yUhxfGW8cdFJsErYw/3H3imLxsdnrewb+tgujCEQDmdX9GOXflw6uLkWopsk5GdAGPkmtfpHyczXSWu/tFgOotXjHRWzNcdfgJkDvsXuENi8Ytho8HXjxP2AkZInsb9ZzdslLTT49W8AEAB4sljRvsGhckvLC1UeSFJRp7lQpTm9D1GkqJJ56YlyhfXJaUDw7 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)(376014)(366016)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IhQ5AXLLVroGqkhrvM/lYnz3QhXOe6Eulpow/HF6fhr/mXOBVvzig0FRCSG3nGXTbcaIJ7sJzTBHn5v79m7BCoSd+AwQSofJW5ae8G11VnFffTMG7zb86TJ6kSSywshkp4j1ibZAFeXsXL5hwFWpM/OZrmPLV0VFPNytz9RmIKVpv5z4CXtRwbsuWxnUiko83DbGK9MLZKliy4Rgb/DoGR1oUos87vYQbUmgpJtvr9di/oIqlIMT980RjSmEvLDjRBBUPLGSCMlP1Jjn+rqOJuXmOLWppp3JaLJuDKgB/aseJiziqH4xnDtx9w8tkE2eybTjl71ShtIIr+DCr3OcA1WsYy/BvKjXfRjQ6C68it6sfNK57uwvJgXK6d6WXWQa/AostmIwaHrt7q8Z4J+I0n/n/PMx0l0hiPeKcPbTODGiryq/+Ruz5AkYp9jxg2nvamH4p2DaAa5qpsjR/Y1ceWjaG8euWvwBsMnCni6ZpP3POQjnsm8YoCpgc3pyzNnRINMIT/UuI/hOYO2PTGMd6NQkWtm4Rt+h252YcE+XumYgaya9dRyJUd7egIL4VbqLz8VRZoMNeqMypVgDOKvsYCsDCc+KiqR1EcmRL7W2lY6liutjkIecszvocD0IHBg97njVVuUBL4A9N+vmfJ67DN1KcCgxa6gjUQdkofnJgjoZpVEVTzC1Q98vbSEsdAkBbbtpXHKsQCuuK5QGqU6Pnejc56c1WLPz+2pFMwFP8khCyMs6cfyFNGW9pJskj8NjOoQs/Y1yvLYeevZuVjLmk2c2sEOo/FwYpRwEgPFv3QmtAPTmagfCjxr3wHbndu7Ln4HhOTiDi3KP1ZWls/pTM4viNpmPdjoETWXrz15GLZtMBLWLq1tiinr7JHd0t6Zt61K/0t6/eFWLVB0fhb3hDOtPk6FgW/Hq25Vnne+hSTYMCZqPlDo7wU6+Z0kpPC/pwJ1cwUc4q7e4pmJgPUec4RZNNwDZod+e2gH9P4hrT2ULhNECMJ67+dDT0at9cM8edc3v8QmmvXaRwI+RAgGfpCcZyRiSrQnfCB92qmRKwwLT0nvukRoWxo66TnQRKDeQ6cq2fBing5hnA+q4zWLOpJQCaZxzrWu1sAg1Bop4a+Xbupr+5uli1vE4lMXql13WvH3WVBuhbcioKfmMBE4XTtD55vesgkI0VbMiGImK4l6p48xaCBiV2GsE5FrwWvMqJhLihUl1q+1XyfDVYiBh/9U9cgklsC/dly3yBmoBQK6YpdWnUdB1JgNF9YOzvJAJkXgjYApSX6fcN6akf1IM1qo1ER9xFWGHagIU53czRuC7F0GoT6Nqdf8IRR2AkNIXIgLeLUtz2n2vrgaTl66funpFMXH5Gg3dAkjLEUjVXlbVpdVQ7yT+ZzmegtJTaIoq3Vzu6WuBtJBQQRSOsH74I4R5VZclWysoVgxWo35CVEzbRRpVrJMRgzhn1E19njGCIHUKdVtuAMySpb6ZcV+JytNqzZwd4hBsf+KgbUWJ3UtrWa3WJbMwg9AaaT2Ba+hhxshb+GLHwNMVqT8jeidZe/kYul/pX18ZBqYj+I4glvgiXzaj3cOSvZKxTEGr+Qyn X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UB6ze+JPfEi5klNcHHm1WnSGxgSveUCZ2oHxs8GewBZBQutCQVFvzN2mhhxNp7VVqqIS5rc1MM/FTAARGdJcGkRiHtE5Pk0ZIOZCci3z1lxjcfut0jqct4owjsidG4e9VavUlxcbFAVgqEtkxwd+RkdMgiAyYkmPtTz9Nnn1iB/lNueJKO8fRIeHqQvw/+iTWiivIfPkB3QWhvCUhv9E8Wy2GfPln7CStMgboTeydoh5Kfk0jaSR9W4tWaJzs4w92TgnhQpJ6RTUr4aAszkHblbpdN435TY8V/AQ+izVSi4cnfkzM2gMbFI2AdKAeimQTbiEzOuSb+vgCjerPdjVVVOlSocEQUFoFrFoBFsCOylgs9Jdy9Q1PpNqrevu2lHMt4J76GEA4ObCf1A4vGxaaE5/oVIcnaqJKI0hDvU4a17vUF5KN5yMIbf5NmrnIvfqATyNPhlk9EXlGJ+pVrhnhzQTfxadVMwhr2sjp1bMQMOZwAITFcWWy4Ub1xCfWcJj2e/5SJN3Y6sJqdpwAqw6CMZxiyAYEa0kFdYBJAs1aU7tgAfX2KUC2tkdtloLDXJ8cehKeUqleJWzWx7e4o6DsRxdoUKyAmrTDOeiiepTq18= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec264eff-7f71-48ac-b294-08dcf8eda64c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB6538.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 14:17:56.1930 (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: PiZsm92IG/04XawQCj6mfhD3qVlYeqg6Yq4wpdTt/GTGWna5Felcq6zrYeauH85CATC05V8gdUtp8OvQzdVgkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB6328 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-30_12,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410300112 X-Proofpoint-GUID: Am1o7CDdkp1aASuWOjqxXRgG3PRvcVlP X-Proofpoint-ORIG-GUID: Am1o7CDdkp1aASuWOjqxXRgG3PRvcVlP 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org gcc/ChangeLog: * diagnostic-move-history.cc (dump_move_history): New routine. (dump_move_history_for): Likewise. (debug_mv_h): Likewise. * diagnostic-move-history.h (dump_move_history): New prototype. (dump_move_history_for): Likewise. * gimple-ssa-isolate-paths.cc (isolate_path): Add debugging message when setting move history for statements. * tree-ssa-sink.cc (sink_code_in_bb): Likewise. * tree-ssa-threadupdate.cc (ssa_redirect_edges): Likewise. (back_jt_path_registry::duplicate_thread_path): Likewise. --- gcc/diagnostic-move-history.cc | 67 +++++++++++++++++++++++++++++++++ gcc/diagnostic-move-history.h | 2 + gcc/gimple-ssa-isolate-paths.cc | 10 +++++ gcc/tree-ssa-sink.cc | 3 ++ gcc/tree-ssa-threadupdate.cc | 18 +++++++++ 5 files changed, 100 insertions(+) diff --git a/gcc/diagnostic-move-history.cc b/gcc/diagnostic-move-history.cc index b0e8308dbf6b..e4c471ab50f3 100644 --- a/gcc/diagnostic-move-history.cc +++ b/gcc/diagnostic-move-history.cc @@ -24,6 +24,7 @@ #include "backend.h" #include "tree.h" #include "gimple.h" +#include "tree-pretty-print.h" #include "gimple-iterator.h" #include "cfganal.h" #include "diagnostic-move-history.h" @@ -262,3 +263,69 @@ set_move_history_to_stmts_in_bb (basic_block bb, edge entry, return true; } + +/* Dump the move_history data structure MV_HISTORY. */ + +void +dump_move_history (FILE *file, move_history_t mv_history) +{ + fprintf (file, "The move history is: \n"); + if (!mv_history) + { + fprintf (file, "No move history.\n"); + return; + } + + for (move_history_t cur_ch = mv_history; cur_ch; + cur_ch = cur_ch->prev_move) + { + expanded_location exploc_cond = expand_location (cur_ch->condition); + + if (exploc_cond.file) + fprintf (file, "[%s:", exploc_cond.file); + fprintf (file, "%d, ", exploc_cond.line); + fprintf (file, "%d] ", exploc_cond.column); + + fprintf (file, "%s ", cur_ch->is_true_path ? "true" : "false"); + const char *reason = NULL; + switch (cur_ch->reason) + { + case COPY_BY_THREAD_JUMP: + reason = "copy_by_thread_jump"; + break; + case COPY_BY_ISOLATE_PATH: + reason = "copy_by_isolate_path"; + break; + case MOVE_BY_SINK: + reason = "move_by_sink"; + break; + default: + reason = "UNKNOWN"; + break; + } + fprintf (file, "%s \n", reason); + } +} + +/* Dump the move_history date structure attached to the gimple STMT. */ +void +dump_move_history_for (FILE *file, const gimple *stmt) +{ + move_history_t mv_history = get_move_history (stmt); + if (!mv_history) + fprintf (file, "No move history.\n"); + else + dump_move_history (file, mv_history); +} + +DEBUG_FUNCTION void +debug_mv_h (const move_history_t mv_history) +{ + dump_move_history (stderr, mv_history); +} + +DEBUG_FUNCTION void +debug_mv_h (const gimple * stmt) +{ + dump_move_history_for (stderr, stmt); +} diff --git a/gcc/diagnostic-move-history.h b/gcc/diagnostic-move-history.h index cac9cb1e2675..0133f379dbbd 100644 --- a/gcc/diagnostic-move-history.h +++ b/gcc/diagnostic-move-history.h @@ -88,5 +88,7 @@ extern bool set_move_history_to_stmt (gimple *, edge, of the entry edge. */ extern bool set_move_history_to_stmts_in_bb (basic_block, edge, bool, enum move_reason); +extern void dump_move_history (FILE *, move_history_t); +extern void dump_move_history_for (FILE *, const gimple *); #endif // DIAGNOSTIC_MOVE_HISTORY_H_INCLUDED diff --git a/gcc/gimple-ssa-isolate-paths.cc b/gcc/gimple-ssa-isolate-paths.cc index a79b512f63bd..0a6520ee8311 100644 --- a/gcc/gimple-ssa-isolate-paths.cc +++ b/gcc/gimple-ssa-isolate-paths.cc @@ -176,6 +176,16 @@ isolate_path (basic_block bb, basic_block duplicate, incoming edge. */ if (flag_diagnostics_details) { + if (dump_file) + { + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as not on the destination of the edge\n", + bb->index); + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as on the destination of the edge\n", + duplicate->index); + } + set_move_history_to_stmts_in_bb (bb, e, false, COPY_BY_ISOLATE_PATH); set_move_history_to_stmts_in_bb (duplicate, e, true, COPY_BY_ISOLATE_PATH); diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc index 2fddb1a63268..e7ee445feb69 100644 --- a/gcc/tree-ssa-sink.cc +++ b/gcc/tree-ssa-sink.cc @@ -718,6 +718,9 @@ sink_code_in_bb (basic_block bb, virtual_operand_live &vop_live) { edge entry = find_edge (bb, gsi_bb (togsi)); set_move_history_to_stmt (stmt, entry, true, MOVE_BY_SINK); + if (dump_file) + fprintf (dump_file, " Set move history for the stmt" + " as on the destination of the edge\n"); } /* Update virtual operands of statements in the path we diff --git a/gcc/tree-ssa-threadupdate.cc b/gcc/tree-ssa-threadupdate.cc index 4f5a878686f1..a6bbf2fa9e86 100644 --- a/gcc/tree-ssa-threadupdate.cc +++ b/gcc/tree-ssa-threadupdate.cc @@ -1348,6 +1348,15 @@ ssa_redirect_edges (struct redirection_data **slot, incoming edge. */ if (flag_diagnostics_details) { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as not on the destination of the edge\n", + e->dest->index); + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as on the destination of the edge\n", + rd->dup_blocks[0]->index); + } set_move_history_to_stmts_in_bb (e->dest, e, false, COPY_BY_THREAD_JUMP); set_move_history_to_stmts_in_bb (rd->dup_blocks[0], e, @@ -2438,6 +2447,15 @@ back_jt_path_registry::duplicate_thread_path (edge entry, for (i = 0; i < n_region; i++) if (flag_diagnostics_details) { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as not on the destination of the edge\n", + region[i]->index); + fprintf (dump_file, "Set move history for stmts of B[%d]" + " as on the destination of the edge\n", + region_copy[i]->index); + } set_move_history_to_stmts_in_bb (region[i], entry, false, COPY_BY_THREAD_JUMP); set_move_history_to_stmts_in_bb (region_copy[i], entry,