From patchwork Wed Dec 13 07:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 177811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7613398dys; Wed, 13 Dec 2023 00:00:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGikQRkfQ8umKVW+J3h2lwcRjTJR56o7JA3n2ssrY7L7XyWSXG/3bPYSXneCaNAOeSZNp3y X-Received: by 2002:ac8:7e89:0:b0:425:95bf:212e with SMTP id w9-20020ac87e89000000b0042595bf212emr10207765qtj.12.1702454409564; Wed, 13 Dec 2023 00:00:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702454409; cv=pass; d=google.com; s=arc-20160816; b=fH/fypfGKRJrwIesvk8Q6/1a/JedABBnkPpgY1jW1G7bz8IkZIZa+w9m1HkoO+eNj+ xJfc9aE92PEHHaWKqQitJJkT+7zdoxkB6k8c5+XlzBNc0u5IY5qIDMyA/wCCx9bOjTXa nlE0/5tBsMmlkrAyhFvFXGaPrTOqq1LyVFhrEVP34SB3vKzGWXhmeQZAiOJvy7nD805Q Vllh1V2+xh0cgfiBzPxAWFIiRIG2G9grALC1pqMI2oydEGLTMEskODzXnmHktL0EuC7m pbwioRJLZBwSiQ6qc3XY0tmS9JupYM+K0GOx5nM6l5Et+gkq0IkjkKMua8sx7sUFFIsC rgWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:errors-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :subject:to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=Cz1h/JCj59s5gOI84hkTBAVaDcRDGm6vBahL/u5p/Fg=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=JNeNhyDjRJf7L+ZvCBZqmsHsNB3OuA0ZcJd+82kenr6kloIdQ0JbYmL6m6c3ilmicl whQCJ9DdCCnmomusJ8+pS5wSmGAaH11/9lhvDWG28pqyBoFqGvwJDC2+ZZxO1YdBN+a3 sPdWCQkVYhqM1DEu2JhvJ3v5Or5dZau4gA1aWEPS/78/JHVF6p76eNsgTA1hgtDxNLQs FZ7zMOuZOP0HMh9AZa6RZxdVPDIeDTEC59UGlGgA9IvStSR3955SZ8wvcBCSiOravtD2 foPPoBJoCuPOiBopJ5xfo6sLiLCXM9d+ImnqZri8OqosUHXU8WW+txyaIbPUjT7ppH3K o+vg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=NdKBVy7d; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=NdKBVy7d; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u34-20020a05622a19a200b004259f6d6eddsi12520359qtc.93.2023.12.13.00.00.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 00:00:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=NdKBVy7d; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=NdKBVy7d; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E0F4385AE43 for ; Wed, 13 Dec 2023 08:00:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 3D72E385AC12 for ; Wed, 13 Dec 2023 07:59:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D72E385AC12 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3D72E385AC12 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702454386; cv=none; b=vLLh/3UMO8KBEUeZU2Gxsmltqhv7F39CUutBUkr2CZQiT84OfsQO/ZGpQTysJ0oV7vYnXjfc5I57Wquf9uBqIcXHQvAWXr2lLV4izY/y3bUcxf7G+uV13XQyvUY96Ybko2jTGXLjm16+d7Bs+J4QFBl+Nrnn7rfnHym9wLvXQfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702454386; c=relaxed/simple; bh=0P96h/Be6mMJd2FTNGTkgp3wdyBXD71OzAZOHPWzMpM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=swjKLqdqwV9gM45b37OPVj6hqKTaWIB/lUDvMHcjZ3cavllNZOYpHjyCkCvGy/sig9ybTvwx896iQkYpUJtIWgHZgEmd+/G29R098kPhB8yjm49qcKMZcxV8/GgS0WV4MElbPaaON+2N0UBmqf6HDlY5tqMKVgIqqM72rI41k4A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3172B22561 for ; Wed, 13 Dec 2023 07:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702454384; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=Cz1h/JCj59s5gOI84hkTBAVaDcRDGm6vBahL/u5p/Fg=; b=NdKBVy7dx0WLaHwXXeZhEpKi01iwPccQDok/ClPnyLEt+sS840ehmJ8jeVwOJlnLvOD2u6 ZYujmb+ZR64ILp1Gkx33+d68Ir39yIUb6u6JrZRwV3myfapKPTwxMlgv9R0a6U/QZgob6L fYStWf/XKCz3DNjJnapEieMmJt1PsnQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702454384; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=Cz1h/JCj59s5gOI84hkTBAVaDcRDGm6vBahL/u5p/Fg=; b=kKTXke1rngY/Os4ajGuWx9W3MjYjwflgVPdd1kimrJJ74SnZMJZWGDbBXkgJnPFNxFnOb8 oDyXdRuF3+ZngVAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702454384; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=Cz1h/JCj59s5gOI84hkTBAVaDcRDGm6vBahL/u5p/Fg=; b=NdKBVy7dx0WLaHwXXeZhEpKi01iwPccQDok/ClPnyLEt+sS840ehmJ8jeVwOJlnLvOD2u6 ZYujmb+ZR64ILp1Gkx33+d68Ir39yIUb6u6JrZRwV3myfapKPTwxMlgv9R0a6U/QZgob6L fYStWf/XKCz3DNjJnapEieMmJt1PsnQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702454384; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=Cz1h/JCj59s5gOI84hkTBAVaDcRDGm6vBahL/u5p/Fg=; b=kKTXke1rngY/Os4ajGuWx9W3MjYjwflgVPdd1kimrJJ74SnZMJZWGDbBXkgJnPFNxFnOb8 oDyXdRuF3+ZngVAw== Date: Wed, 13 Dec 2023 08:58:40 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/111591 - explain why TBAA doesn't need adjustment MIME-Version: 1.0 X-Spam-Score: 1.40 Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 1.56 X-Spamd-Result: default: False [1.56 / 50.00]; TO_DN_NONE(0.00)[]; NEURAL_HAM_SHORT(-0.10)[-0.510]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[22.88%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.73)[-0.733]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_ONE(0.00)[1]; MISSING_MID(2.50)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com] X-Spam-Flag: NO X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Message-Id: <20231213080009.3E0F4385AE43@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785152834858122480 X-GMAIL-MSGID: 1785152834858122480 While tidying the prototype patch I've done for the reduced testcase in PR111591 and in that process trying to produce a testcase that is miscompiled by stack slot coalescing and the TBAA info that remains un-altered I've realized we do not need to adjust TBAA info. The following documents this in the place we adjust points-to info which we do need to adjust. Pushed. Feel free to poke holes into the argument. Richard. PR middle-end/111591 * cfgexpand.cc (update_alias_info_with_stack_vars): Document why not adjusting TBAA info on accesses is OK. --- gcc/cfgexpand.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 21ba84ab30b..8f6451e44ff 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -786,7 +786,13 @@ add_partitioned_vars_to_ptset (struct pt_solution *pt, /* Update points-to sets based on partition info, so we can use them on RTL. The bitmaps representing stack partitions will be saved until expand, where partitioned decls used as bases in memory expressions will be - rewritten. */ + rewritten. + + It is not necessary to update TBAA info on accesses to the coalesced + storage since our memory model doesn't allow TBAA to be used for + WAW or WAR dependences. For RAW when the write is to an old object + the new object would not have been initialized at the point of the + read, invoking undefined behavior. */ static void update_alias_info_with_stack_vars (void)