From patchwork Mon Nov 13 13:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 164490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1205907vqg; Mon, 13 Nov 2023 05:38:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXLgrVZFr8pES08LOPlTpUWlVcUaN5RKn+iZVkZYAoGwcaTpjWr7AqjYcGJjhJ9fxa4/3A X-Received: by 2002:a05:622a:86:b0:412:1c5f:478b with SMTP id o6-20020a05622a008600b004121c5f478bmr10187337qtw.15.1699882737725; Mon, 13 Nov 2023 05:38:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699882737; cv=pass; d=google.com; s=arc-20160816; b=ZVpj6E2bt+YLSkjYS5Vkxc6rcvdvM+vDrP3D3jXkjBhhPY+ky61hvs0TPMGLfDtSJv asYk0Dzyk/tLxUlKNCN1OCVMUr0w8iUQzHJTzaoB3vGF+s9G+rLiVrsvrJvCYD8FIY6+ EVilEtl2H07z+txZKmcvjKa8loajFLr/5wj3lRNAHJ8numCaZ1oMy+6iJ+JdVoXQhlUL exVhzYhaWLf3TXcL7Bq0zen1DgIj7nZYUCBlXlYYGb6YuEwFw/+2DsRHKH2uG86z0HGo JTIAr73wEnZF3s0wavgixldz7pOQqKocOtWF556JkzjKX47hFRsshO/Z/wvXrrAu0Glv gOGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:mime-version:subject :to:from:date:dkim-signature:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=sZzA5AFrZLJ2JNJsD7qP/ctpVix609+dPv0xTDBbBvo=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=V9k4mZFS56//nv3huXGCMCMCnfSQ7wbX4ZuHX3y7vX1d3rzA0X1mO6vqk/cA0hEHim pdvBgYa9Tejp3A1iF/OPTqS4R0ihGd3Xb7p/vVGPp2aTnmoXgYznYqf/PaZvym+ACsFE mXUJzuY1gYLjm/MF5+BhLR8w++chNwo5jVLo2Dd4NwVuPCOh/Wdj9nO7v/+ECP22iO+X Jyh3aTzLocoTrWeoaLeccJbbNi6ZV6egarVOgxjT2LqwiaYKtTnKfXpXQGBA62oSsReE JjCeB3XCAOIGTnpdFltRLgy+p8Foka9NVT6n9Yi1HSfgc8/pT5txPLpFqw7ZbRlm+v4T sIYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Ul4lJJhY; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w15-20020ac87e8f000000b00417f4c0115asi4753030qtj.509.2023.11.13.05.38.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 05:38:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Ul4lJJhY; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 9F5443882049 for ; Mon, 13 Nov 2023 13:38:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1F1253858C66 for ; Mon, 13 Nov 2023 13:38:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F1253858C66 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 1F1253858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699882713; cv=none; b=X0bopcT2MdseiR6f/dfR/2CEpi+paQay7WWwNxt2ovvGSfsWtnJzTJHkGbtreElpyeAJaAvoHK8YhM1PqPdj/VjIHJQi94wRpCPAO+VDMlr6Tj6oYkK4c4rRFV0OD+BO9ZxLq79Tt/pdQ6cN626kRjO9waPvWOS3pH7IdEZkJYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699882713; c=relaxed/simple; bh=l9JoiU8ALYXmbTc5NBqPifu/MU992g5mx7LM+QPRXEo=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:MIME-Version: Message-Id; b=euyPK/fqngJ77FdHeyJPFhbee9TQOunJNAT02PtjLr3ipDkdSP6th7IJQ2afWe/nfdRBGc3HaX/TDqWczi/JI74t2/4c5M52u8qj+UJoHtCIelg1hBmPsIoLsF4FAESc/FmVksaHwdpM+epNq6cn1fpSx+9CT48Sd6yergOq8eo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F1D881F6E6 for ; Mon, 13 Nov 2023 13:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1699882710; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=sZzA5AFrZLJ2JNJsD7qP/ctpVix609+dPv0xTDBbBvo=; b=Ul4lJJhYQSuGaoeYXsCdtIdHp4xq9yo6RoeGRp5tkFMNN7Xs1G6y7uWpMw+6JCqQ94Qg09 AEfepPNFnlTOdWLnfUepJBTvXND88Tr3+y4MCn41Tzqq7iSVO6RwFhYia/CehzBPhh1531 iepyPmxo8XI4pRK5cN7cvy+3KIPABOU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1699882710; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=sZzA5AFrZLJ2JNJsD7qP/ctpVix609+dPv0xTDBbBvo=; b=qIc/d90gOiOAGTZi1OyVdBFtUFo6cQkscW8M9+dgcSVYC9T6Qgwl1zCsNfk3cYt1Uq56dx FcjJA8x33Y3IztCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E0A6613398 for ; Mon, 13 Nov 2023 13:38:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Rk2xNdYmUmXsDwAAMHmgww (envelope-from ) for ; Mon, 13 Nov 2023 13:38:30 +0000 Date: Mon, 13 Nov 2023 14:38:30 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/112495 - alias versioning and address spaces MIME-Version: 1.0 Message-Id: <20231113133830.E0A6613398@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782456241746972467 X-GMAIL-MSGID: 1782456241746972467 We are not correctly handling differing address spaces in dependence analysis runtime alias check generation so refuse to do that. Bootstrapped and tested on x86_64-unknown-linux-gnu. I'm double-checking hundreds of ACATS FAILs (segfaults), will push if those are latent. Richard. PR tree-optimization/112495 * tree-data-ref.cc (runtime_alias_check_p): Reject checks between different address spaces. * gcc.target/i386/pr112495.c: New testcase. --- gcc/testsuite/gcc.target/i386/pr112495.c | 12 ++++++++++++ gcc/tree-data-ref.cc | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr112495.c diff --git a/gcc/testsuite/gcc.target/i386/pr112495.c b/gcc/testsuite/gcc.target/i386/pr112495.c new file mode 100644 index 00000000000..21afbaa6945 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr112495.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef struct { int v; } T1; +typedef struct { T1 v[32]; } T2; + +T1 s; +T1 f1() { return s; } + +void f2(__seg_gs T2 *p, int n) { + for (int i = 0; i < n; ++i) p->v[i] = f1(); +} diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc index 689aaeed722..3549485d251 100644 --- a/gcc/tree-data-ref.cc +++ b/gcc/tree-data-ref.cc @@ -1640,6 +1640,13 @@ runtime_alias_check_p (ddr_p ddr, class loop *loop, bool speed_p) "runtime alias check not supported for" " outer loop.\n"); + /* FORNOW: We don't support handling different address spaces. */ + if (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_A (ddr))))) + != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_B (ddr)))))) + return opt_result::failure_at (DR_STMT (DDR_A (ddr)), + "runtime alias check between different " + "address spaces not supported.\n"); + return opt_result::success (); }