From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96717 invoked by alias); 23 Oct 2017 11:30:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 96663 invoked by uid 89); 23 Oct 2017 11:30:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=maxsize, tweak X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 11:30:26 +0000 Received: by mail-wm0-f45.google.com with SMTP id t69so8860760wmt.2 for ; Mon, 23 Oct 2017 04:30:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=WpN+A08NPXP97ejEYDxLslX3axDzYStutxgY/fWMJSg=; b=sfTruU0iFYoW3x1jKB95fvPM18qRWnP/EBdyNWLdhmalYY5QL/houJoXbFq6Yy+B4/ YoLKYEMvqavG/gOTsF8z4VsVI7fxbjJYhbclAfaMgh98iwuh9cabZO0Rt7D6KfeoB7ft uTbvcgSnQUzv8N2BeHRwOpjucHRmOeuYHE5DbJUB5pGEX5I3sOgfGpoRImPiUZLVBAT4 gkSlQ/OIDcwddYZHNXT8vNMkC5a91r17paF2yBxPj7i2jGJlLaDqPV7s/PmCMFMmIWi8 O2f366ltrGTWDbZKkdmgv0DE9SyCjY7EG9cAsv3nzz6B/Z9OmtkrOqWQMKSLDKtottRR wbQw== X-Gm-Message-State: AMCzsaVGN34MYi7gTfCwplTsrQHtsAl9hBBr+MKJuqYYYRxqSMu6GAxV sIsTnC/SD8hPKmCCiyJR4qT4cmcEFTk= X-Google-Smtp-Source: ABhQp+RnA9iwKgq5Eft6haTGOgDU1INsqIIJSCTERamqBK2LUv+3LrUfpeHpf5FzerDw4LhPXuMvug== X-Received: by 10.28.140.15 with SMTP id o15mr4930455wmd.8.1508758214830; Mon, 23 Oct 2017 04:30:14 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id z35sm18106799wrc.9.2017.10.23.04.30.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 04:30:14 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [21/nn] Minor vn_reference_lookup_3 tweak References: <87wp3mxgir.fsf@linaro.org> Date: Mon, 23 Oct 2017 11:31:00 -0000 In-Reply-To: <87wp3mxgir.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 12:14:36 +0100") Message-ID: <87efpuumnv.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01474.txt.bz2 The repeated checks for MEM_REF made this code hard to convert to poly_ints as-is. Hopefully the new structure also makes it clearer at a glance what the two cases are. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid repeated checks for MEM_REF. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c 2017-10-23 11:47:03.852769480 +0100 +++ gcc/tree-ssa-sccvn.c 2017-10-23 11:47:44.596155858 +0100 @@ -2234,6 +2234,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree || offset % BITS_PER_UNIT != 0 || ref->size % BITS_PER_UNIT != 0) return (void *)-1; + at = offset / BITS_PER_UNIT; /* Extract a pointer base and an offset for the destination. */ lhs = gimple_call_arg (def_stmt, 0); @@ -2301,19 +2302,18 @@ vn_reference_lookup_3 (ao_ref *ref, tree copy_size = tree_to_uhwi (gimple_call_arg (def_stmt, 2)); /* The bases of the destination and the references have to agree. */ - if ((TREE_CODE (base) != MEM_REF - && !DECL_P (base)) - || (TREE_CODE (base) == MEM_REF - && (TREE_OPERAND (base, 0) != lhs - || !tree_fits_uhwi_p (TREE_OPERAND (base, 1)))) - || (DECL_P (base) - && (TREE_CODE (lhs) != ADDR_EXPR - || TREE_OPERAND (lhs, 0) != base))) + if (TREE_CODE (base) == MEM_REF) + { + if (TREE_OPERAND (base, 0) != lhs + || !tree_fits_uhwi_p (TREE_OPERAND (base, 1))) + return (void *) -1; + at += tree_to_uhwi (TREE_OPERAND (base, 1)); + } + else if (!DECL_P (base) + || TREE_CODE (lhs) != ADDR_EXPR + || TREE_OPERAND (lhs, 0) != base) return (void *)-1; - at = offset / BITS_PER_UNIT; - if (TREE_CODE (base) == MEM_REF) - at += tree_to_uhwi (TREE_OPERAND (base, 1)); /* If the access is completely outside of the memcpy destination area there is no aliasing. */ if (lhs_offset >= at + maxsize / BITS_PER_UNIT