From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13541 invoked by alias); 23 Aug 2018 13:29:48 -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 8936 invoked by uid 89); 23 Aug 2018 13:29:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=ICEs, ices, UD:is_empty X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Aug 2018 13:29:44 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E5A28AE16 for ; Thu, 23 Aug 2018 13:29:41 +0000 (UTC) Subject: Re: [PATCH] Remove verify_no_unreachable_blocks To: Richard Biener Cc: gcc-patches@gcc.gnu.org References: <4c82136a-7370-1a20-337b-e8c5a480ffab@suse.de> From: Tom de Vries Message-ID: <589d75ed-1ece-fe7f-a7d4-40c3da486cee@suse.de> Date: Thu, 23 Aug 2018 13:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg01471.txt.bz2 On 08/23/2018 02:06 PM, Richard Biener wrote: > On Thu, 23 Aug 2018, Tom de Vries wrote: > >> On 08/23/2018 01:18 PM, Richard Biener wrote: >>> This removes verify_no_unreachable_blocks and implements checking >>> for unreachable blocks in inverted_post_order_compute by simply >>> looking if we reach a block without predecessors that is not the >>> entry block. >>> >> >> I think that doesn't detect unreachable cyles: say you have blocks A and >> B, and A -> B -> A. > > Ah, true. Bah, I guess I can use some other flag in my pass. > >>> This solves a problem I ran into when (ab-)using BB_REACHABLE >>> in a pass and I got comparison failues because of -fchecking vs. >>> -fno-checking. It also should speed up checking builds. >>> >>> Bootstrapped and tested on x86_64-unknown-linux-gnu. >>> >>> Tom, does this make sense? >>> >> >> The intent of the check I added was to verify the assumption stated in >> the comment. I don't know how serious it is if the assumption is violated. > > I think if you have reverse-not-reachable blocks (infinite loops w/o > fake exit edges) that are not reachable from entry it will ICE > or loop infintely. > Hmm, looking at the code a bit more, there's an infinite loop detection mechanism, and I think the case I described above, would run into this assert: ... if (has_unvisited_bb && stack.is_empty ()) { /* No blocks are reachable from EXIT at all. Find a dead-end from the ENTRY, and restart the iteration. */ basic_block be = dfs_find_deadend (ENTRY_BLOCK_PTR_FOR_FN (cfun)); gcc_assert (be != NULL); bitmap_set_bit (visited, be->index); stack.quick_push (ei_start (be->preds)); } ... So perhaps the code already verifies that there are no unreachable blocks, and the comment needs to be updated to: ... This function requires that all blocks in the CFG are reachable from the ENTRY (but not necessarily from EXIT). Otherwise, it ICEs. ... Thanks, - Tom