From patchwork Mon Jan 15 13:34:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 188164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1707384dyc; Mon, 15 Jan 2024 05:40:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4fBJDyjLGeUGhfgB+cTLGUcf45UAHNWe+rq9sVqRfizRYSd6FNzqUU6EVMHm2Qi4a6Xyu X-Received: by 2002:a05:620a:55b6:b0:781:428b:78be with SMTP id vr22-20020a05620a55b600b00781428b78bemr6211195qkn.134.1705326013785; Mon, 15 Jan 2024 05:40:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705326013; cv=pass; d=google.com; s=arc-20160816; b=Q9iwCuM16QUgeuMzFB8QOAJl/w/MY2TklW3JT2l//vlWgw7VsT/J8dM1N9qq1tXaEW ds13viF2Yv3uqKlqf8Mkzgv/UkuzX0RHOdi5CVK8C/OKJosyZ/oFon7BudUEukPq9yAm /ONr200uR0T4P2u/CtXVLJkkNzYlLtvNQRqDmRVPD+hZZv+mZ2IGcbQtAVY+mtwB7Cqu daLfKsq9J1pS92x8FtZhkXfMS+AUGbl8Hca4WYsbL8nwmtAL4fHlnS540T75tP20byWm K4DoxzxOeMQk9Erub5RxZs76sORitwPEdEJUYx5RucYwFl99C1m04BOzo2x8BQaQK8z/ 8DdQ== 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:cc:to:from:date:dkim-signature:dkim-signature :dkim-signature:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=2M7U7TCMtOL+qn2haQDHrHyrktpb/DMFcGk6937LPZ4=; fh=4icfLXwwrMRy3raFm7E1ipqC3Cpq+fl6ViI9AtytY8I=; b=pPODli/KEMV2fvbLxiKKmvwusE+J4LsKCJ0ove2LWTWhCODLNnewzqYjfXYdArQIjP VflXuiGxp5EkjzgEwCZYzViC2HpEQfdfWAxBiR2e00yXB8RWiMZxbFNRWglYBJBqRFRe 0vNINA099Wq5gwJN4VHzTehs7fLkf44MUxW2amwBFtgwpSsQkzeZ95rhmWNt8G5gqLeB saoTXJulKH5VCmQYLX9SqenOy46i+ybqpVH9KCSfSIaeHO42VFte+Mz5D1Na8dddwojk hTVxTHQKrvhfyQvukUV8aPlK1BMCyvlc8Py1ixH4K+hLzOsr9o82UqIsTffymh1UlgXY cYsw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MP6ym8Dp; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=I4VzoCLS; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MP6ym8Dp; 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 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 j24-20020a05620a0a5800b0078366fee510si1134qka.166.2024.01.15.05.40.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 05:40:13 -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=MP6ym8Dp; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=I4VzoCLS; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MP6ym8Dp; 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 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 752A73858C54 for ; Mon, 15 Jan 2024 13:40:13 +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 [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 8B15B3858D1E for ; Mon, 15 Jan 2024 13:39:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B15B3858D1E 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 8B15B3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705325971; cv=none; b=fUhWF5DunKUludmfxalDGXT1t33EPrQ2qX6DLYtADp8HQxvtvZGiL2tplJ9e4lIGvpSIBAtTRML9vJvERsdsm1ZUIhZBVjDefAa1ycaHEcErGlf2kSj6Hf8p7eGYQ7fz40YUDVUmoLwtICT3YyWK2Ue1QKsEf7g2p4wzTq/ls6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705325971; c=relaxed/simple; bh=3UmL34aT8OIiNJteW/LRIVCBRpArj6CIkiYl8EL1cbM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=Sb8WuTcFplmWw7J6Hh/Tgj8/Bk8GukT07ymEA+G1+p1DzXyczozUkqtR5RGyi7VXC2TmZMRezhXQrixekR6Ph7fdGqj8JKNBDUViwJXweC89IVEceUTlpPe4DGC6GkOyaDI/aL8ZW3wOJK+reg1eTegLBjtKHm2kUxY3Xpkt0qk= 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-out2.suse.de (Postfix) with ESMTPS id 79A301F88D; Mon, 15 Jan 2024 13:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705325968; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=2M7U7TCMtOL+qn2haQDHrHyrktpb/DMFcGk6937LPZ4=; b=MP6ym8DpdZBD5gEwHmek+YKRaujGyNrZO0LgQNSlBos2+Lb0HWY5IEtxo332fnCNXG9WTY mUXno4Xae9ZsirBiZ7GbdViNTjUQXy9jqDrp/G/GN9dtF38+myUgBpnJ07W8LZMLcIlSCO wOchy9EOfdmBmmaxQo4yGIgeYi9w/a8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705325968; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=2M7U7TCMtOL+qn2haQDHrHyrktpb/DMFcGk6937LPZ4=; b=I4VzoCLSdDKjpB5OErlXNJWHWD96/t+iIWnYfDiRLR7Xb0ulGyOS1AAd0oyiE43YIVDStr Vd8+LPF7U6kxhmCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705325968; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=2M7U7TCMtOL+qn2haQDHrHyrktpb/DMFcGk6937LPZ4=; b=MP6ym8DpdZBD5gEwHmek+YKRaujGyNrZO0LgQNSlBos2+Lb0HWY5IEtxo332fnCNXG9WTY mUXno4Xae9ZsirBiZ7GbdViNTjUQXy9jqDrp/G/GN9dtF38+myUgBpnJ07W8LZMLcIlSCO wOchy9EOfdmBmmaxQo4yGIgeYi9w/a8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705325968; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=2M7U7TCMtOL+qn2haQDHrHyrktpb/DMFcGk6937LPZ4=; b=I4VzoCLSdDKjpB5OErlXNJWHWD96/t+iIWnYfDiRLR7Xb0ulGyOS1AAd0oyiE43YIVDStr Vd8+LPF7U6kxhmCw== Date: Mon, 15 Jan 2024 14:34:23 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: jlaw@ventanamicro.com, ebotcazou@adacore.com, Jakub Jelinek Subject: [PATCH 1/2] rtl-optimization/113255 - base_alias_check vs. pointer difference MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-0.60 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MISSING_MID(2.50)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%] X-Spam-Level: X-Spam-Score: -0.60 X-Spam-Status: No, score=-10.8 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: <20240115134013.752A73858C54@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788163929965492189 X-GMAIL-MSGID: 1788163929965492189 When the x86 backend generates code for cpymem with the rep_8byte strathegy for the 8 byte aligned main rep movq it needs to compute an adjusted pointer to the source after doing a prologue aligning the destination. It computes that via src_ptr + (dest_ptr - orig_dest_ptr) which is perfectly fine. On RTL this is then 8: r134:DI=const(`g'+0x44) 9: {r133:DI=frame:DI-0x4c;clobber flags:CC;} REG_UNUSED flags:CC 56: r129:DI=const(`g'+0x4c) 57: {r129:DI=r129:DI&0xfffffffffffffff8;clobber flags:CC;} REG_UNUSED flags:CC REG_EQUAL const(`g'+0x4c)&0xfffffffffffffff8 58: {r118:DI=r134:DI-r129:DI;clobber flags:CC;} REG_DEAD r134:DI REG_UNUSED flags:CC REG_EQUAL const(`g'+0x44)-r129:DI 59: {r119:DI=r133:DI-r118:DI;clobber flags:CC;} REG_DEAD r133:DI REG_UNUSED flags:CC but as written find_base_term happily picks the first candidate it finds for the MINUS which means it picks const(`g') rather than the correct frame:DI. This way find_base_term (but also the unfixed find_base_value used by init_alias_analysis to initialize REG_BASE_VALUE) performs pointer analysis isn't sound. The following restricts the handling of multi-operand operations to the case we know only one can be a pointer. This for example causes gcc.dg/tree-ssa/pr94969.c to miss some RTL PRE (I've opened PR113395 for this). A more drastic patch, removing base_alias_check results in only gcc.dg/guality/pr41447-1.c regressing (so testsuite coverage is bad). I've looked at gcc.dg/tree-ssa tests and mostly scheduling changes are present, the cc1plus .text size is only 230 bytes worse. With the this less drastic patch below most scheduling changes are gone. x86_64 might not the very best target to test for impact, but test coverage on other targets is unlikely to be very much better. Bootstrapped and tested on x86_64-unknown-linux-gnu (together with 2/2). Jeff, can you maybe throw this on your tester? Jakub, you did the PR64025 fix which was for a similar issue. OK for trunk? Thanks, Richard. PR rtl-optimization/113255 * alias.cc (find_base_term): Remove PLUS/MINUS handling when both operands are not CONST_INT_P. * gcc.dg/torture/pr113255.c: New testcase. --- gcc/alias.cc | 28 +++++-------------------- gcc/testsuite/gcc.dg/torture/pr113255.c | 27 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr113255.c diff --git a/gcc/alias.cc b/gcc/alias.cc index 99008b0390d..bdc119822b4 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -2077,31 +2077,13 @@ find_base_term (rtx x, vec= 0) + { + r++; + e[1].y++; + } + g[1] = e[1]; + return r; +} + +int +main () +{ + test (1); + if (g[1].y != 1) + __builtin_abort (); + return 0; +} From patchwork Mon Jan 15 13:34:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 188167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1707852dyc; Mon, 15 Jan 2024 05:41:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq7moEoExxwF1JEQ8Z1SRV8MTmvjLtG3XG3RbSoll+110sFSDcasVFMB7PmvstUaZb6XKd X-Received: by 2002:a5b:d0b:0:b0:dbd:9662:73dc with SMTP id y11-20020a5b0d0b000000b00dbd966273dcmr2602141ybp.75.1705326073218; Mon, 15 Jan 2024 05:41:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705326073; cv=pass; d=google.com; s=arc-20160816; b=ZIqgqJJw/PjryGFumAy0J02BQoWw6UksY0U4vi0MOqlRAUuWlRfSO1LvEjZx5uPGXc eolDB3GJunV4A7kVl3/Nv7udvHnt/I6bD+MZHYLlC4FNqIcHlOukdUjw/kZNpwY18Z0y gIRkwDtEJYPRbsB8WTW5ScZTc3RgOFs5P0yaUCjjuck9AzYPLYDUd/kdD5/dDynrrL26 rwYLajEqxGE7ZFmWac5lL5cpC2ZdKHHGr3JhxG+fb0ct5r/ZF7I2rn6xhlSytgP93JoO G3d2xbTquEIqXZ8SN6RlSV9+k3eFy42IeeeYPMyQYzDc4fVA6falomvXZg9/ZWnD51lW 9ZaA== 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=ZPSWvo854fjXuPnbcdPUUMS7PhLLJh9DGf7weI5xj4E=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=NCGGGhkXEPwkAiGX2MPjS6Hi3sjy0vDLTYoeI2xidKjzcZW+XRhFGZuLMnS/Yjku9O EwwDT7oY0aTXFj1tU3YViX9yY47bHUNqmAtbtbncOdrIaw/+GSTWUAL7lZcSrMLFj9jA LLQUJw3YwBWVj9xTxNr8Zo0k52zjzjCLU+6C6JBFU2UpqDmicHZ1TIzDpay2y75Gv0rN O3aOkJWZg7DwL0GrjI5MyazwCkUkOIP+4eXls+U1gmT4ZCNd0K/P2I/Sh5pYCCxRl8Gj Ka2mLJKO7TQV6yB5IgOj7VOFxYU7n3X2X8Pl/Il5thPwxKz0FAGGZxKI/i8DQxdzTQSz TzvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gBBJlYBh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gBBJlYBh; 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 c17-20020ac85a91000000b00429be55c7b0si8013475qtc.17.2024.01.15.05.41.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 05:41:13 -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=gBBJlYBh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gBBJlYBh; 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 E83AB3858418 for ; Mon, 15 Jan 2024 13:41:12 +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 [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id D4D9B3858D28 for ; Mon, 15 Jan 2024 13:39:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D4D9B3858D28 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 D4D9B3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705325976; cv=none; b=WbA1cPUNZeD1IcCNi06zvQGi9Wwk866rJQ4jYNIevuOT04Rz2stfZ2RBtDaKQVQsUerGdAAVmKQKPfXtldiI9AfRdTBlPq2PYUNefADS0EUuYWVgj6Gwzxoi3NtJLA+SMowEQLp77seB0q+0LGIbIwdQTKDETggnXoU6lDLFUy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705325976; c=relaxed/simple; bh=KdMK8Ig5zjC5XlTzeCjmgVLb8gHRfj61bHREEKOkmMs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=Nnw8FB+phqn/BmL0H8J/F1eLiA34Cq/O3FsXmqMpMLbqsX/UjXcvGCb5/5zOqmktd87fGt8kK1ga/tmGp9766b2XSGs1/EpFSbxXdLSK4YxyI+qTmJj4RcuY82x8oyFQQZVOLKFi4Tz0aXKEZYgSiJD++k61eOdzLh054ZF8eL8= 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 F0B1B21E88 for ; Mon, 15 Jan 2024 13:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705325974; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=ZPSWvo854fjXuPnbcdPUUMS7PhLLJh9DGf7weI5xj4E=; b=gBBJlYBhXdHwUkydD0tVstR2LemQ45woFqLOJxxwHQPmlxr/sotM4nvcZNkCSbqain6LFr NrkGpbBeYkzNq8gCwsLeuY8eCkW9s8OcJrKCTVbd9Gf4WzggotaCj+90Wr4vORXAeTWTyx kLe3AMvyZsNANoTjsC1dO4+340gNP8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705325974; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=ZPSWvo854fjXuPnbcdPUUMS7PhLLJh9DGf7weI5xj4E=; b=6eV/HUYiS2NN0pa+oMKQQUYxWrRXWrXkALDlZZOGifPFoB+qjuWhcCLU6hwLAJ+e7aJmX9 dXzUdmTIihQRQMBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705325974; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=ZPSWvo854fjXuPnbcdPUUMS7PhLLJh9DGf7weI5xj4E=; b=gBBJlYBhXdHwUkydD0tVstR2LemQ45woFqLOJxxwHQPmlxr/sotM4nvcZNkCSbqain6LFr NrkGpbBeYkzNq8gCwsLeuY8eCkW9s8OcJrKCTVbd9Gf4WzggotaCj+90Wr4vORXAeTWTyx kLe3AMvyZsNANoTjsC1dO4+340gNP8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705325974; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=ZPSWvo854fjXuPnbcdPUUMS7PhLLJh9DGf7weI5xj4E=; b=6eV/HUYiS2NN0pa+oMKQQUYxWrRXWrXkALDlZZOGifPFoB+qjuWhcCLU6hwLAJ+e7aJmX9 dXzUdmTIihQRQMBg== Date: Mon, 15 Jan 2024 14:34:28 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] find_base_value part MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [2.40 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; 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]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[14.27%] X-Spam-Score: 2.40 X-Spam-Status: No, score=-10.7 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: <20240115134112.E83AB3858418@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788163992193532771 X-GMAIL-MSGID: 1788163992193532771 The following adjusts find_base_value similar as to what find_base_term was adjusted for PR113255. * alias.cc (known_base_value_p): Remove. (find_base_value): Remove PLUS/MINUS handling when both operands are not CONST_INT_P. --- gcc/alias.cc | 62 ++++------------------------------------------------ 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/gcc/alias.cc b/gcc/alias.cc index bdc119822b4..29b3ba82dba 100644 --- a/gcc/alias.cc +++ b/gcc/alias.cc @@ -1400,26 +1400,6 @@ unique_base_value_p (rtx x) return GET_CODE (x) == ADDRESS && GET_MODE (x) == Pmode; } -/* Return true if X is known to be a base value. */ - -static bool -known_base_value_p (rtx x) -{ - switch (GET_CODE (x)) - { - case LABEL_REF: - case SYMBOL_REF: - return true; - - case ADDRESS: - /* Arguments may or may not be bases; we don't know for sure. */ - return GET_MODE (x) != VOIDmode; - - default: - return false; - } -} - /* Inside SRC, the source of a SET, find a base address. */ static rtx @@ -1490,46 +1470,12 @@ find_base_value (rtx src) case PLUS: case MINUS: { - rtx temp, src_0 = XEXP (src, 0), src_1 = XEXP (src, 1); - - /* If either operand is a REG that is a known pointer, then it - is the base. */ - if (REG_P (src_0) && REG_POINTER (src_0)) - return find_base_value (src_0); - if (REG_P (src_1) && REG_POINTER (src_1)) - return find_base_value (src_1); - - /* If either operand is a REG, then see if we already have - a known value for it. */ - if (REG_P (src_0)) - { - temp = find_base_value (src_0); - if (temp != 0) - src_0 = temp; - } - - if (REG_P (src_1)) - { - temp = find_base_value (src_1); - if (temp!= 0) - src_1 = temp; - } - - /* If either base is named object or a special address - (like an argument or stack reference), then use it for the - base term. */ - if (src_0 != 0 && known_base_value_p (src_0)) - return src_0; - - if (src_1 != 0 && known_base_value_p (src_1)) - return src_1; + rtx src_0 = XEXP (src, 0), src_1 = XEXP (src, 1); - /* Guess which operand is the base address: - If either operand is a symbol, then it is the base. If - either operand is a CONST_INT, then the other is the base. */ - if (CONST_INT_P (src_1) || CONSTANT_P (src_0)) + /* If either operand is a CONST_INT, then the other is the base. */ + if (CONST_INT_P (src_1)) return find_base_value (src_0); - else if (CONST_INT_P (src_0) || CONSTANT_P (src_1)) + else if (CONST_INT_P (src_0)) return find_base_value (src_1); return 0;