From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 109083858CDA for ; Fri, 28 Apr 2023 11:50:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 109083858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1B46321F48; Fri, 28 Apr 2023 11:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682682599; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m9a8nKpuWszTfHc6oB6N1KUp9GEtKgNw0tJYa9B6jzg=; b=meqdK7w7d1tMWKewKc7l9qxbmQDfsHbZT4Fk+fsgRUd3nsP+IaKfQgEYQ5o6IGrEeQDX4L SjT5FQkV9mZ4pzboU18DR5XXuGob0uAmsB2qpWWNWNRV0lusAakKvD+s8ZEloKSCMEmTWs FtFk/wrIgo4eqQctoWU3X6l22wRfmuA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682682599; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m9a8nKpuWszTfHc6oB6N1KUp9GEtKgNw0tJYa9B6jzg=; b=/jjSpodwWsdg0mY+PkTYrWCtVdNZmpfLEcv5Dwdhph5tmH9FU85d1gUXyWNURXYGK9im6u eUoGAVnoBX5eZtBw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0C1E72C18B; Fri, 28 Apr 2023 11:49:59 +0000 (UTC) Date: Fri, 28 Apr 2023 11:49:58 +0000 (UTC) From: Richard Biener To: Tamar Christina cc: gcc-patches@gcc.gnu.org, nd@arm.com, jlaw@ventanamicro.com Subject: Re: [PATCH 3/5] match.pd: CSE the dump output check. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 Fri, 28 Apr 2023, Tamar Christina wrote: > Hi All, > > This is a small improvement in QoL codegen for match.pd to save time not > re-evaluating the condition for printing debug information in every function. > > There is a small but consistent runtime and compile time win here. The runtime > win comes from not having to do the condition over again, and on Arm plaforms > we now use the new test-and-branch support for booleans to only have a single > instruction here. > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. > > Ok for master? OK. Thanks, Richard. > Thanks, > Tamar > > gcc/ChangeLog: > > PR bootstrap/84402 > * genmatch.cc (decision_tree::gen, write_predicate): Generate new > debug_dump var. > (dt_simplify::gen_1): Use it. > > --- inline copy of patch -- > diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc > index 6d62cdea2082d92e5ecc1102c80205115a4e3040..1f52ca2eebc2794159747338babb56c610387f3b 100644 > --- a/gcc/genmatch.cc > +++ b/gcc/genmatch.cc > @@ -3431,7 +3431,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result) > needs_label = true; > } > > - fprintf_indent (f, indent, "if (UNLIKELY (dump_file && (dump_flags & TDF_FOLDING))) " > + fprintf_indent (f, indent, "if (UNLIKELY (debug_dump)) " > "fprintf (dump_file, \"%s ", > s->kind == simplify::SIMPLIFY > ? "Applying pattern" : "Matching expression"); > @@ -3892,6 +3892,8 @@ decision_tree::gen (FILE *f, bool gimple) > } > > fprintf (f, ")\n{\n"); > + fprintf_indent (f, 2, "const bool debug_dump = " > + "dump_file && (dump_flags & TDF_FOLDING);\n"); > s->s->gen_1 (f, 2, gimple, s->s->s->result); > if (gimple) > fprintf (f, " return false;\n"); > @@ -3937,6 +3939,8 @@ decision_tree::gen (FILE *f, bool gimple) > fprintf (f, ", tree _p%d", i); > fprintf (f, ")\n"); > fprintf (f, "{\n"); > + fprintf_indent (f, 2, "const bool debug_dump = " > + "dump_file && (dump_flags & TDF_FOLDING);\n"); > dop->gen_kids (f, 2, gimple, 0); > if (gimple) > fprintf (f, " return false;\n"); > @@ -4046,6 +4050,8 @@ write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple) > gimple ? ", tree (*valueize)(tree) ATTRIBUTE_UNUSED" : ""); > /* Conveniently make 'type' available. */ > fprintf_indent (f, 2, "const tree type = TREE_TYPE (t);\n"); > + fprintf_indent (f, 2, "const bool debug_dump = " > + "dump_file && (dump_flags & TDF_FOLDING);\n"); > > if (!gimple) > fprintf_indent (f, 2, "if (TREE_SIDE_EFFECTS (t)) return false;\n"); > > > > > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)