Message ID | 20221010185829.312666-1-aldyh@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 B05583857025 for <patchwork@sourceware.org>; Mon, 10 Oct 2022 18:59:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B05583857025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665428346; bh=98kiOkwJgSkgIXh4ktf6H391hSItV0blu+QeIIJZhbY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vnXvNZB82Rghvic4UP61UZQ0A+yzuaAwvCVYvCHXrpR0xcvEiuqKaQXpImAEFCrNL fLDZL8zClyrmCINSjlHDAPoWKBUV5W0MFTunLdnQeDvIFAj/Ahw0jqJESFEHHQXRLW zxLKc+1n0FewfHvX+BH7xyO44VubYau2wmS6Oysw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 830343858C54 for <gcc-patches@gcc.gnu.org>; Mon, 10 Oct 2022 18:58:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 830343858C54 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-332-gkL3-r5jMV-WIu3uNNqudQ-1; Mon, 10 Oct 2022 14:58:36 -0400 X-MC-Unique: gkL3-r5jMV-WIu3uNNqudQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D65411C09C8A for <gcc-patches@gcc.gnu.org>; Mon, 10 Oct 2022 18:58:35 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.108]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B3B9404CD91; Mon, 10 Oct 2022 18:58:35 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 29AIwWwf312711 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Oct 2022 20:58:32 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29AIwWKJ312710; Mon, 10 Oct 2022 20:58:32 +0200 To: GCC patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] Avoid calling tracer.trailer() twice. Date: Mon, 10 Oct 2022 20:58:29 +0200 Message-Id: <20221010185829.312666-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Aldy Hernandez <aldyh@redhat.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Avoid calling tracer.trailer() twice.
|
|
Commit Message
Aldy Hernandez
Oct. 10, 2022, 6:58 p.m. UTC
[Andrew, you OK with this? I can't tell whether the trailer() call was actually needed.] logical_combine is calling tracer.trailer() one too many times causing the second trailer() call to subtract a 0 indent by 2, yielding an indent of SOMETHING_REALLY_BIG :). You'd be surprised how many tools can't handle incredibly long lines. gcc/ChangeLog: * gimple-range-gori.cc (gori_compute::logical_combine): Avoid calling tracer.trailer(). --- gcc/gimple-range-gori.cc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
Comments
It probably should just be changed to a print if it doesn't return.. something like if (idx && res) { tracer.print (idx, "logical_combine produced"); r.dump (dump_file); fputc ('\n', dump_file); } Andrew On 10/10/22 14:58, Aldy Hernandez wrote: > [Andrew, you OK with this? I can't tell whether the trailer() call was > actually needed.] > > logical_combine is calling tracer.trailer() one too many times causing > the second trailer() call to subtract a 0 indent by 2, yielding an > indent of SOMETHING_REALLY_BIG :). You'd be surprised how many tools > can't handle incredibly long lines. > > gcc/ChangeLog: > > * gimple-range-gori.cc (gori_compute::logical_combine): Avoid > calling tracer.trailer(). > --- > gcc/gimple-range-gori.cc | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc > index b37d03cddda..469382aa477 100644 > --- a/gcc/gimple-range-gori.cc > +++ b/gcc/gimple-range-gori.cc > @@ -798,20 +798,12 @@ gori_compute::logical_combine (vrange &r, enum tree_code code, > // would be lost. > if (!range_is_either_true_or_false (lhs)) > { > - bool res; > Value_Range r1 (r); > if (logical_combine (r1, code, m_bool_zero, op1_true, op1_false, > op2_true, op2_false) > && logical_combine (r, code, m_bool_one, op1_true, op1_false, > op2_true, op2_false)) > - { > - r.union_ (r1); > - res = true; > - } > - else > - res = false; > - if (idx) > - tracer.trailer (idx, "logical_combine", res, NULL_TREE, r); > + r.union_ (r1); > } > > switch (code)
Sure. OK? Aldy On Tue, Oct 11, 2022 at 3:11 PM Andrew MacLeod <amacleod@redhat.com> wrote: > > It probably should just be changed to a print if it doesn't return.. > something like > > if (idx && res) > { > tracer.print (idx, "logical_combine produced"); > r.dump (dump_file); > fputc ('\n', dump_file); > } > > Andrew > > On 10/10/22 14:58, Aldy Hernandez wrote: > > [Andrew, you OK with this? I can't tell whether the trailer() call was > > actually needed.] > > > > logical_combine is calling tracer.trailer() one too many times causing > > the second trailer() call to subtract a 0 indent by 2, yielding an > > indent of SOMETHING_REALLY_BIG :). You'd be surprised how many tools > > can't handle incredibly long lines. > > > > gcc/ChangeLog: > > > > * gimple-range-gori.cc (gori_compute::logical_combine): Avoid > > calling tracer.trailer(). > > --- > > gcc/gimple-range-gori.cc | 10 +--------- > > 1 file changed, 1 insertion(+), 9 deletions(-) > > > > diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc > > index b37d03cddda..469382aa477 100644 > > --- a/gcc/gimple-range-gori.cc > > +++ b/gcc/gimple-range-gori.cc > > @@ -798,20 +798,12 @@ gori_compute::logical_combine (vrange &r, enum tree_code code, > > // would be lost. > > if (!range_is_either_true_or_false (lhs)) > > { > > - bool res; > > Value_Range r1 (r); > > if (logical_combine (r1, code, m_bool_zero, op1_true, op1_false, > > op2_true, op2_false) > > && logical_combine (r, code, m_bool_one, op1_true, op1_false, > > op2_true, op2_false)) > > - { > > - r.union_ (r1); > > - res = true; > > - } > > - else > > - res = false; > > - if (idx) > > - tracer.trailer (idx, "logical_combine", res, NULL_TREE, r); > > + r.union_ (r1); > > } > > > > switch (code) >
perfect. On 10/11/22 10:08, Aldy Hernandez wrote: > Sure. > > OK? > Aldy > > On Tue, Oct 11, 2022 at 3:11 PM Andrew MacLeod <amacleod@redhat.com> wrote: >> It probably should just be changed to a print if it doesn't return.. >> something like >> >> if (idx && res) >> { >> tracer.print (idx, "logical_combine produced"); >> r.dump (dump_file); >> fputc ('\n', dump_file); >> } >> >> Andrew >> >> On 10/10/22 14:58, Aldy Hernandez wrote: >>> [Andrew, you OK with this? I can't tell whether the trailer() call was >>> actually needed.] >>> >>> logical_combine is calling tracer.trailer() one too many times causing >>> the second trailer() call to subtract a 0 indent by 2, yielding an >>> indent of SOMETHING_REALLY_BIG :). You'd be surprised how many tools >>> can't handle incredibly long lines. >>> >>> gcc/ChangeLog: >>> >>> * gimple-range-gori.cc (gori_compute::logical_combine): Avoid >>> calling tracer.trailer(). >>> --- >>> gcc/gimple-range-gori.cc | 10 +--------- >>> 1 file changed, 1 insertion(+), 9 deletions(-) >>> >>> diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc >>> index b37d03cddda..469382aa477 100644 >>> --- a/gcc/gimple-range-gori.cc >>> +++ b/gcc/gimple-range-gori.cc >>> @@ -798,20 +798,12 @@ gori_compute::logical_combine (vrange &r, enum tree_code code, >>> // would be lost. >>> if (!range_is_either_true_or_false (lhs)) >>> { >>> - bool res; >>> Value_Range r1 (r); >>> if (logical_combine (r1, code, m_bool_zero, op1_true, op1_false, >>> op2_true, op2_false) >>> && logical_combine (r, code, m_bool_one, op1_true, op1_false, >>> op2_true, op2_false)) >>> - { >>> - r.union_ (r1); >>> - res = true; >>> - } >>> - else >>> - res = false; >>> - if (idx) >>> - tracer.trailer (idx, "logical_combine", res, NULL_TREE, r); >>> + r.union_ (r1); >>> } >>> >>> switch (code)
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index b37d03cddda..469382aa477 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -798,20 +798,12 @@ gori_compute::logical_combine (vrange &r, enum tree_code code, // would be lost. if (!range_is_either_true_or_false (lhs)) { - bool res; Value_Range r1 (r); if (logical_combine (r1, code, m_bool_zero, op1_true, op1_false, op2_true, op2_false) && logical_combine (r, code, m_bool_one, op1_true, op1_false, op2_true, op2_false)) - { - r.union_ (r1); - res = true; - } - else - res = false; - if (idx) - tracer.trailer (idx, "logical_combine", res, NULL_TREE, r); + r.union_ (r1); } switch (code)