From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 517DE3858C2D for ; Mon, 27 Nov 2023 15:45:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 517DE3858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 517DE3858C2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701099947; cv=none; b=OeW90A9AO3GRftYtQ65G97trnjhU6nu9bZQr0+x1NlZgzRKeofsnLno8WnshgxngzFogHwpT0q1De8zY7rGeqtnQZn2KcuzRh+aXQTBV0WLo6M59mPTgc0m91ovShN2UiPKq8FcWmgZrax+IBCaz8kLHqbiil7AzYNl4V6PJx+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701099947; c=relaxed/simple; bh=HpVFeL4zd3SQUYPFLobzf5UdkIYyYGUa/hy/9NZ8eeE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=sLBv5aqd2UeD9jsNs5QmKs3u6zwkQRhsTmFmCFfMRlUzb8fle8s+VlrBitPqQdLWof3NcH+JAkFKa6TPWrdN/9tGcoo6r9Fp2ajpJ033Om6u2WOQmH9Mvfs4XDzzMbUe7Rce21s+ZBB3IlkKNp9m9ts1dOTZylCCe/dIbCJm0II= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6bd32d1a040so4287985b3a.3 for ; Mon, 27 Nov 2023 07:45:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701099945; x=1701704745; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5PwNu0T8IkveRKArNoGffKPpAXEDY6fHDE109U+bQ8k=; b=ODMTz9Y+Jr9xbT8NusutJ4y3+4KldMWFo1oCSK1304U0rjkF/S8vIki+2xsYcEzsKY 5J2tbBiRQIbDdSlVrmD/9JY1dOwNyb42wFbQdYpZPuD3eUVvmF1Vx0W0+HH/65bNY4Ni tMrFzLX/9BKnwnYR/h5NWkVbqC1Eu5/+ktdnc6vE00Zax07WdCqm3f6908N8PGGg23Io Efc7tLDZMcuSNGzzapkMjTtiELMDA3pLu6ajk6oYB3yEekLFAEVkp8yxQJYlj4CQqOMr nYX9o48jqH3KP5/k2WUURJXyEUv7EI4TDokK9zBnTbGO83uOtRhOazew/dT0Kqq7a79I Lc0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701099945; x=1701704745; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5PwNu0T8IkveRKArNoGffKPpAXEDY6fHDE109U+bQ8k=; b=uNoKq++ap2s0Gglbg1WydlGHoQ+gMzaPiOyQICUQwfy0d2ANu6fEmuShuwhPczVXGf As9MDpw0bX7p6K/5c9QFXaLDEZnbuVa7fKs95hpoUiCUL2j7EGQCxSlYjsi4Brdjx83s H3jhjpTFfmeJ0x4m3ZCELJCUxpGC4HKCIZr1JdC30UBh2Rqiv1OgasVIGR7/pipueISv ZE319wDhnFqanwm+sNIWMfOl9aWGppOXvluuNDu8BqUtFLG0cjKPMQ0kCztS+Zve0hjy wHgx4ougJxFk3XrF5Xb7Z0qlib4EbtSPHG44thzslIG7orA+4D3poxPZQy59WYomEJR4 JBvQ== X-Gm-Message-State: AOJu0YxGhBYn2khvlHHQRQm8p8GoLLbN4rNDngmKoklxL7OD+/WzFvjL b5P4y9znS9ocQg8IqdqC8Fzw2Ag+XiI3ig== X-Google-Smtp-Source: AGHT+IFy/ifmzqABwZjTRsuZyH/MLsFZoLrG0olMBFU8V6cBS6bkGPMy9QPckMBfCmFnLue5Fu+bYQ== X-Received: by 2002:a05:6a20:d90e:b0:18b:d17c:6af2 with SMTP id jd14-20020a056a20d90e00b0018bd17c6af2mr16604012pzb.57.1701099945255; Mon, 27 Nov 2023 07:45:45 -0800 (PST) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id u2-20020a63d342000000b0059ce3d1def5sm7858262pgi.45.2023.11.27.07.45.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Nov 2023 07:45:44 -0800 (PST) Message-ID: Date: Mon, 27 Nov 2023 08:45:39 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH][RFC] middle-end/110237 - wrong MEM_ATTRs for partial loads/stores Content-Language: en-US To: Robin Dapp , Richard Biener , gcc-patches@gcc.gnu.org Cc: "Li, Pan2" References: <20230621075019.7CA813858033@sourceware.org> <5b04dad7-a241-4ad3-b4a5-b81080b67e90@gmail.com> From: Jeff Law In-Reply-To: <5b04dad7-a241-4ad3-b4a5-b81080b67e90@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 List-Id: On 11/27/23 05:39, Robin Dapp wrote: >> The easiest way to avoid running into the alias analysis problem is >> to scrap the MEM_EXPR when we expand the internal functions for >> partial loads/stores. That avoids the disambiguation we run into >> which is realizing that we store to an object of less size as >> the size of the mode we appear to store. >> >> After the patch we see just >> >> [1 S64 A32] >> >> so we preserve the alias set, the alignment and the size (the size >> is redundant if the MEM insn't BLKmode). That's still not good >> in case the RTL alias oracle would implement the same >> disambiguation but it fends off the gimple one. >> >> This fixes gcc.dg/torture/pr58955-2.c when built with AVX512 >> and --param=vect-partial-vector-usage=1. > > On riscv we're seeing a similar problem across the testsuite > and several execution failures as a result. In the case I > looked at we move a scalar load upwards over a partial store > that aliases the load. > > I independently arrived at the spot mentioned in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110237#c4 > before knowing about the PR. > > I can confirm that your RFC patch fixes at least two of the > failures, I haven't checked the others but very likely > they are similar. FWIW, it should always be safe to ignore the memory attributes. So if there's a reasonable condition here, then we can use it and just ignore the attribute. Does the attribute on a partial load/store indicate the potential load/store size or does it indicate the actual known load/store size. If the former, then we probably need to treat it as a may-read/may-write kind of reference. Jeff