diff mbox

Update probabilities in predict.def to match reality

Message ID 426a0b6e-47c6-bcd5-bf31-23e60372944f@suse.cz
State New
Headers show

Commit Message

Martin Liška June 9, 2016, 2:58 p.m. UTC
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

Comments

Jan Hubicka June 9, 2016, 5:08 p.m. UTC | #1
> 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 <mliska@suse.cz>
> 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  <mliska@suse.cz>
> 
> 	* 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.

I think the usual strategy is to add testcases once PR is fixed (so failures
track regressions). So please just fix the predict-?.c templates and leave
predict-1.f90 to go with the patch (I see you arleady proposed one in 
the PR log.

OK for the predict-?.c changes.

Thanks,
Honza
diff mbox

Patch

From 6272402f76d4e6ff496d55e9a4fac7ee9a696e4e Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
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  <mliska@suse.cz>

	* 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