From patchwork Mon May 20 09:36:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1101911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-501160-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="p8IPczey"; 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 456v1n4RxQz9sNK for ; Mon, 20 May 2019 19:37:17 +1000 (AEST) 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=r7Cmq4q/qOc8fNQ91OJZjkzwTMeDCRuEIkwVIlmTPoTG655lVhTDS EoSvslZlULvehGizygq2J2Hv9pQhVsTSqnxyTBo4BFXrH6xYDryVudeVWwrIU7xB 4CNoQcy5zV+JerGpSxCyNaGicwwxEkZv458kLg9+HPmgjXb9zWYbU8= 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=cec60yqH0uOPQJ8Gx3vODLvN/eY=; b=p8IPczeyKjHtsK0PXQHF nA5Dx4ng2OdJoGhEkLQLsrekWwFWBHF+3lhCCnfVaX/bTOWLkfAY+OkPLtr0vgvS L559Vsaq38FK7fzCdkX93rcR+AuKY3tcD5Wh0z2eHxGGIYWb1/NtJnPxF1o/+q1k vhkdksZjBemEizfvSci+OXY= Received: (qmail 119269 invoked by alias); 20 May 2019 09:37:09 -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 119258 invoked by uid 89); 20 May 2019 09:37:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=ao_ref, ref2, ref1, sk:refs_ma X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 May 2019 09:37:07 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 938C6281CC8; Mon, 20 May 2019 11:36:57 +0200 (CEST) Date: Mon, 20 May 2019 11:36:57 +0200 From: Jan Hubicka To: d@dcepelik.cz, rguenther@suse.de, gcc-patches@gcc.gnu.org Subject: Fix alias oracle stats Message-ID: <20190520093657.kfeyumjhehropikh@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, at the moment the alias stats outputs mostly 0 for res_may_alias_p (which is supposed to be main entry point to the alias oracle). I think this is because of code refactoring where we added more variants of this function and we want to do stats around the main worker. Bootstrapped/regtested x86_64-linux, OK? * tree-ssa-alias.c (refs_may_alias_p_2): Break out from ... (refs_may_alias_p_1): ... here; update stats. (refs_may_alias_p): Do not update stats here. Index: tree-ssa-alias.c =================================================================== --- tree-ssa-alias.c (revision 271379) +++ tree-ssa-alias.c (working copy) @@ -1399,8 +1466,8 @@ indirect_refs_may_alias_p (tree ref1 ATT /* Return true, if the two memory references REF1 and REF2 may alias. */ -bool -refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) +static bool +refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) { tree base1, base2; poly_int64 offset1 = 0, offset2 = 0; @@ -1557,6 +1624,20 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref gcc_unreachable (); } +/* Return true, if the two memory references REF1 and REF2 may alias + and update statistics. */ + +bool +refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) +{ + bool res = refs_may_alias_p_2 (ref1, ref2, tbaa_p); + if (res) + ++alias_stats.refs_may_alias_p_may_alias; + else + ++alias_stats.refs_may_alias_p_no_alias; + return res; +} + static bool refs_may_alias_p (tree ref1, ao_ref *ref2, bool tbaa_p) { @@ -1569,15 +1650,9 @@ bool refs_may_alias_p (tree ref1, tree ref2, bool tbaa_p) { ao_ref r1, r2; - bool res; ao_ref_init (&r1, ref1); ao_ref_init (&r2, ref2); - res = refs_may_alias_p_1 (&r1, &r2, tbaa_p); - if (res) - ++alias_stats.refs_may_alias_p_may_alias; - else - ++alias_stats.refs_may_alias_p_no_alias; - return res; + return; refs_may_alias_p_1 (&r1, &r2, tbaa_p); } /* Returns true if there is a anti-dependence for the STORE that