From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id CC27C3851C1C for ; Thu, 22 Jul 2021 23:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC27C3851C1C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 16MNpqtF004956; Thu, 22 Jul 2021 18:51:52 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 16MNppcO004954; Thu, 22 Jul 2021 18:51:51 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 22 Jul 2021 18:51:51 -0500 From: Segher Boessenkool To: "bin.cheng" Cc: GCC Patches Subject: Re: 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Message-ID: <20210722235151.GO1583@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 22 Jul 2021 23:52:53 -0000 On Wed, Jul 14, 2021 at 05:14:16PM +0800, bin.cheng via Gcc-patches wrote: > Hi, > I ran into a wrong code bug in code with deep template instantiation when working on sdx::simd. > The root cause as described in commit summary is we skip prologue insns in init_alias_analysis. > This simple patch fixes the issue, however, it's hard to reduce a case because of heavy use of > templates. > Subject: [PATCH 1/2] Don't skip prologue instructions as it could affect alias > analysis > > In init_alias_analysis, we skip prologue instructions but this is > wrong as it could affect base value analysis for registers as well > as following analysis/transformations like cselib and dse: > prologue: > x12 = 0x1810 > sp = sp - x12 > ... > ... > x12 = SYMBOL_REF(.LC89) > Here reg_base_value[12] is set to ".LC89", however this is only true > after the second instruction setting x12. The patch fixes the issue > by just handling prologue instructions as normal. Though ideally it > can be improved in context-sensitive way. In what pass do you get the bad behaviour? dse2? postreload? Or what else? Your patch looks correct, but I'd like to know why it has seemed to work for so long :-) Segher