From patchwork Thu Apr 4 14:18:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 233838 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 313272C00AB for ; Fri, 5 Apr 2013 01:18:41 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=ggVQlG7v0lgtYDlCtR GKYaXo4uYTlotavUqXcUa4nyaqC9cGt2J+Qv9RJWvD1H1rimItjEko7oXm/IWk7P +5UUu3p/kBvl6YJNsJphTTbXPIqPfH1jSrjqjj/yUdrAOAyZKB4v4yh/zC4sF9f2 xe8o2hn0jjmH4M1hbq1DPK2II= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=c+B2jfbTmdl9voI+in18MVBd VqE=; b=RzKjqQKa7luQXbsPwDgABXmWjD3ATrQG25c00LlI52fhyIWN8GG+I6cx KZ6TML1WPBgTsxlXjEFybSf0tPeqeLhJCYup5KG08JdgUMQFfH0HrOApIexppdpb A58C/NZnWQNr3w0sZFbND0QWkDFgP2IKHoOQwUgev+M36qoGGyk= Received: (qmail 16618 invoked by alias); 4 Apr 2013 14:18:24 -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 16591 invoked by uid 89); 4 Apr 2013 14:18:23 -0000 X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from mail-wg0-f44.google.com (HELO mail-wg0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Apr 2013 14:18:21 +0000 Received: by mail-wg0-f44.google.com with SMTP id z12so2710907wgg.23 for ; Thu, 04 Apr 2013 07:18:19 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.178.100 with SMTP id cx4mr9970935wjc.47.1365085098963; Thu, 04 Apr 2013 07:18:18 -0700 (PDT) Received: by 10.194.56.100 with HTTP; Thu, 4 Apr 2013 07:18:18 -0700 (PDT) In-Reply-To: References: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569160DFB90@IRSMSX101.ger.corp.intel.com> Date: Thu, 4 Apr 2013 16:18:18 +0200 Message-ID: Subject: Re: FW: [PATCH] Avoid a few find_base_term calls in alias.c From: Richard Biener To: Yuri Rumyantsev Cc: gcc-patches On Thu, Apr 4, 2013 at 3:33 PM, Yuri Rumyantsev wrote: > Hi Richard, > > You slightly change behavior of find_base_term, namely before your fix we > have the following code: > > if (REG_P (tmp1) && REG_POINTER (tmp1)) > { > rtx base = find_base_term (tmp1); > if (base) > return base; > } > > but in your fix you added the following checks on base: > > tmp1 = find_base_term (tmp1); > if (tmp1 != NULL_RTX > && ((REG_P (tmp1) && REG_POINTER (tmp1)) > || known_base_value_p (tmp1))) > return tmp1; > Why you added these checks since function arguments may not considered as > bases. If you continue down the original function there is (quoted fully) /* If either operand is known to be a pointer, then use it to determine the base term. */ if (REG_P (tmp1) && REG_POINTER (tmp1)) { rtx base = find_base_term (tmp1); if (base) return base; } if (REG_P (tmp2) && REG_POINTER (tmp2)) { rtx base = find_base_term (tmp2); if (base) return base; } /* Neither operand was known to be a pointer. Go ahead and find the base term for both operands. */ tmp1 = find_base_term (tmp1); tmp2 = find_base_term (tmp2); so we call find_base_term on tmp1 anyway, and after the modification tmp1 = find_base_term (tmp1); if (tmp1 != NULL_RTX && ((REG_P (tmp1) && REG_POINTER (tmp1)) || known_base_value_p (tmp1))) return tmp1; we take it if it is non-NULL and ... ah, I see. We now check REG_P/REG_POINTER on the new value. That was indeed unintended. I'll fix it like below. Richard. 2013-04-04 Richard Biener * alias.c (find_base_term): Fix thinko in previous change. Index: gcc/alias.c =================================================================== --- gcc/alias.c (revision 197480) +++ gcc/alias.c (working copy) @@ -1687,16 +1687,16 @@ find_base_term (rtx x) term is from a pointer or is a named object or a special address (like an argument or stack reference), then use it for the base term. */ - tmp1 = find_base_term (tmp1); - if (tmp1 != NULL_RTX + rtx base = find_base_term (tmp1); + if (base != NULL_RTX && ((REG_P (tmp1) && REG_POINTER (tmp1)) - || known_base_value_p (tmp1))) - return tmp1; - tmp2 = find_base_term (tmp2); - if (tmp2 != NULL_RTX + || known_base_value_p (base))) + return base; + base = find_base_term (tmp2); + if (base != NULL_RTX && ((REG_P (tmp2) && REG_POINTER (tmp2)) - || known_base_value_p (tmp2))) - return tmp2; + || known_base_value_p (base))) + return base; /* We could not determine which of the two operands was the base register and which was the index. So we can determine