From patchwork Thu Jun 9 14:58:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 632996 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rQT3M4hm5z9sdn for ; Fri, 10 Jun 2016 00:59:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=TP+VY5er; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=NK/oGZuF1opp0yySq i7mGf8f0GUinRMFR+90JXJr2G+D01JZl8wjhAeI9JnpX18Fg3awMpLcXfnjRFLmn RrvKPw++ac/PrdXou6UxPg2UPnaX5k5K2lRxH8SxVNDuRnNd1EyOz5BUEjvJPYvb hSswSvmv40Yk7B7xJ5+xehG6S0= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=iZc9nqE/mcMlZaH9TPiuI5c ORqk=; b=TP+VY5erKNgKqZCJ0aUThjE2DwQL4erwYUf9ruqAWAg7V8IHHQO5gmu Wqx+Q86f2IU22GAOQDPmGI0i876Jw+fgASn9VQIYfoxtovXw1Cy47u6uFGhbRmLZ 5c7ZPWZVUxWLnJ8NCrm3obf+HLey0MrQQ3owmckOnnek3GF8LpDU= Received: (qmail 39390 invoked by alias); 9 Jun 2016 14:59:03 -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 39373 invoked by uid 89); 9 Jun 2016 14:59:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=rubber X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 09 Jun 2016 14:58:52 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6209DAC35; Thu, 9 Jun 2016 14:58:49 +0000 (UTC) Subject: Re: Update probabilities in predict.def to match reality To: gcc-patches@gcc.gnu.org References: <20160607192704.GB22955@kam.mff.cuni.cz> Cc: Jan Hubicka From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <426a0b6e-47c6-bcd5-bf31-23e60372944f@suse.cz> Date: Thu, 9 Jun 2016 16:58:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160607192704.GB22955@kam.mff.cuni.cz> X-IsSubscribed: yes On 06/07/2016 09:27 PM, Jan Hubicka wrote: > There are bugs in few predictors - goto predictor is dead because the FE code was dropped, > return predictor is bit random because CFG is optimized (it should probably be done in FE), > loop iv compare seems bogus and fortran fail alloc does not seem to work as intended. > I added FIXME and will addres them incrementally. Hi. I've investigated why 'loop iv compare heuristics' provides bogus values and I've just created PR for that: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71474 And I would like to apply following patch, that adds 'XFAIL' test-case described in the PR and I would distinguish scanning for 'loop iv compare' and 'guess loop iv compare'. Can I install the patch? Thanks, Martin From 6272402f76d4e6ff496d55e9a4fac7ee9a696e4e Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 9 Jun 2016 16:53:32 +0200 Subject: [PATCH] Make 'loop iv compare' heuristics scanning more precise in test-suite gcc/testsuite/ChangeLog: 2016-06-09 Martin Liska * gcc.dg/predict-1.c: Distinguish between "loop iv compare" and "guess loop iv compared" heuristics. * gcc.dg/predict-2.c: Likewise. * gcc.dg/predict-3.c: Likewise. * gcc.dg/predict-4.c: Likewise. * gcc.dg/predict-5.c: Likewise. * gcc.dg/predict-6.c: Likewise. * gfortran.dg/predict-1.f90: New test. --- gcc/testsuite/gcc.dg/predict-1.c | 2 +- gcc/testsuite/gcc.dg/predict-2.c | 2 +- gcc/testsuite/gcc.dg/predict-3.c | 2 +- gcc/testsuite/gcc.dg/predict-4.c | 2 +- gcc/testsuite/gcc.dg/predict-5.c | 2 +- gcc/testsuite/gcc.dg/predict-6.c | 2 +- gcc/testsuite/gfortran.dg/predict-1.f90 | 18 ++++++++++++++++++ 7 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/predict-1.f90 diff --git a/gcc/testsuite/gcc.dg/predict-1.c b/gcc/testsuite/gcc.dg/predict-1.c index d0924f2..10d62ba 100644 --- a/gcc/testsuite/gcc.dg/predict-1.c +++ b/gcc/testsuite/gcc.dg/predict-1.c @@ -23,4 +23,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 5 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 2.0%" 5 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-2.c b/gcc/testsuite/gcc.dg/predict-2.c index 3011686..aa91568 100644 --- a/gcc/testsuite/gcc.dg/predict-2.c +++ b/gcc/testsuite/gcc.dg/predict-2.c @@ -23,4 +23,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-not "loop iv compare heuristics of edge\[^:\]*:" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-not "guess loop iv compare heuristics of edge\[^:\]*:" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-3.c b/gcc/testsuite/gcc.dg/predict-3.c index 663f141..7274963 100644 --- a/gcc/testsuite/gcc.dg/predict-3.c +++ b/gcc/testsuite/gcc.dg/predict-3.c @@ -25,4 +25,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 3 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 98.0%" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-4.c b/gcc/testsuite/gcc.dg/predict-4.c index 5779da3..2ac2ec5 100644 --- a/gcc/testsuite/gcc.dg/predict-4.c +++ b/gcc/testsuite/gcc.dg/predict-4.c @@ -15,4 +15,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump "loop iv compare heuristics of edge\[^:\]*: 50.0%" "profile_estimate"} } */ +/* { dg-final { scan-tree-dump " loop iv compare heuristics of edge\[^:\]*: 50.0%" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-5.c b/gcc/testsuite/gcc.dg/predict-5.c index 56ada30..135081d 100644 --- a/gcc/testsuite/gcc.dg/predict-5.c +++ b/gcc/testsuite/gcc.dg/predict-5.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 98.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 98.0%" 4 "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-6.c b/gcc/testsuite/gcc.dg/predict-6.c index 9ed41ed..104683f 100644 --- a/gcc/testsuite/gcc.dg/predict-6.c +++ b/gcc/testsuite/gcc.dg/predict-6.c @@ -21,4 +21,4 @@ void foo (int base, int bound) } } -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */ +/* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */ diff --git a/gcc/testsuite/gfortran.dg/predict-1.f90 b/gcc/testsuite/gfortran.dg/predict-1.f90 new file mode 100644 index 0000000..78a03f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/predict-1.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! { dg-options "-O2 -fdump-tree-profile_estimate" } + +subroutine rubber(arg1, arg2) + +integer k,l +real*8 arg1(3,3,3), arg2(3,3,3) + + do l=10,30 + do k=1,l + arg1(k,l,1) = arg2(k,l,1) + enddo + enddo + +end + +! { dg-final { scan-tree-dump-times "loop iv compare heuristics of edge\[^:\]*: 100.0%" 1 "profile_estimate" { xfail *-*-* } } } + -- 2.8.3