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;