* [PATCH 2/2] Add some more test cases for fentry and pg
2014-09-12 14:33 [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Andi Kleen
@ 2014-09-12 14:33 ` Andi Kleen
2014-09-15 9:30 ` Richard Biener
2014-09-15 9:28 ` [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Richard Biener
1 sibling, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2014-09-12 14:33 UTC (permalink / raw)
To: gcc-patches; +Cc: Andi Kleen
From: Andi Kleen <ak@linux.intel.com>
Test fentry and no_instrument_function overriding.
No test cases for the LTO test for now, as the LTO
harness doesn't seem to support different flags for the final
link.
gcc/testsuite/:
2014-09-11 Andi Kleen <ak@linux.intel.com>
* gcc.dg/pg-override.c: New test.
* gcc.dg/pg.c: New test.
* gcc.target/i386/fentry-override.c: New test.
* gcc.target/i386/fentry.c: New test.
---
gcc/testsuite/gcc.dg/pg-override.c | 18 ++++++++++++++++++
gcc/testsuite/gcc.dg/pg.c | 18 ++++++++++++++++++
gcc/testsuite/gcc.target/i386/fentry-override.c | 18 ++++++++++++++++++
gcc/testsuite/gcc.target/i386/fentry.c | 18 ++++++++++++++++++
4 files changed, 72 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/pg-override.c
create mode 100644 gcc/testsuite/gcc.dg/pg.c
create mode 100644 gcc/testsuite/gcc.target/i386/fentry-override.c
create mode 100644 gcc/testsuite/gcc.target/i386/fentry.c
diff --git a/gcc/testsuite/gcc.dg/pg-override.c b/gcc/testsuite/gcc.dg/pg-override.c
new file mode 100644
index 0000000..7cd6680
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pg-override.c
@@ -0,0 +1,18 @@
+/* Test -fprofile override */
+/* { dg-do compile } */
+/* { dg-options "-fprofile" } */
+/* { dg-final { scan-assembler-not "mcount" } } */
+/* Origin: Andi Kleen */
+extern void foobar(const char *);
+
+__attribute__((no_instrument_function)) void func(void)
+{
+ foobar ("Hello world\n");
+}
+
+__attribute__((no_instrument_function)) void func2(void)
+{
+ int i;
+ for (i = 0; i < 10; i++)
+ foobar ("Hello world");
+}
diff --git a/gcc/testsuite/gcc.dg/pg.c b/gcc/testsuite/gcc.dg/pg.c
new file mode 100644
index 0000000..7cd6680
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pg.c
@@ -0,0 +1,18 @@
+/* Test -fprofile override */
+/* { dg-do compile } */
+/* { dg-options "-fprofile" } */
+/* { dg-final { scan-assembler-not "mcount" } } */
+/* Origin: Andi Kleen */
+extern void foobar(const char *);
+
+__attribute__((no_instrument_function)) void func(void)
+{
+ foobar ("Hello world\n");
+}
+
+__attribute__((no_instrument_function)) void func2(void)
+{
+ int i;
+ for (i = 0; i < 10; i++)
+ foobar ("Hello world");
+}
diff --git a/gcc/testsuite/gcc.target/i386/fentry-override.c b/gcc/testsuite/gcc.target/i386/fentry-override.c
new file mode 100644
index 0000000..3771f19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fentry-override.c
@@ -0,0 +1,18 @@
+/* Test -mfentry override */
+/* { dg-do compile } */
+/* { dg-options "-mfentry" } */
+/* { dg-final { scan-assembler-not "__fentry__" } } */
+/* Origin: Andi Kleen */
+extern void foobar(const char *);
+
+void __attribute__((no_instrument_function)) func(void)
+{
+ foobar ("Hello world\n");
+}
+
+void __attribute__((no_instrument_function)) func2(void)
+{
+ int i;
+ for (i = 0; i < 10; i++)
+ foobar ("Hello world");
+}
diff --git a/gcc/testsuite/gcc.target/i386/fentry.c b/gcc/testsuite/gcc.target/i386/fentry.c
new file mode 100644
index 0000000..bd3db13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fentry.c
@@ -0,0 +1,18 @@
+/* Test -mfentry */
+/* { dg-do compile } */
+/* { dg-options "-fprofile -mfentry" } */
+/* { dg-final { scan-assembler "__fentry__" } } */
+/* Origin: Andi Kleen */
+extern void foobar(const char *);
+
+void func(void)
+{
+ foobar ("Hello world\n");
+}
+
+void func2(void)
+{
+ int i;
+ for (i = 0; i < 10; i++)
+ foobar ("Hello world");
+}
--
2.1.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly
@ 2014-09-12 14:33 Andi Kleen
2014-09-12 14:33 ` [PATCH 2/2] Add some more test cases for fentry and pg Andi Kleen
2014-09-15 9:28 ` [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Richard Biener
0 siblings, 2 replies; 7+ messages in thread
From: Andi Kleen @ 2014-09-12 14:33 UTC (permalink / raw)
To: gcc-patches; +Cc: Andi Kleen
From: Andi Kleen <ak@linux.intel.com>
When profiling is disabled force DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT
for each function to one. This information is then preserved
through LTO.
With this patch for LTO builds -pg needs to be set on both the
LTO final link and the original source build, to allow -pg
(or -pg -fentry) to be active for that source file. This allows
to build large projects mostly with -pg, except for a few files,
and still use LTO.
Originally suggested by Richard Biener
Passes bootstrap and testing on x86_64-linux.
gcc/:
2014-09-11 Andi Kleen <ak@linux.intel.com>
* function.c (allocate_struct_function): Force
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT to zero when
profiling is disabled.
---
gcc/function.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/function.c b/gcc/function.c
index c8daf95..f07fdcf 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4555,6 +4555,9 @@ allocate_struct_function (tree fndecl, bool abstract_p)
but is this worth the hassle? */
cfun->can_throw_non_call_exceptions = flag_non_call_exceptions;
cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions;
+
+ if (!profile_flag && !flag_instrument_function_entry_exit)
+ DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) = 1;
}
}
--
2.1.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly
2014-09-12 14:33 [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Andi Kleen
2014-09-12 14:33 ` [PATCH 2/2] Add some more test cases for fentry and pg Andi Kleen
@ 2014-09-15 9:28 ` Richard Biener
1 sibling, 0 replies; 7+ messages in thread
From: Richard Biener @ 2014-09-15 9:28 UTC (permalink / raw)
To: Andi Kleen; +Cc: GCC Patches, Andi Kleen
On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> When profiling is disabled force DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT
> for each function to one. This information is then preserved
> through LTO.
>
> With this patch for LTO builds -pg needs to be set on both the
> LTO final link and the original source build, to allow -pg
> (or -pg -fentry) to be active for that source file. This allows
> to build large projects mostly with -pg, except for a few files,
> and still use LTO.
>
> Originally suggested by Richard Biener
> Passes bootstrap and testing on x86_64-linux.
Ok with...
> gcc/:
>
> 2014-09-11 Andi Kleen <ak@linux.intel.com>
>
> * function.c (allocate_struct_function): Force
> DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT to zero when
to one.
Thanks,
Richard.
> profiling is disabled.
> ---
> gcc/function.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gcc/function.c b/gcc/function.c
> index c8daf95..f07fdcf 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -4555,6 +4555,9 @@ allocate_struct_function (tree fndecl, bool abstract_p)
> but is this worth the hassle? */
> cfun->can_throw_non_call_exceptions = flag_non_call_exceptions;
> cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions;
> +
> + if (!profile_flag && !flag_instrument_function_entry_exit)
> + DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) = 1;
> }
> }
>
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Add some more test cases for fentry and pg
2014-09-12 14:33 ` [PATCH 2/2] Add some more test cases for fentry and pg Andi Kleen
@ 2014-09-15 9:30 ` Richard Biener
2014-09-15 16:00 ` Andi Kleen
0 siblings, 1 reply; 7+ messages in thread
From: Richard Biener @ 2014-09-15 9:30 UTC (permalink / raw)
To: Andi Kleen; +Cc: GCC Patches, Andi Kleen
On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Test fentry and no_instrument_function overriding.
>
> No test cases for the LTO test for now, as the LTO
> harness doesn't seem to support different flags for the final
> link.
Sure it does - via dg-extra-ld-options (you have to negate compile-time
opts to "remove" them).
Are you sure the tests are target independent enough? That is,
'mcount' is really 'mcount' on all targets?
Ok.
Thanks,
Richard.
> gcc/testsuite/:
>
> 2014-09-11 Andi Kleen <ak@linux.intel.com>
>
> * gcc.dg/pg-override.c: New test.
> * gcc.dg/pg.c: New test.
> * gcc.target/i386/fentry-override.c: New test.
> * gcc.target/i386/fentry.c: New test.
> ---
> gcc/testsuite/gcc.dg/pg-override.c | 18 ++++++++++++++++++
> gcc/testsuite/gcc.dg/pg.c | 18 ++++++++++++++++++
> gcc/testsuite/gcc.target/i386/fentry-override.c | 18 ++++++++++++++++++
> gcc/testsuite/gcc.target/i386/fentry.c | 18 ++++++++++++++++++
> 4 files changed, 72 insertions(+)
> create mode 100644 gcc/testsuite/gcc.dg/pg-override.c
> create mode 100644 gcc/testsuite/gcc.dg/pg.c
> create mode 100644 gcc/testsuite/gcc.target/i386/fentry-override.c
> create mode 100644 gcc/testsuite/gcc.target/i386/fentry.c
>
> diff --git a/gcc/testsuite/gcc.dg/pg-override.c b/gcc/testsuite/gcc.dg/pg-override.c
> new file mode 100644
> index 0000000..7cd6680
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pg-override.c
> @@ -0,0 +1,18 @@
> +/* Test -fprofile override */
> +/* { dg-do compile } */
> +/* { dg-options "-fprofile" } */
> +/* { dg-final { scan-assembler-not "mcount" } } */
> +/* Origin: Andi Kleen */
> +extern void foobar(const char *);
> +
> +__attribute__((no_instrument_function)) void func(void)
> +{
> + foobar ("Hello world\n");
> +}
> +
> +__attribute__((no_instrument_function)) void func2(void)
> +{
> + int i;
> + for (i = 0; i < 10; i++)
> + foobar ("Hello world");
> +}
> diff --git a/gcc/testsuite/gcc.dg/pg.c b/gcc/testsuite/gcc.dg/pg.c
> new file mode 100644
> index 0000000..7cd6680
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pg.c
> @@ -0,0 +1,18 @@
> +/* Test -fprofile override */
> +/* { dg-do compile } */
> +/* { dg-options "-fprofile" } */
> +/* { dg-final { scan-assembler-not "mcount" } } */
> +/* Origin: Andi Kleen */
> +extern void foobar(const char *);
> +
> +__attribute__((no_instrument_function)) void func(void)
> +{
> + foobar ("Hello world\n");
> +}
> +
> +__attribute__((no_instrument_function)) void func2(void)
> +{
> + int i;
> + for (i = 0; i < 10; i++)
> + foobar ("Hello world");
> +}
> diff --git a/gcc/testsuite/gcc.target/i386/fentry-override.c b/gcc/testsuite/gcc.target/i386/fentry-override.c
> new file mode 100644
> index 0000000..3771f19
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/fentry-override.c
> @@ -0,0 +1,18 @@
> +/* Test -mfentry override */
> +/* { dg-do compile } */
> +/* { dg-options "-mfentry" } */
> +/* { dg-final { scan-assembler-not "__fentry__" } } */
> +/* Origin: Andi Kleen */
> +extern void foobar(const char *);
> +
> +void __attribute__((no_instrument_function)) func(void)
> +{
> + foobar ("Hello world\n");
> +}
> +
> +void __attribute__((no_instrument_function)) func2(void)
> +{
> + int i;
> + for (i = 0; i < 10; i++)
> + foobar ("Hello world");
> +}
> diff --git a/gcc/testsuite/gcc.target/i386/fentry.c b/gcc/testsuite/gcc.target/i386/fentry.c
> new file mode 100644
> index 0000000..bd3db13
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/fentry.c
> @@ -0,0 +1,18 @@
> +/* Test -mfentry */
> +/* { dg-do compile } */
> +/* { dg-options "-fprofile -mfentry" } */
> +/* { dg-final { scan-assembler "__fentry__" } } */
> +/* Origin: Andi Kleen */
> +extern void foobar(const char *);
> +
> +void func(void)
> +{
> + foobar ("Hello world\n");
> +}
> +
> +void func2(void)
> +{
> + int i;
> + for (i = 0; i < 10; i++)
> + foobar ("Hello world");
> +}
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Add some more test cases for fentry and pg
2014-09-15 9:30 ` Richard Biener
@ 2014-09-15 16:00 ` Andi Kleen
2014-09-16 15:37 ` H.J. Lu
0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2014-09-15 16:00 UTC (permalink / raw)
To: Richard Biener; +Cc: Andi Kleen, GCC Patches
On Mon, Sep 15, 2014 at 11:29:50AM +0200, Richard Biener wrote:
> On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <andi@firstfloor.org> wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> >
> > Test fentry and no_instrument_function overriding.
> >
> > No test cases for the LTO test for now, as the LTO
> > harness doesn't seem to support different flags for the final
> > link.
>
> Sure it does - via dg-extra-ld-options (you have to negate compile-time
> opts to "remove" them).
Ok. I'll add test cases for that too then.
>
> Are you sure the tests are target independent enough? That is,
> 'mcount' is really 'mcount' on all targets?
I'm not. I'll make them x86 only.
Thanks,
-Andi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Add some more test cases for fentry and pg
2014-09-15 16:00 ` Andi Kleen
@ 2014-09-16 15:37 ` H.J. Lu
2014-09-16 18:00 ` H.J. Lu
0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2014-09-16 15:37 UTC (permalink / raw)
To: Andi Kleen; +Cc: Richard Biener, Andi Kleen, GCC Patches
On Mon, Sep 15, 2014 at 8:59 AM, Andi Kleen <ak@linux.intel.com> wrote:
> On Mon, Sep 15, 2014 at 11:29:50AM +0200, Richard Biener wrote:
>> On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <andi@firstfloor.org> wrote:
>> > From: Andi Kleen <ak@linux.intel.com>
>> >
>> > Test fentry and no_instrument_function overriding.
>> >
>> > No test cases for the LTO test for now, as the LTO
>> > harness doesn't seem to support different flags for the final
>> > link.
>>
>> Sure it does - via dg-extra-ld-options (you have to negate compile-time
>> opts to "remove" them).
>
> Ok. I'll add test cases for that too then.
>
>>
>> Are you sure the tests are target independent enough? That is,
>> 'mcount' is really 'mcount' on all targets?
>
> I'm not. I'll make them x86 only.
>
> Thanks,
>
> -Andi
Tested on Linux/x86-64. I checked in this to fix:
https://gcc.gnu.org/ml/gcc-regression/2014-09/msg00084.html
--
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 215300)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2014-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.dg/pg.c: Fix a typo.
+
2014-09-16 Richard Biener <rguenther@suse.de>
PR testsuite/63258
Index: gcc.dg/pg.c
===================================================================
--- gcc.dg/pg.c (revision 215300)
+++ gcc.dg/pg.c (working copy)
@@ -1,6 +1,6 @@
/* Test -fprofile override */
/* { dg-do compile } */
-/* { dg-options "-fprofile" { target { { i686-*-* x86_64-*-* } } } } */
+/* { dg-options "-fprofile" { target i?86-*-* x86_64-*-* } } */
/* { dg-final { scan-assembler-not "mcount" } } */
/* Origin: Andi Kleen */
extern void foobar(const char *);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Add some more test cases for fentry and pg
2014-09-16 15:37 ` H.J. Lu
@ 2014-09-16 18:00 ` H.J. Lu
0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu @ 2014-09-16 18:00 UTC (permalink / raw)
To: Andi Kleen; +Cc: Richard Biener, Andi Kleen, GCC Patches
On Tue, Sep 16, 2014 at 8:36 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Sep 15, 2014 at 8:59 AM, Andi Kleen <ak@linux.intel.com> wrote:
>> On Mon, Sep 15, 2014 at 11:29:50AM +0200, Richard Biener wrote:
>>> On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <andi@firstfloor.org> wrote:
>>> > From: Andi Kleen <ak@linux.intel.com>
>>> >
>>> > Test fentry and no_instrument_function overriding.
>>> >
>>> > No test cases for the LTO test for now, as the LTO
>>> > harness doesn't seem to support different flags for the final
>>> > link.
>>>
>>> Sure it does - via dg-extra-ld-options (you have to negate compile-time
>>> opts to "remove" them).
>>
>> Ok. I'll add test cases for that too then.
>>
>>>
>>> Are you sure the tests are target independent enough? That is,
>>> 'mcount' is really 'mcount' on all targets?
>>
>> I'm not. I'll make them x86 only.
>>
>> Thanks,
>>
>> -Andi
>
> Tested on Linux/x86-64. I checked in this to fix:
>
> https://gcc.gnu.org/ml/gcc-regression/2014-09/msg00084.html
>
> --
> H.J.
> ---
> Index: ChangeLog
> ===================================================================
> --- ChangeLog (revision 215300)
> +++ ChangeLog (working copy)
> @@ -1,3 +1,7 @@
> +2014-09-16 H.J. Lu <hongjiu.lu@intel.com>
> +
> + * gcc.dg/pg.c: Fix a typo.
> +
> 2014-09-16 Richard Biener <rguenther@suse.de>
>
> PR testsuite/63258
> Index: gcc.dg/pg.c
> ===================================================================
> --- gcc.dg/pg.c (revision 215300)
> +++ gcc.dg/pg.c (working copy)
> @@ -1,6 +1,6 @@
> /* Test -fprofile override */
> /* { dg-do compile } */
> -/* { dg-options "-fprofile" { target { { i686-*-* x86_64-*-* } } } } */
> +/* { dg-options "-fprofile" { target i?86-*-* x86_64-*-* } } */
> /* { dg-final { scan-assembler-not "mcount" } } */
> /* Origin: Andi Kleen */
> extern void foobar(const char *);
Here is another one:
Index: ChangeLog
===================================================================
--- ChangeLog (revision 215303)
+++ ChangeLog (working copy)
@@ -1,5 +1,9 @@
2014-09-16 H.J. Lu <hongjiu.lu@intel.com>
+ * gcc.dg/pg-override.c: Fix a typo.
+
+2014-09-16 H.J. Lu <hongjiu.lu@intel.com>
+
* gcc.dg/pg.c: Fix a typo.
2014-09-16 Richard Biener <rguenther@suse.de>
Index: gcc.dg/pg-override.c
===================================================================
--- gcc.dg/pg-override.c (revision 215303)
+++ gcc.dg/pg-override.c (working copy)
@@ -1,6 +1,6 @@
/* Test -fprofile override */
/* { dg-do compile } */
-/* { dg-options "-fprofile" { target { { i686-*-* x86_64-*-* } } } } */
+/* { dg-options "-fprofile" { target i?86-*-* x86_64-*-* } } */
/* { dg-final { scan-assembler-not "mcount" } } */
/* Origin: Andi Kleen */
extern void foobar(const char *);
--
H.J.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-16 18:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 14:33 [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Andi Kleen
2014-09-12 14:33 ` [PATCH 2/2] Add some more test cases for fentry and pg Andi Kleen
2014-09-15 9:30 ` Richard Biener
2014-09-15 16:00 ` Andi Kleen
2014-09-16 15:37 ` H.J. Lu
2014-09-16 18:00 ` H.J. Lu
2014-09-15 9:28 ` [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Richard Biener
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).