From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 360 invoked by alias); 26 Oct 2017 12:17:41 -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 131001 invoked by uid 89); 26 Oct 2017 12:17:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Oct 2017 12:17:38 +0000 Received: by mail-wm0-f48.google.com with SMTP id m72so7611906wmc.1 for ; Thu, 26 Oct 2017 05:17:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=L5Ef0FjyzhhhxQYD96UQZfeCGGJlPRJEgCO1sXx/V7I=; b=hbM+Dy59IAKJeJk+INqOvP8iHpclrX5g3gISO89X982McbcBAf//PybXo1qyEig+wB nhbO3VAdsU+QEO9QknuRMBLK4gnlQZpbQVtGV10nEjLu96RAKq+mPsaMAGXLM1S5b0Uq zFwmXLnMb3LQerSRCqmTNdxVIMe9HsNlE35OpO411VYcl+OtogjVBjDN1rxaQtJnfVuE CFNV3svkJ6IDewwG70YGx7n5xg/yAeJDWIbX81jxru+Lsbwpg8/ZZ7s4KN4dc8xOITYZ HvPOh/pCHfcFbyZkCR589cDRcCHJcYs884FilpNUmH452PfGsmqxha+qutEKPXG2Ao+e /gNQ== X-Gm-Message-State: AMCzsaXpVxNI8slQGs6uZORNFpoGWZgp7G4409JdLTbGZ1YechBkQeU6 LYqUZFn1J1kJwUMVlFVRJuQcmEonfLv5ah86HRh6fg== X-Google-Smtp-Source: ABhQp+SmXuiYlzWCXYer8sVHv1dtek922u1ma2Vm1Ee8/zB8dD/mtSe57pVR+ylC5VsmnoCD+mSvaDrwJSUasXlDBa8= X-Received: by 10.80.208.222 with SMTP id g30mr27337820edf.246.1509020256675; Thu, 26 Oct 2017 05:17:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.143.34 with HTTP; Thu, 26 Oct 2017 05:17:36 -0700 (PDT) In-Reply-To: <87efpuumnv.fsf@linaro.org> References: <87wp3mxgir.fsf@linaro.org> <87efpuumnv.fsf@linaro.org> From: Richard Biener Date: Thu, 26 Oct 2017 12:18:00 -0000 Message-ID: Subject: Re: [21/nn] Minor vn_reference_lookup_3 tweak To: GCC Patches , Richard Sandiford Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg01928.txt.bz2 On Mon, Oct 23, 2017 at 1:30 PM, Richard Sandiford wrote: > 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; can you move this just > /* 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. */ here? Ok with that change. Richard. > - 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