public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Some fixes for autofdo test cases
@ 2016-06-27  1:51 Andi Kleen
  2016-06-27  6:58 ` [PATCH 1/6] Print indirect call changes in afdo dump file Andi Kleen
  2016-07-04 19:58 ` [PING] Re: Some fixes for autofdo test cases Andi Kleen
  0 siblings, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law

This fixes some of the problems with profile test cases running with autofdo
There are still remaining failures that need to be addressed, but this is the
low hanging fruit.

-Andi

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo
  2016-06-27  1:51   ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Andi Kleen
@ 2016-06-27  1:51     ` Andi Kleen
  2016-06-27  1:51       ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Andi Kleen
  2016-07-13 21:32       ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Jeff Law
  2016-07-13 21:31     ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Jeff Law
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Autofdo outputs to different dump files and doesn't support some
transformation that normal profiling. Add dg-final-scan-autofdo
and dg-final-scan-not-autofdo statements to the test suite
so that the test cases can hande those cases separately.

gcc/testsuite/:

2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* lib/profopt.exp (dg-final-scan-autofdo,
	dg-final-scan-not-autofdo): New functions.
---
 gcc/testsuite/lib/profopt.exp | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index b3e2b2e..3cce2ee 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -171,6 +171,47 @@ proc dg-final-use { args } {
 }
 
 #
+# dg-final-use-not-autofdo -- process code to run after the profile-use step
+# but only if not running autofdo
+# ARGS is the line number of the directive followed by the commands.
+#
+proc dg-final-use-not-autofdo { args } {
+    global use_final_code
+    global run_autofdo
+
+    if { [llength $args] > 2 } {
+	error "[lindex $args 0]: too many arguments"
+	return
+    }
+
+    if { $run_autofdo == 1 } {
+        return
+    }
+    append use_final_code "[lindex $args 1]\n"
+}
+
+#
+# dg-final-use-autofdo -- process code to run after the profile-use step
+# but only if running autofdo
+# ARGS is the line number of the directive followed by the commands.
+#
+
+proc dg-final-use-autofdo { args } {
+    global use_final_code
+    global run_autofdo
+
+    if { [llength $args] > 2 } {
+	error "[lindex $args 0]: too many arguments"
+	return
+    }
+
+    if { $run_autofdo != 1 } {
+        return
+    }
+    append use_final_code "[lindex $args 1]\n"
+}
+
+#
 # profopt-final-code -- run final code
 #
 # WHICH is "generate" or "use".
@@ -210,6 +251,8 @@ proc profopt-get-options { src } {
 	     || ![string compare "dg-skip-if" $cmd] \
 	     || ![string compare "dg-final-generate" $cmd] \
 	     || ![string compare "dg-final-use" $cmd] \
+	     || ![string compare "dg-final-use-not-autofdo" $cmd] \
+	     || ![string compare "dg-final-use-autofdo" $cmd] \
              || ![string compare "dg-additional-sources" $cmd] \
 	     || [string match "dg-require-*" $cmd]  } {
 	    set status [catch "$op" errmsg]
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 6/6] Some fixes for profile test cases for autofdo
  2016-06-27  1:51         ` [PATCH 5/6] Clean up imports files in test suite Andi Kleen
@ 2016-06-27  1:51           ` Andi Kleen
  2016-07-13 21:35             ` Jeff Law
  2016-07-13 21:32           ` [PATCH 5/6] Clean up imports files in test suite Jeff Law
  1 sibling, 1 reply; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

This fixes some basic issues with the profile test cases with autofdo.

- Disable checking for value transformations that autofdo does not
  support.
- Disable checking for fixed hit counts which autofdo does not support
- Enable dumping of afdo log file and check right log file.
- Increase run time of test cases to 1M iterations because autofdo needs
  a few samples to make sense of a program. The test case don't run
  noticeable slower with that.

There are still failures unfortunately, especially the indirect call
transformations do not trigger because autofdo thinks they are not hot.
This can be addressed later.

gcc/testsuite/:

2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* g++.dg/tree-prof/indir-call-prof.C: Basic fixes for autofdo.
	* g++.dg/tree-prof/morefunc.C: Dito.
	* g++.dg/tree-prof/pr35545.C: Dito.
	* g++.dg/tree-prof/reorder.C: Dito.
	* gcc.dg/tree-prof/20050826-2.c: Dito.
	* gcc.dg/tree-prof/cmpsf-1.c: Dito.
	* gcc.dg/tree-prof/cold_partition_label.c: Dito.
	* gcc.dg/tree-prof/ic-misattribution-1.c: Dito.
	* gcc.dg/tree-prof/indir-call-prof.c: Dito.
	* gcc.dg/tree-prof/inliner-1.c: Dito.
	* gcc.dg/tree-prof/merge_block.c: Dito.
	* gcc.dg/tree-prof/stringop-1.c: Dito.
	* gcc.dg/tree-prof/stringop-2.c: Dito.
	* gcc.dg/tree-prof/switch-case-1.c: Dito.
	* gcc.dg/tree-prof/switch-case-2.c: Dito.
	* gcc.dg/tree-prof/time-profiler-1.c: Dito.
	* gcc.dg/tree-prof/time-profiler-2.c: Dito.
	* gcc.dg/tree-prof/update-loopch.c: Dito.
	* gcc.dg/tree-prof/val-prof-1.c: Dito.
	* gcc.dg/tree-prof/val-prof-2.c: Dito.
	* gcc.dg/tree-prof/val-prof-3.c: Dito.
	* gcc.dg/tree-prof/val-prof-4.c: Dito.
	* gcc.dg/tree-prof/val-prof-5.c: Dito.
	* gcc.dg/tree-prof/val-prof-6.c: Dito.
	* gcc.dg/tree-prof/val-prof-7.c: Dito.
---
 gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C     | 20 +++++++++++++-------
 gcc/testsuite/g++.dg/tree-prof/morefunc.C            |  7 ++++---
 gcc/testsuite/g++.dg/tree-prof/pr35545.C             |  2 +-
 gcc/testsuite/g++.dg/tree-prof/reorder.C             |  9 +++++----
 gcc/testsuite/gcc.dg/tree-prof/20050826-2.c          |  2 +-
 gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c             |  2 +-
 .../gcc.dg/tree-prof/cold_partition_label.c          |  4 +++-
 gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c |  2 +-
 gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c     |  7 ++++---
 gcc/testsuite/gcc.dg/tree-prof/inliner-1.c           |  2 +-
 gcc/testsuite/gcc.dg/tree-prof/merge_block.c         |  2 +-
 gcc/testsuite/gcc.dg/tree-prof/stringop-1.c          |  7 ++++---
 gcc/testsuite/gcc.dg/tree-prof/stringop-2.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/switch-case-1.c       |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/switch-case-2.c       |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c     |  6 +++---
 gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c     |  8 ++++----
 gcc/testsuite/gcc.dg/tree-prof/update-loopch.c       |  9 +++++----
 gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c          |  3 ++-
 gcc/testsuite/gcc.dg/tree-prof/val-prof-6.c          |  5 +++--
 gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c          |  2 +-
 25 files changed, 78 insertions(+), 56 deletions(-)

diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
index a03edc2..3134c3c 100644
--- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
+++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile -fdump-ipa-afdo" } */
 
 struct A {
   A () {}
@@ -24,14 +24,20 @@ main (void)
   
   A* p;
 
-  p = (A *)wrap ((void *)&a);
-  p->AA ();
+  int i;
 
-  p = (B *)wrap ((void *)&b);
-  p->AA ();
+  for (i = 0; i < 1000000; i++)
+    {
+      p = (A *)wrap ((void *)&a);
+      p->AA ();
+
+      p = (B *)wrap ((void *)&b);
+      p->AA ();
+    }
   
   return 0;
 }
 
-/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* AA transformation on insn" "profile" } } */
-/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized" } } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* AA transformation on insn" "profile" } } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* AA transformation on insn" "afdo" } } */
+/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/tree-prof/morefunc.C b/gcc/testsuite/g++.dg/tree-prof/morefunc.C
index b7ff5e9..2e3fc11 100644
--- a/gcc/testsuite/g++.dg/tree-prof/morefunc.C
+++ b/gcc/testsuite/g++.dg/tree-prof/morefunc.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -Wno-attributes -Wno-coverage-mismatch" } */
+/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -fdump-ipa-afdo -Wno-attributes -Wno-coverage-mismatch" } */
 #include "reorder_class1.h"
 #include "reorder_class2.h"
 
@@ -28,7 +28,7 @@ static __attribute__((always_inline))
 void test2 (B *tc)
 {
   int i;
-  for (i = 0; i < 1000; i++)
+  for (i = 0; i < 1000000; i++)
      g += tc->foo();
 }
 
@@ -51,4 +51,5 @@ int main()
 
 }
 
-/* { dg-final-use { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
+/* { dg-final-use-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "afdo" } } */
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr35545.C b/gcc/testsuite/g++.dg/tree-prof/pr35545.C
index 7d24e71..e1bd047 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr35545.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr35545.C
@@ -27,7 +27,7 @@ int main()
 
   A* ap = 0;
 
-  for (i = 0; i < 10000; i++)
+  for (i = 0; i < 1000000; i++)
   {
 
      if (i%7==0)
diff --git a/gcc/testsuite/g++.dg/tree-prof/reorder.C b/gcc/testsuite/g++.dg/tree-prof/reorder.C
index f582b2d..6b3bad1 100644
--- a/gcc/testsuite/g++.dg/tree-prof/reorder.C
+++ b/gcc/testsuite/g++.dg/tree-prof/reorder.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -Wno-coverage-mismatch -Wno-attributes" } */
+/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -fdump-ipa-afdo -Wno-coverage-mismatch -Wno-attributes" } */
 
 #ifdef _PROFILE_USE
 #include "reorder_class1.h"
@@ -13,7 +13,7 @@ static __attribute__((always_inline))
 void test1 (A *tc)
 {
   int i;
-  for (i = 0; i < 1000; i++)
+  for (i = 0; i < 1000000; i++)
      g += tc->foo(); 
    if (g<100) g++;
 }
@@ -22,7 +22,7 @@ static __attribute__((always_inline))
 void test2 (B *tc)
 {
   int i;
-  for (i = 0; i < 1000; i++)
+  for (i = 0; i < 1000000; i++)
      g += tc->foo();
 }
 
@@ -44,4 +44,5 @@ int main()
   test_b(bp);
 }
 
-/* { dg-final-use { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
+/* { dg-final-use-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "afdo" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/20050826-2.c b/gcc/testsuite/gcc.dg/tree-prof/20050826-2.c
index bdaef3d..f0febbd 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/20050826-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/20050826-2.c
@@ -72,4 +72,4 @@ main (void)
   return 0;
 }
 
-/* { dg-final-use { scan-tree-dump-not "Invalid sum" "dom2"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "dom2"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c b/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c
index 49102df..16adb92 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c
@@ -181,4 +181,4 @@ main (void)
   exit (0);
 }
 
-/* { dg-final-use { scan-tree-dump-not "Invalid sum" "dom2"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "dom2"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c
index 910ac04..6214e36 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c
@@ -29,9 +29,11 @@ foo (int path)
 int
 main (int argc, char *argv[])
 {
+  int i;
   buf_hot =  "hello";
   buf_cold = "world";
-  foo (argc);
+  for (i = 0; i < 1000000; i++)
+    foo (argc);
   return 0;
 }
 
diff --git a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c
index e36ba26..3979b17 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c
@@ -15,4 +15,4 @@ caller(void (*func) (void))
   func ();
 }
 
-/* { dg-final-use { scan-ipa-dump "hist->count 1 hist->all 1" "profile" } } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "hist->count 1 hist->all 1" "profile" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
index bed40a5..53063c3 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile -fdump-ipa-afdo" } */
 
 static int a1 (void)
 {
@@ -28,7 +28,7 @@ main (void)
   int (*p) (void);
   int  i;
 
-  for (i = 0; i < 10; i ++)
+  for (i = 0; i < 10000000; i ++)
     {
 	setp (&p, i);
 	p ();
@@ -37,5 +37,6 @@ main (void)
   return 0;
 }
 
-/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "profile"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "afdo"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c b/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
index f0cdf87..8d1481b 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
@@ -25,7 +25,7 @@ int
 main ()
 {
   int i;
-  for (i = 0; i < 100; i++)
+  for (i = 0; i < 1000000; i++)
     {
       if (a)
         cold_function ();
diff --git a/gcc/testsuite/gcc.dg/tree-prof/merge_block.c b/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
index da4ec5a..5da5ddf 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/merge_block.c
@@ -14,7 +14,7 @@ main ()
 {
   int i;
   /* The loop will be optimized away after ipa-inline.  */
-  for (i = 0; i < 1000; i++)
+  for (i = 0; i < 1000000; i++)
     t ();
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
index e1e0634..6f8908a 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c
@@ -14,8 +14,9 @@ main()
     }
    return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "profile"} } */
+/* autofdo doesn't support value profiling for now: */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 4 stringop" "profile"} } */
 /* Really this ought to simplify into assignment, but we are not there yet.  */
 /* a[0] = b[0] is what we fold the resulting memcpy into.  */
-/* { dg-final-use { scan-tree-dump " = MEM.*&b" "optimized"} } */
-/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump " = MEM.*&b" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
index 66f8d29..330b159 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c
@@ -19,6 +19,7 @@ main()
     }
    return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "profile"} } */
+/* autofdo doesn't support value profiling for now: */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 4 stringop" "profile"} } */
 /* The versioned memset of size 4 should be optimized to an assignment.  */
-/* { dg-final-use { scan-tree-dump "MEM\\\[\\(void .\\)&a\\\] = 168430090" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "MEM\\\[\\(void .\\)&a\\\] = 168430090" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/switch-case-1.c b/gcc/testsuite/gcc.dg/tree-prof/switch-case-1.c
index 89e76cc..6a9af08 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/switch-case-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/switch-case-1.c
@@ -35,5 +35,6 @@ int main ()
    foo ((i * i) % 5);
  return 0;
 }
-/* { dg-final-use { scan-rtl-dump-times ";; basic block\[^\\n\]*count 4000" 2 "expand"} } */
-/* { dg-final-use { scan-rtl-dump-times ";; basic block\[^\\n\]*count 2000" 1 "expand"} } */
+/* autofdo cannot do that precise execution numbers */
+/* { dg-final-use-not-autofdo { scan-rtl-dump-times ";; basic block\[^\\n\]*count 4000" 2 "expand"} } */
+/* { dg-final-use-not-autofdo { scan-rtl-dump-times ";; basic block\[^\\n\]*count 2000" 1 "expand"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/switch-case-2.c b/gcc/testsuite/gcc.dg/tree-prof/switch-case-2.c
index 7161282..cfedc9c 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/switch-case-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/switch-case-2.c
@@ -35,5 +35,6 @@ int main ()
    foo ((i * i) % 5);
  return 0;
 }
-/* { dg-final-use { scan-rtl-dump-times ";; basic block\[^\\n\]*count 4000" 2 "expand"} } */
-/* { dg-final-use { scan-rtl-dump-times ";; basic block\[^\\n\]*count 2000" 1 "expand"} } */
+/* autofdo cannot do that precise execution numbers: */
+/* { dg-final-use-not-autofdo { scan-rtl-dump-times ";; basic block\[^\\n\]*count 4000" 2 "expand"} } */
+/* { dg-final-use-not-autofdo { scan-rtl-dump-times ";; basic block\[^\\n\]*count 2000" 1 "expand"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c
index ee8a9d8..455f923 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c
@@ -16,6 +16,6 @@ int main ()
 {
   return foo ();
 }
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c
index 29c0d19..e6eaeb9 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c
@@ -43,7 +43,7 @@ int main ()
 
   return r;
 }
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 0" 2 "profile"} } */
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */
-/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 2 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c
index 4dd51af..242fa52 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c
@@ -14,8 +14,9 @@ main ()
 /* Loop header copying will peel away the initial conditional, so the loop body
    is once reached directly from entry point of function, rest via loopback
    edge.  */
-/* { dg-final-use { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
-/* { dg-final-use { scan-tree-dump "loop depth 1, count 33333" "optimized"} } */
-/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 33332" "optimized"} } */
-/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */
+/* autofdo cannot do that precise counts */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "loop depth 1, count 33333" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump-not "loop depth 1, count 33332" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "Removing basic block" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
index 97dd311..35e0f90 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c
@@ -16,6 +16,7 @@ main ()
     }
   return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Div.mod by constant n_\[0-9\]*=257 transformation on insn" "profile"} } */
-/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Div.mod by constant n_\[0-9\]*=257 transformation on insn" "profile"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c
index 2e85a86..ad78043 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c
@@ -24,8 +24,9 @@ main ()
     }
   return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" "profile" } } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Mod power of 2 transformation on insn" "profile" } } */
 /* This is part of code checking that n is power of 2, so we are sure that the transformation
    didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ (4294967295|0x0*ffffffff)" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "n_\[0-9\]* \\+ (4294967295|0x0*ffffffff)" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c
index 9a600c3..366ada1 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c
@@ -24,8 +24,9 @@ main ()
     }
   return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */
 /* This is part of code checking that n is greater than the divisor so we are sure that it
    didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "if \\(_\[0-9\]* \\< n_\[0-9\]*" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "if \\(_\[0-9\]* \\< n_\[0-9\]*" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c
index 5d15158..374428e 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c
@@ -24,8 +24,9 @@ main ()
     }
   return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */
 /* This is part of code checking that n is greater than the divisor so we are sure that it
    didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c
index 7e88ac4..caf97ce 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c
@@ -12,5 +12,6 @@ main()
 			a[i]/=b;
 	return 0;
 }
-/* { dg-final-use { scan-ipa-dump "Div.mod by constant b.*=997 transformation on insn" "profile" } } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Div.mod by constant b.*=997 transformation on insn" "profile" } } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-6.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-6.c
index fd24ee3..597efa6 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-6.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-6.c
@@ -15,5 +15,6 @@ main()
     t(i);
   return 0;
 }
-/* { dg-final-use { scan-tree-dump "Average value sum:499500" "optimized"} } */
-/* { dg-final-use { scan-tree-dump "IOR value" "optimized"} } */
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-tree-dump "Average value sum:499500" "optimized"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "IOR value" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c
index 3d85714..9765b99 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c
@@ -22,4 +22,4 @@ int main() {
   return 0;
 }
 
-/* { dg-final-use { scan-ipa-dump "Single value 8 stringop transformation on bzero" "profile" } } */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on bzero" "profile" } } */
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 5/6] Clean up imports files in test suite
  2016-06-27  1:51       ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Andi Kleen
@ 2016-06-27  1:51         ` Andi Kleen
  2016-06-27  1:51           ` [PATCH 6/6] Some fixes for profile test cases for autofdo Andi Kleen
  2016-07-13 21:32           ` [PATCH 5/6] Clean up imports files in test suite Jeff Law
  2016-07-13 21:32         ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Jeff Law
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

autofdo create_gcov creates an extra .imports file. Always remove that
too when running an autofdo test case.

gcc/testsuite/:

* 2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* lib/profopt.exp (profopt-execute): Remove .imports files.
---
 gcc/testsuite/lib/profopt.exp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 6966d04..7e45dd44 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -518,6 +518,7 @@ proc profopt-execute { src } {
 	foreach ext $prof_ext {
 	    profopt-target-cleanup $tmpdir $base $ext
 	    profopt-target-cleanup $tmpdir perf data
+	    profopt-target-cleanup $tmpdir $base "gcda.imports"
 	}
 
 	if { $status != "pass" } {
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/6] Don't run instrumented value profiler changes with afdo
  2016-06-27  6:58 ` [PATCH 1/6] Print indirect call changes in afdo dump file Andi Kleen
@ 2016-06-27  1:51   ` Andi Kleen
  2016-06-27  1:51     ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Andi Kleen
  2016-07-13 21:31     ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Jeff Law
  2016-07-13 21:33   ` [PATCH 1/6] Print indirect call changes in afdo dump file Jeff Law
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

The pass to transform gimple based on value profiling runs with autofdo
on, but currently every transformation fails. For indirect calls autofdo
does it on its own, and it doesn't suppport other value profiling. So don't
run this pass when autofdo is active. This also avoids bogus
dump file entries.

gcc/:

* 2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* value-prof.c (gimple_value_profile_transformations): Don't run
	when auto_profile is on.
---
 gcc/value-prof.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index f9574b6..52068eb 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -645,6 +645,11 @@ gimple_value_profile_transformations (void)
   basic_block bb;
   gimple_stmt_iterator gsi;
   bool changed = false;
+
+  /* Autofdo does all transformations it supports elsewhere.  */
+  if (flag_auto_profile)
+    return false;
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/6] Always print gcc-auto-profile line in dump file
  2016-06-27  1:51     ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Andi Kleen
@ 2016-06-27  1:51       ` Andi Kleen
  2016-06-27  1:51         ` [PATCH 5/6] Clean up imports files in test suite Andi Kleen
  2016-07-13 21:32         ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Jeff Law
  2016-07-13 21:32       ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Jeff Law
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  1:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

not just when verbose. This ensures all command lines needed to
reproduce the test case are always logged

gcc/testsuite/:

* 2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* lib/profopt.exp (profopt-execute): Always log profiler
	command line.
---
 gcc/testsuite/lib/profopt.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 3cce2ee..6966d04 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -417,7 +417,7 @@ proc profopt-execute { src } {
 	    }
 	    set orig_ld_library_path "[getenv LD_LIBRARY_PATH]"
 	    setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
-	    verbose "Running $profile_wrapper $execname1"
+	    verbose -log "Running $profile_wrapper $execname1"
 	    set id [remote_spawn "" "$profile_wrapper $execname1" "readonly"]
 	    setenv LD_LIBRARY_PATH $orig_ld_library_path
 	    if { $id < 0 } {
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/6] Print indirect call changes in afdo dump file
  2016-06-27  1:51 Some fixes for autofdo test cases Andi Kleen
@ 2016-06-27  6:58 ` Andi Kleen
  2016-06-27  1:51   ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Andi Kleen
  2016-07-13 21:33   ` [PATCH 1/6] Print indirect call changes in afdo dump file Jeff Law
  2016-07-04 19:58 ` [PING] Re: Some fixes for autofdo test cases Andi Kleen
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2016-06-27  6:58 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Print some information about indirect call promotions in the afdo dump
file. Do it in the same format as the instrumented profiler so that
the test suite can match on it.

gcc/:

2016-06-26  Andi Kleen  <ak@linux.intel.com>

	* auto-profile.c (update_inlined_ind_target,
	afdo_indirect_call): Print information to dump file.
---
 gcc/auto-profile.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 63 insertions(+), 7 deletions(-)

diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index 00b3687..4e3d2bf 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -47,6 +47,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-inline.h"
 #include "tree-inline.h"
 #include "auto-profile.h"
+#include "tree-pretty-print.h"
+#include "gimple-pretty-print.h"
 
 /* The following routines implements AutoFDO optimization.
 
@@ -747,8 +749,18 @@ bool
 autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
                                                    count_info *info)
 {
+  if (dump_file)
+    {
+      fprintf (dump_file, "Checking indirect call -> direct call ");
+      print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+    }
+
   if (LOCATION_LOCUS (gimple_location (stmt)) == cfun->function_end_locus)
-    return false;
+    {
+      if (dump_file)
+	fprintf (dump_file, " good locus\n");
+      return false;
+    }
 
   count_info old_info;
   get_count_info (stmt, &old_info);
@@ -765,21 +777,41 @@ autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
      than half of the callsite count (stored in INFO), the original promoted
      target is considered not hot any more.  */
   if (total >= info->count / 2)
-    return false;
+    {
+      if (dump_file)
+	fprintf (dump_file, " not hot anymore %ld >= %ld",
+		 (long)total,
+		 (long)info->count /2);
+      return false;
+    }
 
   inline_stack stack;
   get_inline_stack (gimple_location (stmt), &stack);
   if (stack.length () == 0)
-    return false;
+    {
+      if (dump_file)
+	fprintf (dump_file, " no inline stack\n");
+      return false;
+    }
   function_instance *s = get_function_instance_by_inline_stack (stack);
   if (s == NULL)
-    return false;
+    {
+      if (dump_file)
+	fprintf (dump_file, " function not found in inline stack\n");
+      return false;
+    }
   icall_target_map map;
   if (s->find_icall_target_map (stmt, &map) == 0)
-    return false;
+    {
+      if (dump_file)
+	fprintf (dump_file, " no target map\n");
+      return false;
+    }
   for (icall_target_map::const_iterator iter = map.begin ();
        iter != map.end (); ++iter)
     info->targets[iter->first] = iter->second;
+  if (dump_file)
+    fprintf (dump_file, " looks good\n");
   return true;
 }
 
@@ -997,10 +1029,34 @@ afdo_indirect_call (gimple_stmt_iterator *gsi, const icall_target_map &map,
   struct cgraph_node *direct_call = cgraph_node::get_for_asmname (
       get_identifier ((const char *) hist->hvalue.counters[0]));
 
+  if (dump_file)
+    {
+      fprintf (dump_file, "Indirect call -> direct call ");
+      print_generic_expr (dump_file, callee, TDF_SLIM);
+      fprintf (dump_file, " => ");
+      print_generic_expr (dump_file, direct_call->decl, TDF_SLIM);
+    }
+
   if (direct_call == NULL || !check_ic_target (stmt, direct_call))
-    return;
+    {
+      if (dump_file)
+        fprintf (dump_file, " not transforming\n");
+      return;
+    }
   if (DECL_STRUCT_FUNCTION (direct_call->decl) == NULL)
-    return;
+    {
+      if (dump_file)
+        fprintf (dump_file, " no declaration\n");
+      return;
+    }
+
+  if (dump_file)
+    {
+      fprintf (dump_file, " transformation on insn ");
+      print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+      fprintf (dump_file, "\n");
+    }
+
   struct cgraph_edge *new_edge
       = indirect_edge->make_speculative (direct_call, 0, 0);
   new_edge->redirect_call_stmt_to_callee ();
-- 
2.8.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PING] Re: Some fixes for autofdo test cases
  2016-06-27  1:51 Some fixes for autofdo test cases Andi Kleen
  2016-06-27  6:58 ` [PATCH 1/6] Print indirect call changes in afdo dump file Andi Kleen
@ 2016-07-04 19:58 ` Andi Kleen
  2016-07-08 12:39   ` [PING^2] " Andi Kleen
  1 sibling, 1 reply; 17+ messages in thread
From: Andi Kleen @ 2016-07-04 19:58 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law

Andi Kleen <andi@firstfloor.org> writes:

Ping!

> This fixes some of the problems with profile test cases running with autofdo
> There are still remaining failures that need to be addressed, but this is the
> low hanging fruit.
>
> -Andi
>
>

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PING^2] Re: Some fixes for autofdo test cases
  2016-07-04 19:58 ` [PING] Re: Some fixes for autofdo test cases Andi Kleen
@ 2016-07-08 12:39   ` Andi Kleen
  2016-07-13  2:02     ` [PING^3] " Andi Kleen
  0 siblings, 1 reply; 17+ messages in thread
From: Andi Kleen @ 2016-07-08 12:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law

Andi Kleen <andi@firstfloor.org> writes:

Ping^2!

> Andi Kleen <andi@firstfloor.org> writes:
>
> Ping!
>
>> This fixes some of the problems with profile test cases running with autofdo
>> There are still remaining failures that need to be addressed, but this is the
>> low hanging fruit.
>>
>> -Andi
>>
>>

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PING^3] Re: Some fixes for autofdo test cases
  2016-07-08 12:39   ` [PING^2] " Andi Kleen
@ 2016-07-13  2:02     ` Andi Kleen
  0 siblings, 0 replies; 17+ messages in thread
From: Andi Kleen @ 2016-07-13  2:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, law

Andi Kleen <andi@firstfloor.org> writes:

Ping^3!

> Andi Kleen <andi@firstfloor.org> writes:
>
> Ping^2!
>
>> Andi Kleen <andi@firstfloor.org> writes:
>>
>> Ping!
>>
>>> This fixes some of the problems with profile test cases running with autofdo
>>> There are still remaining failures that need to be addressed, but this is the
>>> low hanging fruit.
>>>
>>> -Andi
>>>
>>>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/6] Don't run instrumented value profiler changes with afdo
  2016-06-27  1:51   ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Andi Kleen
  2016-06-27  1:51     ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Andi Kleen
@ 2016-07-13 21:31     ` Jeff Law
  1 sibling, 0 replies; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:31 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> The pass to transform gimple based on value profiling runs with autofdo
> on, but currently every transformation fails. For indirect calls autofdo
> does it on its own, and it doesn't suppport other value profiling. So don't
> run this pass when autofdo is active. This also avoids bogus
> dump file entries.
>
> gcc/:
>
> * 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* value-prof.c (gimple_value_profile_transformations): Don't run
> 	when auto_profile is on.
I don't think that comment is really correct.   There's all kinds of 
things going on with div/mod operations, turning string builtins into 
straightline code, etc that I see in value-prof that aren't done by 
autofdo AFAICT.

I can live with the change if the comment is corrected.

jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/6] Clean up imports files in test suite
  2016-06-27  1:51         ` [PATCH 5/6] Clean up imports files in test suite Andi Kleen
  2016-06-27  1:51           ` [PATCH 6/6] Some fixes for profile test cases for autofdo Andi Kleen
@ 2016-07-13 21:32           ` Jeff Law
  1 sibling, 0 replies; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:32 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> autofdo create_gcov creates an extra .imports file. Always remove that
> too when running an autofdo test case.
>
> gcc/testsuite/:
>
> * 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* lib/profopt.exp (profopt-execute): Remove .imports files.
OK.
jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo
  2016-06-27  1:51     ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Andi Kleen
  2016-06-27  1:51       ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Andi Kleen
@ 2016-07-13 21:32       ` Jeff Law
  2016-07-13 21:39         ` Andi Kleen
  1 sibling, 1 reply; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:32 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Autofdo outputs to different dump files and doesn't support some
> transformation that normal profiling. Add dg-final-scan-autofdo
> and dg-final-scan-not-autofdo statements to the test suite
> so that the test cases can hande those cases separately.
Which seems to match my assertion that value-prof does things that 
auto-prof does not.


>
> gcc/testsuite/:
>
> 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* lib/profopt.exp (dg-final-scan-autofdo,
> 	dg-final-scan-not-autofdo): New functions.
Regardless, this is OK.
jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/6] Always print gcc-auto-profile line in dump file
  2016-06-27  1:51       ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Andi Kleen
  2016-06-27  1:51         ` [PATCH 5/6] Clean up imports files in test suite Andi Kleen
@ 2016-07-13 21:32         ` Jeff Law
  1 sibling, 0 replies; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:32 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> not just when verbose. This ensures all command lines needed to
> reproduce the test case are always logged
>
> gcc/testsuite/:
>
> * 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* lib/profopt.exp (profopt-execute): Always log profiler
> 	command line.
OK.
jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/6] Print indirect call changes in afdo dump file
  2016-06-27  6:58 ` [PATCH 1/6] Print indirect call changes in afdo dump file Andi Kleen
  2016-06-27  1:51   ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Andi Kleen
@ 2016-07-13 21:33   ` Jeff Law
  1 sibling, 0 replies; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:33 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Print some information about indirect call promotions in the afdo dump
> file. Do it in the same format as the instrumented profiler so that
> the test suite can match on it.
>
> gcc/:
>
> 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* auto-profile.c (update_inlined_ind_target,
> 	afdo_indirect_call): Print information to dump file.
OK.
jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/6] Some fixes for profile test cases for autofdo
  2016-06-27  1:51           ` [PATCH 6/6] Some fixes for profile test cases for autofdo Andi Kleen
@ 2016-07-13 21:35             ` Jeff Law
  0 siblings, 0 replies; 17+ messages in thread
From: Jeff Law @ 2016-07-13 21:35 UTC (permalink / raw)
  To: Andi Kleen, gcc-patches; +Cc: hubicka, Andi Kleen

On 06/26/2016 07:50 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> This fixes some basic issues with the profile test cases with autofdo.
>
> - Disable checking for value transformations that autofdo does not
>   support.
> - Disable checking for fixed hit counts which autofdo does not support
> - Enable dumping of afdo log file and check right log file.
> - Increase run time of test cases to 1M iterations because autofdo needs
>   a few samples to make sense of a program. The test case don't run
>   noticeable slower with that.
>
> There are still failures unfortunately, especially the indirect call
> transformations do not trigger because autofdo thinks they are not hot.
> This can be addressed later.
>
> gcc/testsuite/:
>
> 2016-06-26  Andi Kleen  <ak@linux.intel.com>
>
> 	* g++.dg/tree-prof/indir-call-prof.C: Basic fixes for autofdo.
> 	* g++.dg/tree-prof/morefunc.C: Dito.
> 	* g++.dg/tree-prof/pr35545.C: Dito.
> 	* g++.dg/tree-prof/reorder.C: Dito.
> 	* gcc.dg/tree-prof/20050826-2.c: Dito.
> 	* gcc.dg/tree-prof/cmpsf-1.c: Dito.
> 	* gcc.dg/tree-prof/cold_partition_label.c: Dito.
> 	* gcc.dg/tree-prof/ic-misattribution-1.c: Dito.
> 	* gcc.dg/tree-prof/indir-call-prof.c: Dito.
> 	* gcc.dg/tree-prof/inliner-1.c: Dito.
> 	* gcc.dg/tree-prof/merge_block.c: Dito.
> 	* gcc.dg/tree-prof/stringop-1.c: Dito.
> 	* gcc.dg/tree-prof/stringop-2.c: Dito.
> 	* gcc.dg/tree-prof/switch-case-1.c: Dito.
> 	* gcc.dg/tree-prof/switch-case-2.c: Dito.
> 	* gcc.dg/tree-prof/time-profiler-1.c: Dito.
> 	* gcc.dg/tree-prof/time-profiler-2.c: Dito.
> 	* gcc.dg/tree-prof/update-loopch.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-1.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-2.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-3.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-4.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-5.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-6.c: Dito.
> 	* gcc.dg/tree-prof/val-prof-7.c: Dito.
OK.
jeff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo
  2016-07-13 21:32       ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Jeff Law
@ 2016-07-13 21:39         ` Andi Kleen
  0 siblings, 0 replies; 17+ messages in thread
From: Andi Kleen @ 2016-07-13 21:39 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, hubicka

Jeff Law <law@redhat.com> writes:

> On 06/26/2016 07:50 PM, Andi Kleen wrote:
>> From: Andi Kleen <ak@linux.intel.com>
>>
>> Autofdo outputs to different dump files and doesn't support some
>> transformation that normal profiling. Add dg-final-scan-autofdo
>> and dg-final-scan-not-autofdo statements to the test suite
>> so that the test cases can hande those cases separately.
> Which seems to match my assertion that value-prof does things that
> auto-prof does not.

This is right -- autofdo does not do any value profiling
(although it could in theory, and there is at least one paper about it)

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-07-13 21:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27  1:51 Some fixes for autofdo test cases Andi Kleen
2016-06-27  6:58 ` [PATCH 1/6] Print indirect call changes in afdo dump file Andi Kleen
2016-06-27  1:51   ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Andi Kleen
2016-06-27  1:51     ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Andi Kleen
2016-06-27  1:51       ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Andi Kleen
2016-06-27  1:51         ` [PATCH 5/6] Clean up imports files in test suite Andi Kleen
2016-06-27  1:51           ` [PATCH 6/6] Some fixes for profile test cases for autofdo Andi Kleen
2016-07-13 21:35             ` Jeff Law
2016-07-13 21:32           ` [PATCH 5/6] Clean up imports files in test suite Jeff Law
2016-07-13 21:32         ` [PATCH 4/6] Always print gcc-auto-profile line in dump file Jeff Law
2016-07-13 21:32       ` [PATCH 3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo Jeff Law
2016-07-13 21:39         ` Andi Kleen
2016-07-13 21:31     ` [PATCH 2/6] Don't run instrumented value profiler changes with afdo Jeff Law
2016-07-13 21:33   ` [PATCH 1/6] Print indirect call changes in afdo dump file Jeff Law
2016-07-04 19:58 ` [PING] Re: Some fixes for autofdo test cases Andi Kleen
2016-07-08 12:39   ` [PING^2] " Andi Kleen
2016-07-13  2:02     ` [PING^3] " Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).