diff mbox

[3/6] Add dg-final-scan-autofdo and dg-final-scan-not-autofdo

Message ID 20160627015024.23444-4-andi@firstfloor.org
State New
Headers show

Commit Message

Andi Kleen June 27, 2016, 1:50 a.m. UTC
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(+)

Comments

Jeff Law July 13, 2016, 9:31 p.m. UTC | #1
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
Andi Kleen July 13, 2016, 9:39 p.m. UTC | #2
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
diff mbox

Patch

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]