From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70666 invoked by alias); 13 Dec 2017 09:28:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70652 invoked by uid 89); 13 Dec 2017 09:28:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Dec 2017 09:28:29 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C60F6016B; Wed, 13 Dec 2017 09:28:28 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFEBA756A5; Wed, 13 Dec 2017 09:28:27 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vBD9SOHF000769; Wed, 13 Dec 2017 10:28:24 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vBD9SMtm000768; Wed, 13 Dec 2017 10:28:22 +0100 Date: Wed, 13 Dec 2017 09:28:00 -0000 From: Jakub Jelinek To: Alexandre Oliva Cc: David Edelsohn , Jeffrey Law , Richard Biener , Jason Merrill , GCC Patches Subject: Re: [SFN] Bootstrap broken Message-ID: <20171213092822.GE2353@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00802.txt.bz2 On Wed, Dec 13, 2017 at 05:21:01AM -0200, Alexandre Oliva wrote: > index 000000000000..098a1101a3f4 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/torture/pr83391.C > @@ -0,0 +1,34 @@ > +/* PR debug/83391 */ > +/* { dg-do compile } */ If you put this into dg-torture.exp, please add: /* { dg-options "-g" } */ and readd the needed: /* { dg-additional-options "-mbranch-cost=1" { target { i?86-*-* x86_64-*-* mips*-*-* s390*-*-* avr*-*-* } } } */ > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/torture/pr83396.c > @@ -0,0 +1,37 @@ > +/* PR bootstrap/83396 */ > +/* { dg-do compile } */ Please add -g. > --- a/gcc/tree-cfgcleanup.c > +++ b/gcc/tree-cfgcleanup.c > @@ -536,14 +536,23 @@ remove_forwarder_block (basic_block bb) > defined labels and labels with an EH landing pad number to the > new block, so that the redirection of the abnormal edges works, > jump targets end up in a sane place and debug information for > - labels is retained. */ > + labels is retained. > + > + While at that, move any debug stmts that appear before or among > + labels, but not those that can only appear after labels, unless > + the destination block didn't have labels of its own. */ > gsi_to = gsi_start_bb (dest); > - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) > + gsi = gsi_start_bb (bb); > + gimple_stmt_iterator gsie = gsi_after_labels (bb); > + gimple_stmt_iterator gsie_to = gsi_after_labels (dest); > + bool can_move_early_debug_stmts = can_move_debug_stmts > + && (gsi_stmt (gsi) != gsi_stmt (gsie) || gsi_stmt (gsi_to) != gsi_stmt (gsie_to)); Formatting, this should be bool can_move_early_debug_stmts = ... and the line is too long, so needs to be wrapped. Furthermore, I must say I don't understand why can_move_early_debug_stmts should care whether there are any labels in dest bb or not. That sounds very risky for introducing non-# DEBUG BEGIN_STMT debug insns before labels if it could happen. Though, if gsi_stmt (gsi) == gsi_stmt (gsie), then the loop right below it will not do anything and nothing cares about can_move_early_debug_stmts afterwards. So, in short, can_move_early_debug_stmts is used only if gsi_stmt (gsi) != gsi_stmt (gsie), and therefore can_move_early_debug_stmts if it is used is can_move_debug_stmts && (1 || ...); So, can we get rid of can_move_early_debug_stmts altogether and just use can_move_debug_stmts in there instead? Another thing I find risky is that you compute gsie_to so early and don't update it. If you don't need it above for can_move_early_debug_stmts, can you just do it back where it used to be done, > + while (gsi_stmt (gsi) != gsi_stmt (gsie)) > { > tree decl; > label = gsi_stmt (gsi); > if (is_gimple_debug (label) > - ? can_move_debug_stmts > + ? can_move_early_debug_stmts > : ((decl = gimple_label_label (as_a (label))), > EH_LANDING_PAD_NR (decl) != 0 > || DECL_NONLOCAL (decl) > @@ -557,6 +566,20 @@ remove_forwarder_block (basic_block bb) > gsi_next (&gsi); > } > > + /* Move debug statements if the destination has a single predecessor. */ > + if (can_move_debug_stmts && !gsi_end_p (gsi)) > + { > + gcc_assert (gsi_stmt (gsi) == gsi_stmt (gsie)); i.e. here? > + do > + { > + gimple *debug = gsi_stmt (gsi); > + gcc_assert (is_gimple_debug (debug)); > + gsi_remove (&gsi, false); > + gsi_insert_before (&gsie_to, debug, GSI_SAME_STMT); > + } > + while (!gsi_end_p (gsi)); > + } > + > bitmap_set_bit (cfgcleanup_altered_bbs, dest->index); > > /* Update the dominators. */ Jakub