From patchwork Mon Nov 18 09:44:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1196625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513879-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GSwygHsq"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47GkZ32gMSz9sR8 for ; Mon, 18 Nov 2019 20:44:25 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=lvGzA34EkwoAzJtWcuK7R5taIVtNvbcLWGwIojDlwZ1vWdPbIMfUG atT5Gk8lgaloxrwPxyTyBUVm5MSSlowLcMNXnNNOdaBvRBnezkJ5Z9fGE42URolJ YLAC3jYWBJGM0YdeVafG5KkYs5ezGFz/n0/IvpeTqHPZiMacKkAx4I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=HkuHuBRCkaEAjypslrGCX4iYhzc=; b=GSwygHsquKdMSvVh4uwZ MFVWEI5VDhBp4V4gTauiWc1Pik/JUfo+EKF3FtpGlbKUM8wYC1wiDh4S3RxN/aVN WSjJl9wD2v0a3bY1/1TcHsOA9XyElsysWQIvR4281tPVkLKc32tAgyDAvkDjgeUA 1YYgr3QNQ0jr6uSTjqCshcQ= Received: (qmail 38948 invoked by alias); 18 Nov 2019 09:44:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 38937 invoked by uid 89); 18 Nov 2019 09:44:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Nov 2019 09:44:16 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 74D8CB18D for ; Mon, 18 Nov 2019 09:44:14 +0000 (UTC) Date: Mon, 18 Nov 2019 10:44:14 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92462 Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 The following adjusts the find_base_{term,value} heuristic when looking through ANDs to the case where it is obviously not aligning a base (when the LSB is set). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2019-11-18 Richard Biener PR rtl-optimization/92462 * alias.c (find_base_term): Restrict the look through ANDs. (find_base_value): Likewise. Index: gcc/alias.c =================================================================== --- gcc/alias.c (revision 278293) +++ gcc/alias.c (working copy) @@ -1464,9 +1464,11 @@ find_base_value (rtx src) return find_base_value (XEXP (src, 1)); case AND: - /* If the second operand is constant set the base - address to the first operand. */ - if (CONST_INT_P (XEXP (src, 1)) && INTVAL (XEXP (src, 1)) != 0) + /* Look through aligning ANDs. And AND with zero or one with + the LSB set isn't one (see for example PR92462). */ + if (CONST_INT_P (XEXP (src, 1)) + && INTVAL (XEXP (src, 1)) != 0 + && (INTVAL (XEXP (src, 1)) & 1) == 0) return find_base_value (XEXP (src, 0)); return 0; @@ -2024,7 +2026,11 @@ find_base_term (rtx x, vec