From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id CDEF73858D33 for ; Mon, 28 Aug 2023 07:10:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDEF73858D33 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-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2bcde83ce9fso42737141fa.1 for ; Mon, 28 Aug 2023 00:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693206616; x=1693811416; 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=4nWUqiVj/KDgV0xhOix9Q7PgkuQyqhtPlio5R5hP4UA=; b=iCsrX2jGooe+5jJAI/wG6XfPiiCtlUVSbGy8X1dDOM+BuuQwld6oVRrZk3a0SGMcD+ qIMdl6fkjsAV65feXOn4xs6HyEv0k4XBarkjRFO8aX7IS+GIXWZkYIgwz1dzSOvPrf9E piKhPXBnEtQhR8dplRnv3qdu9oQGx2QWVzUBpLxc+CjdjIJwisuTdoUurHjDbbT4/z6w M1sTM6+9UIpRTUFrl4T0zymvJPniJz+BeZFj0xNznsJDK94feS0nLFFtc1zk7qmmACsx jegCL8HoFDhEnsZCN/NedxYfmVbqa2xgsvMdFVhWCvi0V1PO1t6hgWpcLBF3AQWC/fQz gV9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693206616; x=1693811416; 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=4nWUqiVj/KDgV0xhOix9Q7PgkuQyqhtPlio5R5hP4UA=; b=ZlyzSYiLTFwmDwe13GpZhM0ifdhLlLFyWwWWHrgbeUNfW2NCX7p5SQLoxHKlE6X/B9 QTx+l179tHefAyP+v4JTLizcnL+zUzFR7WBzhlqkSjdbbn3/CZ7jrSy2v5HHLz8MtL3I P9C7XrIc1PMUZ67YoQ6RQVHT2hZ82M5fj8pmYQJczbhSC8Of2rBc69hblaKWf0QEBhLo W/h9+HZy0eujyCclmidc8/DVo6cJ+B6vj4p6AOlf+cfiJBS0D6eIOWbpSm7g6Lrjr6Mh Ivn1cKIdxzp4dCRU9weY07dqdin0aEFnWif8yuYbFqIbZdZuM7twa1m1x6qAqXCAvpdJ YZkA== X-Gm-Message-State: AOJu0YxLB+2mrAX2cRil8f5GCARuSOtTLY/Nxum9dH6JrarBeAuJms6r Wx53nGGmHkGlqX24BnJmsEwLRXn/zeP0LR3DuZriYs8a X-Google-Smtp-Source: AGHT+IFuzZeuTDek/FdbIPVmHPuJN6Z0LnMPtuc+8KQsy94L8ylnKh0zLBb4dNGf7o4fOYVNPr02BU5q66M8UE0kDx0= X-Received: by 2002:a2e:91d8:0:b0:2bc:c3c0:a997 with SMTP id u24-20020a2e91d8000000b002bcc3c0a997mr15980466ljg.38.1693206615998; Mon, 28 Aug 2023 00:10:15 -0700 (PDT) MIME-Version: 1.0 References: <20230826021458.3624086-1-apinski@marvell.com> In-Reply-To: <20230826021458.3624086-1-apinski@marvell.com> From: Richard Biener Date: Mon, 28 Aug 2023 09:08:38 +0200 Message-ID: Subject: Re: [PATCH] PHIOPT: Add dump for match and simplify and early phiopt 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.7 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 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 Sat, Aug 26, 2023 at 4:16=E2=80=AFAM Andrew Pinski via Gcc-patches wrote: > > This adds dump on the full result of the match-and-simplify > for phiopt and specifically to know if we are rejecting something > due to being in early phi-opt. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. OK. Richard. > gcc/ChangeLog: > > * tree-ssa-phiopt.cc (gimple_simplify_phiopt): Add dump informati= on > when resimplify returns true. > (match_simplify_replacement): Print only if accepted the match-an= d-simplify > result rather than the full sequence. > --- > gcc/tree-ssa-phiopt.cc | 70 ++++++++++++++++++++++++++---------------- > 1 file changed, 44 insertions(+), 26 deletions(-) > > diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc > index 7e63fb115db..9993bbe5b76 100644 > --- a/gcc/tree-ssa-phiopt.cc > +++ b/gcc/tree-ssa-phiopt.cc > @@ -499,7 +499,6 @@ gimple_simplify_phiopt (bool early_p, tree type, gimp= le *comp_stmt, > tree arg0, tree arg1, > gimple_seq *seq) > { > - tree result; > gimple_seq seq1 =3D NULL; > enum tree_code comp_code =3D gimple_cond_code (comp_stmt); > location_t loc =3D gimple_location (comp_stmt); > @@ -529,18 +528,29 @@ gimple_simplify_phiopt (bool early_p, tree type, gi= mple *comp_stmt, > > if (op.resimplify (&seq1, follow_all_ssa_edges)) > { > - /* Early we want only to allow some generated tree codes. */ > - if (!early_p > - || phiopt_early_allow (seq1, op)) > + bool allowed =3D !early_p || phiopt_early_allow (seq1, op); > + tree result =3D maybe_push_res_to_seq (&op, &seq1); > + if (dump_file && (dump_flags & TDF_FOLDING)) > { > - result =3D maybe_push_res_to_seq (&op, &seq1); > + fprintf (dump_file, "\nphiopt match-simplify back:\n"); > + if (seq1) > + print_gimple_seq (dump_file, seq1, 0, TDF_VOPS|TDF_MEMSYMS); > + fprintf (dump_file, "result: "); > if (result) > - { > - if (loc !=3D UNKNOWN_LOCATION) > - annotate_all_with_location (seq1, loc); > - gimple_seq_add_seq_without_update (seq, seq1); > - return result; > - } > + print_generic_expr (dump_file, result); > + else > + fprintf (dump_file, " (none)"); > + fprintf (dump_file, "\n"); > + if (!allowed) > + fprintf (dump_file, "rejected because early\n"); > + } > + /* Early we want only to allow some generated tree codes. */ > + if (allowed && result) > + { > + if (loc !=3D UNKNOWN_LOCATION) > + annotate_all_with_location (seq1, loc); > + gimple_seq_add_seq_without_update (seq, seq1); > + return result; > } > } > gimple_seq_discard (seq1); > @@ -572,18 +582,29 @@ gimple_simplify_phiopt (bool early_p, tree type, gi= mple *comp_stmt, > > if (op1.resimplify (&seq1, follow_all_ssa_edges)) > { > - /* Early we want only to allow some generated tree codes. */ > - if (!early_p > - || phiopt_early_allow (seq1, op1)) > + bool allowed =3D !early_p || phiopt_early_allow (seq1, op1); > + tree result =3D maybe_push_res_to_seq (&op1, &seq1); > + if (dump_file && (dump_flags & TDF_FOLDING)) > { > - result =3D maybe_push_res_to_seq (&op1, &seq1); > + fprintf (dump_file, "\nphiopt match-simplify back:\n"); > + if (seq1) > + print_gimple_seq (dump_file, seq1, 0, TDF_VOPS|TDF_MEMSYMS); > + fprintf (dump_file, "result: "); > if (result) > - { > - if (loc !=3D UNKNOWN_LOCATION) > - annotate_all_with_location (seq1, loc); > - gimple_seq_add_seq_without_update (seq, seq1); > - return result; > - } > + print_generic_expr (dump_file, result); > + else > + fprintf (dump_file, " (none)"); > + fprintf (dump_file, "\n"); > + if (!allowed) > + fprintf (dump_file, "rejected because early\n"); > + } > + /* Early we want only to allow some generated tree codes. */ > + if (allowed && result) > + { > + if (loc !=3D UNKNOWN_LOCATION) > + annotate_all_with_location (seq1, loc); > + gimple_seq_add_seq_without_update (seq, seq1); > + return result; > } > } > gimple_seq_discard (seq1); > @@ -855,6 +876,8 @@ match_simplify_replacement (basic_block cond_bb, basi= c_block middle_bb, > > if (!result) > return false; > + if (dump_file && (dump_flags & TDF_FOLDING)) > + fprintf (dump_file, "accepted the phiopt match-simplify.\n"); > > auto_bitmap exprs_maybe_dce; > > @@ -881,11 +904,6 @@ match_simplify_replacement (basic_block cond_bb, bas= ic_block middle_bb, > if (name && TREE_CODE (name) =3D=3D SSA_NAME) > bitmap_set_bit (exprs_maybe_dce, 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 >