From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 1E16E3858CD1 for ; Fri, 23 Jun 2023 13:19:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E16E3858CD1 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 289AD28AEDC; Fri, 23 Jun 2023 15:19:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1687526342; h=from:from:reply-to:subject:subject: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=QuaEECRMzPVclH5zmdbynUMGiQH2VoH+cYsUSoKTzyo=; b=kecFgggdqtMS+n7PtXaYyErKBZm3HspqzbbxzjQlq8eewZwcfLU/QlufQ2q3x7Jy4bxPw8 izZNoXTqCGXBFscErPauj58Qh8dZ4VeKKUCsR84D6Sg8UUclt7OZt5hqPfgGadgzmftQqu +90d7XVwpl3h+mur9LRey2ALei3AV7M= Date: Fri, 23 Jun 2023 15:19:01 +0200 From: Jan Hubicka To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: Do not account __builtin_unreachable guards in inliner Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > > So you need to feed it with extra info on the optimized out stmts because > as-is it will not remove __builtin_unreachable (). That means you're My plan was to add entry point to tree-ssa-dce that will take an set of stmts declared dead by external force and will do the usual mark stage bypassing mark_stmt_if_necessary if the stmt is in the set of deads. > doing the find_obviously_necessary_stmts manually, skipping the > conditional and all stmts it controls to the __builtin_unreachable () path? > > I also think you want something cheaper than non-cd-dce mark, you also don't > want to bother with stores/loads? You are probably right. cd-dce marking became bit of a monster and I do not want to care about memory. One can add extra flag to avoid processing of memory, but the code I would re-use is quite small. I can do my own mark&sweep just considering phis, pre-identified conditionals and basic gimple_assigns with no side effects as possibly unnecesary stmts. I can completely ignore debug stmts. So it should be one pass through the statments to populate the worklist & simple walk of the ssa graph to propagae it. > > Also when you only do this conditional how do you plan to use the result? Well, the analysis is a loop that walks all basic blocks and then all stmts. I can keep track if computation of live stmts was done and in that case query the flag assume it is true otherwise. Honza