From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id 2FD363858C53 for ; Mon, 17 Apr 2023 22:17:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2FD363858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33HM0eHn003511 for ; Mon, 17 Apr 2023 15:17:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=2QVj25MeuDaBF94cJ1kRiT2G0T3mRzPGb+m0hRWN/h8=; b=UgClVoyXE4oUf9Ie3MKaXcWrLzFU/aV07Ae4nqZxQmuMtsmK+OFCTbKWZr50BrThylhA kZ16FviZRnNxqlzFl3iGyvJiyzwUTIzB3KVOTKnBUpz+j1eyiNEDgrfQLOrjCII8ZhPV hzXVoubUpp5CYYPfuRfLs1prLSLfz7ZY+datXG8BuAsuDwwan7mwPH4qDJ6lfvLGQirI eKuJg+RWkAIsOYJa4UNzyTtgpZOTKg0JffF4cq2x55se09oe2BuWuwiADpDEJuVMpKEu PO17ANknwc51SSe38ixuykaBON6fgaHJIrd3djDzsKUr1ZkU2yvvPNNKSNqvOOC5uXJp mw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3pyuenm7by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 17 Apr 2023 15:17:52 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 17 Apr 2023 15:17:50 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 17 Apr 2023 15:17:50 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 2530E5C68E1; Mon, 17 Apr 2023 15:17:50 -0700 (PDT) From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH 2/2] PHIOPT: add folding/simplification detail to the dump Date: Mon, 17 Apr 2023 15:17:40 -0700 Message-ID: <20230417221740.251864-2-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230417221740.251864-1-apinski@marvell.com> References: <20230417221740.251864-1-apinski@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: -ROyPolDwKFmi4ekLF7gkwTJaitNDUgJ X-Proofpoint-ORIG-GUID: -ROyPolDwKFmi4ekLF7gkwTJaitNDUgJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-17_14,2023-04-17_01,2023-02-09_01 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: While debugging PHI-OPT with match-and-simplify, I found that adding more dumping to the debug dumps made it easier to understand what was going on rather than stepping in the debugger so this adds them. Note I used TDF_FOLDING rather than TDF_DETAILS as these debug messages can be chatty and only needed if you are debugging match and simplify with PHI-OPT and match and simplify uses TDF_FOLDING as its check. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (gimple_simplify_phiopt): Dump the expression that is being tried when TDF_FOLDING is true. (phiopt_worker::match_simplify_replacement): Dump the sequence which was created by gimple_simplify_phiopt when TDF_FOLDING is true. --- gcc/tree-ssa-phiopt.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 4ddb4d5db90..616b5778602 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -916,6 +916,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt, "a != 0". */ tree cond = build2_loc (loc, comp_code, boolean_type_node, cmp0, cmp1); + + if (dump_file && (dump_flags & TDF_FOLDING)) + { + fprintf (dump_file, "\nphiopt match-simplify trying:\n\t"); + print_generic_expr (dump_file, cond); + fprintf (dump_file, " ? "); + print_generic_expr (dump_file, arg0); + fprintf (dump_file, " : "); + print_generic_expr (dump_file, arg1); + fprintf (dump_file, "\n"); + } + gimple_match_op op (gimple_match_cond::UNCOND, COND_EXPR, type, cond, arg0, arg1); @@ -947,6 +959,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt, cond = build2_loc (loc, comp_code, boolean_type_node, cmp0, cmp1); + + if (dump_file && (dump_flags & TDF_FOLDING)) + { + fprintf (dump_file, "\nphiopt match-simplify trying:\n\t"); + print_generic_expr (dump_file, cond); + fprintf (dump_file, " ? "); + print_generic_expr (dump_file, arg1); + fprintf (dump_file, " : "); + print_generic_expr (dump_file, arg0); + fprintf (dump_file, "\n"); + } + gimple_match_op op1 (gimple_match_cond::UNCOND, COND_EXPR, type, cond, arg1, arg0); @@ -1078,6 +1102,11 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb, if (name && TREE_CODE (name) == SSA_NAME) bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name)); } + if (dump_file && (dump_flags & TDF_FOLDING)) + { + fprintf (dump_file, "Folded into the sequence:\n"); + print_gimple_seq (dump_file, seq, 0, TDF_VOPS|TDF_MEMSYMS); + } gsi_insert_seq_before (&gsi, seq, GSI_CONTINUE_LINKING); } -- 2.31.1