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

