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 46DA23858012; Wed, 31 Mar 2021 08:14:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 46DA23858012 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 15395282CA7; Wed, 31 Mar 2021 10:14:26 +0200 (CEST) Date: Wed, 31 Mar 2021 10:14:26 +0200 From: Jan Hubicka To: "rguenth at gcc dot gnu.org" Cc: gcc-bugs@gcc.gnu.org Subject: Re: [Bug ipa/99835] missed optimization for dead code elimination at -O3 (vs. -O1) Message-ID: <20210331081426.GD14482@kam.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 08:14:30 -0000 > At -O3 the unused 'c' remains. Likely different (recursive?) inlining makes us > process a cgraph cycle in different order and thus fail to elide the output > of 'c' (it's output first at -O3). > > Fixing that would need processing cgraph SCCs with an extra IPA phase in main > optimization so we get a chance to do extra node removal (maybe order > the cycles so that functions we can elide - aka static ones - are processed > last). That would tamper with optimizations that propagate from callee to caller during late optimization, like IPA register allocation, stack alignment propagation or late pure/const discovery. Honza