From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 744C03858C60 for ; Tue, 18 Apr 2023 06:24:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 744C03858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4ec81773cf7so1921122e87.2 for ; Mon, 17 Apr 2023 23:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681799091; x=1684391091; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SaromTPxMQqEzfDaIO2uDgfccYNkSPQIdjQoKqUL+rA=; b=gaDsOaXCibJhqjtR7+vddiBBQcPCtZqIU08UiSiO3WOx7Uj6HKzWQslhWCDkdcamOp lV+s6w3/wFeFjVGhkUjpiyHs5fm1Brsn01SVErQoM6YncwkaX54evAagcQPGY8lBVS9+ iXejycZ0KWaFpo8NsWsMrJcA2W5sGH6j3SPXlUtjli53finIjbmWDeFBASnyWtG1rtm3 x2onY9BaoQy2dOFim6w7mrythu4/u1bffe7xvvuiY5+sD5UdvembQJMMrpUl+nKjuPQH UpWlaGe8kchSNtxJrgpxCbxDUSDXEz2lv8p2h4JSJDmCNUR9+6H5eAVIWMuOzkpSuLFG 8iwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681799091; x=1684391091; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SaromTPxMQqEzfDaIO2uDgfccYNkSPQIdjQoKqUL+rA=; b=KXuQVoDlc8BeOMjKbniBiHIoI+0JcIevVzVyUjeqOQimADJiv0OBMDc65SRYNOmMEW YR+1Xlgjspb+aQkwWIB7yw53E6/k0ENqto5lQHPoJGOmXEiTdzUBSzDESORJc6wFF8yH lNdEq4dsMpZtyqdnTFtTmsXkkcLkFfFdI9hTUvZK6v6qjmYrg8bH8r6YL39TWg2UQsgI DkuJv2k5fgMqmCDC7U4R/SotZWYwLY/NhxNtPGK0ETNFWVBi490pmj9uDsrBnD7/C6+b BiDxgBzItqdHOTo4uaBtFT34w3mhjsUu8EjmRA6V50N+lpMQk3oVOMGz50+h0/RYrSa3 uuMQ== X-Gm-Message-State: AAQBX9eDCTiu/zZ3kENIOIxXC3tQno8mqASW8xTJAjrPHEqyUB1CX5da ko6KPXkTrkfzwo9P5MJt6fEAzdg43ESR558ES8I9OJFz X-Google-Smtp-Source: AKy350YmoxyLNQs+XGbxwEJnzm3eTgyQeCJcfVAK3qYqSpZLJ6Fv5Hm9uLt3ka52uPDp78vMoNFsHTCYlK6W3NhTZXo= X-Received: by 2002:ac2:528b:0:b0:4ec:9e3f:7fb7 with SMTP id q11-20020ac2528b000000b004ec9e3f7fb7mr2917134lfm.12.1681799090966; Mon, 17 Apr 2023 23:24:50 -0700 (PDT) MIME-Version: 1.0 References: <20230417221740.251864-1-apinski@marvell.com> <20230417221740.251864-2-apinski@marvell.com> In-Reply-To: <20230417221740.251864-2-apinski@marvell.com> From: Richard Biener Date: Tue, 18 Apr 2023 08:24:38 +0200 Message-ID: Subject: Re: [PATCH 2/2] PHIOPT: add folding/simplification detail to the dump To: Andrew Pinski Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On Tue, Apr 18, 2023 at 12:18=E2=80=AFAM Andrew Pinski via Gcc-patches wrote: > > 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. OK. > 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, gim= ple *comp_stmt, > "a !=3D 0". */ > tree cond =3D 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, gim= ple *comp_stmt, > cond =3D 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, b= asic_block middle_bb, > if (name && TREE_CODE (name) =3D=3D 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 >