From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 3D25D3858D37 for ; Sun, 22 Nov 2020 10:23:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3D25D3858D37 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-10-_dpe-eOGNUiaOrBVpOU9GQ-1; Sun, 22 Nov 2020 05:23:21 -0500 X-MC-Unique: _dpe-eOGNUiaOrBVpOU9GQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7413651D9 for ; Sun, 22 Nov 2020 10:23:20 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-127.ams2.redhat.com [10.36.113.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09BDF60BF3; Sun, 22 Nov 2020 10:23:19 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 0AMANH622734244 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 22 Nov 2020 11:23:17 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 0AMANGHv2734243; Sun, 22 Nov 2020 11:23:16 +0100 Date: Sun, 22 Nov 2020 11:23:16 +0100 From: Jakub Jelinek To: Vladimir Makarov Cc: "gcc-patches@gcc.gnu.org" Subject: Re: [Committed] patch fixing LRA crash on s390x Message-ID: <20201122102316.GA3788@tucnak> Reply-To: Jakub Jelinek References: <0b062f7d-4a76-ed49-6959-bb33dbb13823@redhat.com> MIME-Version: 1.0 In-Reply-To: <0b062f7d-4a76-ed49-6959-bb33dbb13823@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2020 10:23:26 -0000 On Sun, Nov 15, 2020 at 12:08:22PM -0500, Vladimir Makarov via Gcc-patches wrote: > --- a/gcc/lra.c > +++ b/gcc/lra.c > @@ -1903,15 +1903,23 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after, > { > /* We already made the edge no-critical in ira.c::ira */ > lra_assert (!EDGE_CRITICAL_P (e)); > - rtx_insn *tmp = BB_HEAD (e->dest); > + rtx_insn *curr, *tmp = BB_HEAD (e->dest); > if (LABEL_P (tmp)) > tmp = NEXT_INSN (tmp); > if (NOTE_INSN_BASIC_BLOCK_P (tmp)) > tmp = NEXT_INSN (tmp); > - start_sequence (); > - for (rtx_insn *curr = after; > - curr != NULL_RTX; > + for (curr = tmp; > + curr != NULL > + && (!INSN_P (curr) || BLOCK_FOR_INSN (curr) == e->dest); > curr = NEXT_INSN (curr)) > + ; > + /* Do not put reload insns if it is the last BB > + without actual insns. In this case the reload insns > + can get null BB after emitting. */ What the above loop does doesn't match what the comment says. Because the loop will result in curr == NULL even if e->dest contains any number of actual insns, only cares about whether e->dest's next_bb has no actual insns or there is no next bb at all. Did you mean something like for (curr = tmp; curr != NULL; curr = NEXT_INSN (curr)) if (INSN_P (curr)) break; (i.e. it would be non-NULL if the e->dest bb contains any actual insns, or if it isn't the last bb and there is at least one further bb with actual insns after it)? See PR97933 for details. Jakub