* [PATCH] PR61868
@ 2014-07-29 13:36 Bingfeng Mei
2014-07-30 7:49 ` Richard Biener
0 siblings, 1 reply; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-29 13:36 UTC (permalink / raw)
To: gcc-patches
Hi,
Please find the patches for pr61868. The problem is that even with -frandom-seed gcc always uses 0 instead of specified number/string for places such as lto section names. init_random_seed is never called with -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
Thanks,
Bingfeng Mei
===================================================================
--- ChangeLog (revision 213152)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2014-07-29 Bingfeng Mei <bmei@broadcom.com>
+
+ PR lto/61868
+ * toplev.c (init_random_seed): Generate random seed when
+ flag_random_seed is specified.
+
2014-07-28 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (cgraph_node::create_indirect_edge): Copy speculative data.
Index: toplev.c
===================================================================
--- toplev.c (revision 213152)
+++ toplev.c (working copy)
@@ -301,7 +301,7 @@ init_random_seed (void)
HOST_WIDE_INT
get_random_seed (bool noinit)
{
- if (!flag_random_seed && !noinit)
+ if (!noinit)
init_random_seed ();
return random_seed;
}
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 213152)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-07-29 Bingfeng Mei <bmei@broadcom.com>
+
+ PR lto/61868
+ * gcc.dg/pr61868.c: New test.
+
2014-07-28 Richard Biener <rguenther@suse.de>
PR rtl-optimization/61801
Index: testsuite/gcc.dg/pr61868.c
===================================================================
--- testsuite/gcc.dg/pr61868.c (revision 0)
+++ testsuite/gcc.dg/pr61868.c (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-flto -frandom-seed=0x12345" } */
+extern int foo (int);
+int main ()
+{
+ foo (100);
+ return 0;
+}
+/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] PR61868
2014-07-29 13:36 [PATCH] PR61868 Bingfeng Mei
@ 2014-07-30 7:49 ` Richard Biener
2014-07-30 9:13 ` Bingfeng Mei
2014-07-30 15:01 ` Andi Kleen
0 siblings, 2 replies; 11+ messages in thread
From: Richard Biener @ 2014-07-30 7:49 UTC (permalink / raw)
To: Bingfeng Mei, Andi Kleen; +Cc: gcc-patches
On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> Hi,
> Please find the patches for pr61868. The problem is that even with -frandom-seed gcc always uses 0 instead of specified number/string for places such as lto section names. init_random_seed is never called with -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
Andi, wasn't this used to support partial linking of LTO objects? Thus,
this shortcut was on purpose? Otherwise passing -frandom-seed to
LTO would break that?
Bingfeng, did you test if LTO bootstrap still works after this patch?
Thanks,
Richard.
> Thanks,
> Bingfeng Mei
>
>
> ===================================================================
> --- ChangeLog (revision 213152)
> +++ ChangeLog (working copy)
> @@ -1,3 +1,9 @@
> +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> +
> + PR lto/61868
> + * toplev.c (init_random_seed): Generate random seed when
> + flag_random_seed is specified.
> +
> 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
>
> * cgraph.c (cgraph_node::create_indirect_edge): Copy speculative data.
> Index: toplev.c
> ===================================================================
> --- toplev.c (revision 213152)
> +++ toplev.c (working copy)
> @@ -301,7 +301,7 @@ init_random_seed (void)
> HOST_WIDE_INT
> get_random_seed (bool noinit)
> {
> - if (!flag_random_seed && !noinit)
> + if (!noinit)
> init_random_seed ();
> return random_seed;
> }
> Index: testsuite/ChangeLog
> ===================================================================
> --- testsuite/ChangeLog (revision 213152)
> +++ testsuite/ChangeLog (working copy)
> @@ -1,3 +1,8 @@
> +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> +
> + PR lto/61868
> + * gcc.dg/pr61868.c: New test.
> +
> 2014-07-28 Richard Biener <rguenther@suse.de>
>
> PR rtl-optimization/61801
> Index: testsuite/gcc.dg/pr61868.c
> ===================================================================
> --- testsuite/gcc.dg/pr61868.c (revision 0)
> +++ testsuite/gcc.dg/pr61868.c (revision 0)
> @@ -0,0 +1,9 @@
> +/* { dg-do compile } */
> +/* { dg-options "-flto -frandom-seed=0x12345" } */
> +extern int foo (int);
> +int main ()
> +{
> + foo (100);
> + return 0;
> +}
> +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] PR61868
2014-07-30 7:49 ` Richard Biener
@ 2014-07-30 9:13 ` Bingfeng Mei
2014-07-30 9:46 ` Richard Biener
2014-07-30 15:01 ` Andi Kleen
1 sibling, 1 reply; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-30 9:13 UTC (permalink / raw)
To: Richard Biener, Andi Kleen; +Cc: gcc-patches
Yes, opts-global.c fills flag_random_seed with string passed in command line. But init_random_seed in toplev.c is the one that processes the flag and set random_seed variable, which is returned by get_random_seed function.
By default, my configuration enables LTO. How to test LTO bootstrap?
Bingfeng
> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: 30 July 2014 08:47
> To: Bingfeng Mei; Andi Kleen
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
>
> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> > Hi,
> > Please find the patches for pr61868. The problem is that even with -
> frandom-seed gcc always uses 0 instead of specified number/string for
> places such as lto section names. init_random_seed is never called with
> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
>
> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
>
> Andi, wasn't this used to support partial linking of LTO objects? Thus,
> this shortcut was on purpose? Otherwise passing -frandom-seed to
> LTO would break that?
>
> Bingfeng, did you test if LTO bootstrap still works after this patch?
>
> Thanks,
> Richard.
>
> > Thanks,
> > Bingfeng Mei
> >
> >
> > ===================================================================
> > --- ChangeLog (revision 213152)
> > +++ ChangeLog (working copy)
> > @@ -1,3 +1,9 @@
> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> > +
> > + PR lto/61868
> > + * toplev.c (init_random_seed): Generate random seed when
> > + flag_random_seed is specified.
> > +
> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
> >
> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
> speculative data.
> > Index: toplev.c
> > ===================================================================
> > --- toplev.c (revision 213152)
> > +++ toplev.c (working copy)
> > @@ -301,7 +301,7 @@ init_random_seed (void)
> > HOST_WIDE_INT
> > get_random_seed (bool noinit)
> > {
> > - if (!flag_random_seed && !noinit)
> > + if (!noinit)
> > init_random_seed ();
> > return random_seed;
> > }
> > Index: testsuite/ChangeLog
> > ===================================================================
> > --- testsuite/ChangeLog (revision 213152)
> > +++ testsuite/ChangeLog (working copy)
> > @@ -1,3 +1,8 @@
> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> > +
> > + PR lto/61868
> > + * gcc.dg/pr61868.c: New test.
> > +
> > 2014-07-28 Richard Biener <rguenther@suse.de>
> >
> > PR rtl-optimization/61801
> > Index: testsuite/gcc.dg/pr61868.c
> > ===================================================================
> > --- testsuite/gcc.dg/pr61868.c (revision 0)
> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
> > @@ -0,0 +1,9 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
> > +extern int foo (int);
> > +int main ()
> > +{
> > + foo (100);
> > + return 0;
> > +}
> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] PR61868
2014-07-30 9:13 ` Bingfeng Mei
@ 2014-07-30 9:46 ` Richard Biener
2014-07-30 10:48 ` Bingfeng Mei
2014-07-30 12:56 ` Bingfeng Mei
0 siblings, 2 replies; 11+ messages in thread
From: Richard Biener @ 2014-07-30 9:46 UTC (permalink / raw)
To: Bingfeng Mei; +Cc: Andi Kleen, gcc-patches
On Wed, Jul 30, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
> Yes, opts-global.c fills flag_random_seed with string passed in command line. But init_random_seed in toplev.c is the one that processes the flag and set random_seed variable, which is returned by get_random_seed function.
Err, I meant opts-global.c:handle_common_deferred_options
> By default, my configuration enables LTO. How to test LTO bootstrap?
configure with --with-build-config=bootstrap-lto (and reduce the
set of languages to c,c++ to get a sane bootstrap time).
Richard.
> Bingfeng
>
>> -----Original Message-----
>> From: Richard Biener [mailto:richard.guenther@gmail.com]
>> Sent: 30 July 2014 08:47
>> To: Bingfeng Mei; Andi Kleen
>> Cc: gcc-patches@gcc.gnu.org
>> Subject: Re: [PATCH] PR61868
>>
>> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
>> > Hi,
>> > Please find the patches for pr61868. The problem is that even with -
>> frandom-seed gcc always uses 0 instead of specified number/string for
>> places such as lto section names. init_random_seed is never called with
>> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
>>
>> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
>>
>> Andi, wasn't this used to support partial linking of LTO objects? Thus,
>> this shortcut was on purpose? Otherwise passing -frandom-seed to
>> LTO would break that?
>>
>> Bingfeng, did you test if LTO bootstrap still works after this patch?
>>
>> Thanks,
>> Richard.
>>
>> > Thanks,
>> > Bingfeng Mei
>> >
>> >
>> > ===================================================================
>> > --- ChangeLog (revision 213152)
>> > +++ ChangeLog (working copy)
>> > @@ -1,3 +1,9 @@
>> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
>> > +
>> > + PR lto/61868
>> > + * toplev.c (init_random_seed): Generate random seed when
>> > + flag_random_seed is specified.
>> > +
>> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
>> >
>> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
>> speculative data.
>> > Index: toplev.c
>> > ===================================================================
>> > --- toplev.c (revision 213152)
>> > +++ toplev.c (working copy)
>> > @@ -301,7 +301,7 @@ init_random_seed (void)
>> > HOST_WIDE_INT
>> > get_random_seed (bool noinit)
>> > {
>> > - if (!flag_random_seed && !noinit)
>> > + if (!noinit)
>> > init_random_seed ();
>> > return random_seed;
>> > }
>> > Index: testsuite/ChangeLog
>> > ===================================================================
>> > --- testsuite/ChangeLog (revision 213152)
>> > +++ testsuite/ChangeLog (working copy)
>> > @@ -1,3 +1,8 @@
>> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
>> > +
>> > + PR lto/61868
>> > + * gcc.dg/pr61868.c: New test.
>> > +
>> > 2014-07-28 Richard Biener <rguenther@suse.de>
>> >
>> > PR rtl-optimization/61801
>> > Index: testsuite/gcc.dg/pr61868.c
>> > ===================================================================
>> > --- testsuite/gcc.dg/pr61868.c (revision 0)
>> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
>> > @@ -0,0 +1,9 @@
>> > +/* { dg-do compile } */
>> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
>> > +extern int foo (int);
>> > +int main ()
>> > +{
>> > + foo (100);
>> > + return 0;
>> > +}
>> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
>> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] PR61868
2014-07-30 9:46 ` Richard Biener
@ 2014-07-30 10:48 ` Bingfeng Mei
2014-07-30 12:56 ` Bingfeng Mei
1 sibling, 0 replies; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-30 10:48 UTC (permalink / raw)
To: Richard Biener; +Cc: Andi Kleen, gcc-patches
It did take a lot of time, but passed the LTO bootstrap.
Bingfeng
> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: 30 July 2014 10:43
> To: Bingfeng Mei
> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
>
> On Wed, Jul 30, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
> > Yes, opts-global.c fills flag_random_seed with string passed in
> command line. But init_random_seed in toplev.c is the one that processes
> the flag and set random_seed variable, which is returned by
> get_random_seed function.
>
> Err, I meant opts-global.c:handle_common_deferred_options
>
> > By default, my configuration enables LTO. How to test LTO bootstrap?
>
> configure with --with-build-config=bootstrap-lto (and reduce the
> set of languages to c,c++ to get a sane bootstrap time).
>
> Richard.
>
> > Bingfeng
> >
> >> -----Original Message-----
> >> From: Richard Biener [mailto:richard.guenther@gmail.com]
> >> Sent: 30 July 2014 08:47
> >> To: Bingfeng Mei; Andi Kleen
> >> Cc: gcc-patches@gcc.gnu.org
> >> Subject: Re: [PATCH] PR61868
> >>
> >> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com>
> wrote:
> >> > Hi,
> >> > Please find the patches for pr61868. The problem is that even with
> -
> >> frandom-seed gcc always uses 0 instead of specified number/string for
> >> places such as lto section names. init_random_seed is never called
> with
> >> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
> >>
> >> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
> >>
> >> Andi, wasn't this used to support partial linking of LTO objects?
> Thus,
> >> this shortcut was on purpose? Otherwise passing -frandom-seed to
> >> LTO would break that?
> >>
> >> Bingfeng, did you test if LTO bootstrap still works after this patch?
> >>
> >> Thanks,
> >> Richard.
> >>
> >> > Thanks,
> >> > Bingfeng Mei
> >> >
> >> >
> >> > ===================================================================
> >> > --- ChangeLog (revision 213152)
> >> > +++ ChangeLog (working copy)
> >> > @@ -1,3 +1,9 @@
> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> > +
> >> > + PR lto/61868
> >> > + * toplev.c (init_random_seed): Generate random seed when
> >> > + flag_random_seed is specified.
> >> > +
> >> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
> >> >
> >> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
> >> speculative data.
> >> > Index: toplev.c
> >> > ===================================================================
> >> > --- toplev.c (revision 213152)
> >> > +++ toplev.c (working copy)
> >> > @@ -301,7 +301,7 @@ init_random_seed (void)
> >> > HOST_WIDE_INT
> >> > get_random_seed (bool noinit)
> >> > {
> >> > - if (!flag_random_seed && !noinit)
> >> > + if (!noinit)
> >> > init_random_seed ();
> >> > return random_seed;
> >> > }
> >> > Index: testsuite/ChangeLog
> >> > ===================================================================
> >> > --- testsuite/ChangeLog (revision 213152)
> >> > +++ testsuite/ChangeLog (working copy)
> >> > @@ -1,3 +1,8 @@
> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> > +
> >> > + PR lto/61868
> >> > + * gcc.dg/pr61868.c: New test.
> >> > +
> >> > 2014-07-28 Richard Biener <rguenther@suse.de>
> >> >
> >> > PR rtl-optimization/61801
> >> > Index: testsuite/gcc.dg/pr61868.c
> >> > ===================================================================
> >> > --- testsuite/gcc.dg/pr61868.c (revision 0)
> >> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
> >> > @@ -0,0 +1,9 @@
> >> > +/* { dg-do compile } */
> >> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
> >> > +extern int foo (int);
> >> > +int main ()
> >> > +{
> >> > + foo (100);
> >> > + return 0;
> >> > +}
> >> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> >> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] PR61868
2014-07-30 9:46 ` Richard Biener
2014-07-30 10:48 ` Bingfeng Mei
@ 2014-07-30 12:56 ` Bingfeng Mei
2014-07-30 13:19 ` Richard Biener
1 sibling, 1 reply; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-30 12:56 UTC (permalink / raw)
To: Richard Biener; +Cc: Andi Kleen, gcc-patches
On the second thought, maybe the change should be made in set_random_seed. Otherwise, init_random_seed is invoked every time get_random_seed get called (not sure how often). What do you think?
const char *
set_random_seed (const char *val)
{
const char *old = flag_random_seed;
flag_random_seed = val;
+ init_random_seed ();
return old;
}
Bingfeng
> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: 30 July 2014 10:43
> To: Bingfeng Mei
> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
>
> On Wed, Jul 30, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
> > Yes, opts-global.c fills flag_random_seed with string passed in
> command line. But init_random_seed in toplev.c is the one that processes
> the flag and set random_seed variable, which is returned by
> get_random_seed function.
>
> Err, I meant opts-global.c:handle_common_deferred_options
>
> > By default, my configuration enables LTO. How to test LTO bootstrap?
>
> configure with --with-build-config=bootstrap-lto (and reduce the
> set of languages to c,c++ to get a sane bootstrap time).
>
> Richard.
>
> > Bingfeng
> >
> >> -----Original Message-----
> >> From: Richard Biener [mailto:richard.guenther@gmail.com]
> >> Sent: 30 July 2014 08:47
> >> To: Bingfeng Mei; Andi Kleen
> >> Cc: gcc-patches@gcc.gnu.org
> >> Subject: Re: [PATCH] PR61868
> >>
> >> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com>
> wrote:
> >> > Hi,
> >> > Please find the patches for pr61868. The problem is that even with
> -
> >> frandom-seed gcc always uses 0 instead of specified number/string for
> >> places such as lto section names. init_random_seed is never called
> with
> >> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
> >>
> >> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
> >>
> >> Andi, wasn't this used to support partial linking of LTO objects?
> Thus,
> >> this shortcut was on purpose? Otherwise passing -frandom-seed to
> >> LTO would break that?
> >>
> >> Bingfeng, did you test if LTO bootstrap still works after this patch?
> >>
> >> Thanks,
> >> Richard.
> >>
> >> > Thanks,
> >> > Bingfeng Mei
> >> >
> >> >
> >> > ===================================================================
> >> > --- ChangeLog (revision 213152)
> >> > +++ ChangeLog (working copy)
> >> > @@ -1,3 +1,9 @@
> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> > +
> >> > + PR lto/61868
> >> > + * toplev.c (init_random_seed): Generate random seed when
> >> > + flag_random_seed is specified.
> >> > +
> >> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
> >> >
> >> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
> >> speculative data.
> >> > Index: toplev.c
> >> > ===================================================================
> >> > --- toplev.c (revision 213152)
> >> > +++ toplev.c (working copy)
> >> > @@ -301,7 +301,7 @@ init_random_seed (void)
> >> > HOST_WIDE_INT
> >> > get_random_seed (bool noinit)
> >> > {
> >> > - if (!flag_random_seed && !noinit)
> >> > + if (!noinit)
> >> > init_random_seed ();
> >> > return random_seed;
> >> > }
> >> > Index: testsuite/ChangeLog
> >> > ===================================================================
> >> > --- testsuite/ChangeLog (revision 213152)
> >> > +++ testsuite/ChangeLog (working copy)
> >> > @@ -1,3 +1,8 @@
> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> > +
> >> > + PR lto/61868
> >> > + * gcc.dg/pr61868.c: New test.
> >> > +
> >> > 2014-07-28 Richard Biener <rguenther@suse.de>
> >> >
> >> > PR rtl-optimization/61801
> >> > Index: testsuite/gcc.dg/pr61868.c
> >> > ===================================================================
> >> > --- testsuite/gcc.dg/pr61868.c (revision 0)
> >> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
> >> > @@ -0,0 +1,9 @@
> >> > +/* { dg-do compile } */
> >> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
> >> > +extern int foo (int);
> >> > +int main ()
> >> > +{
> >> > + foo (100);
> >> > + return 0;
> >> > +}
> >> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> >> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] PR61868
2014-07-30 12:56 ` Bingfeng Mei
@ 2014-07-30 13:19 ` Richard Biener
2014-07-30 15:23 ` Bingfeng Mei
0 siblings, 1 reply; 11+ messages in thread
From: Richard Biener @ 2014-07-30 13:19 UTC (permalink / raw)
To: Bingfeng Mei; +Cc: Andi Kleen, gcc-patches
On Wed, Jul 30, 2014 at 2:48 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> On the second thought, maybe the change should be made in set_random_seed. Otherwise, init_random_seed is invoked every time get_random_seed get called (not sure how often). What do you think?
>
> const char *
> set_random_seed (const char *val)
> {
> const char *old = flag_random_seed;
> flag_random_seed = val;
> + init_random_seed ();
> return old;
> }
I think it makes more sense to move the if (flag_random_seed)
code from init_random_seed inline here as init_random_seed is
never called with flag_random_set == true.
Richard.
> Bingfeng
>
>> -----Original Message-----
>> From: Richard Biener [mailto:richard.guenther@gmail.com]
>> Sent: 30 July 2014 10:43
>> To: Bingfeng Mei
>> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
>> Subject: Re: [PATCH] PR61868
>>
>> On Wed, Jul 30, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com> wrote:
>> > Yes, opts-global.c fills flag_random_seed with string passed in
>> command line. But init_random_seed in toplev.c is the one that processes
>> the flag and set random_seed variable, which is returned by
>> get_random_seed function.
>>
>> Err, I meant opts-global.c:handle_common_deferred_options
>>
>> > By default, my configuration enables LTO. How to test LTO bootstrap?
>>
>> configure with --with-build-config=bootstrap-lto (and reduce the
>> set of languages to c,c++ to get a sane bootstrap time).
>>
>> Richard.
>>
>> > Bingfeng
>> >
>> >> -----Original Message-----
>> >> From: Richard Biener [mailto:richard.guenther@gmail.com]
>> >> Sent: 30 July 2014 08:47
>> >> To: Bingfeng Mei; Andi Kleen
>> >> Cc: gcc-patches@gcc.gnu.org
>> >> Subject: Re: [PATCH] PR61868
>> >>
>> >> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com>
>> wrote:
>> >> > Hi,
>> >> > Please find the patches for pr61868. The problem is that even with
>> -
>> >> frandom-seed gcc always uses 0 instead of specified number/string for
>> >> places such as lto section names. init_random_seed is never called
>> with
>> >> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
>> >>
>> >> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
>> >>
>> >> Andi, wasn't this used to support partial linking of LTO objects?
>> Thus,
>> >> this shortcut was on purpose? Otherwise passing -frandom-seed to
>> >> LTO would break that?
>> >>
>> >> Bingfeng, did you test if LTO bootstrap still works after this patch?
>> >>
>> >> Thanks,
>> >> Richard.
>> >>
>> >> > Thanks,
>> >> > Bingfeng Mei
>> >> >
>> >> >
>> >> > ===================================================================
>> >> > --- ChangeLog (revision 213152)
>> >> > +++ ChangeLog (working copy)
>> >> > @@ -1,3 +1,9 @@
>> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
>> >> > +
>> >> > + PR lto/61868
>> >> > + * toplev.c (init_random_seed): Generate random seed when
>> >> > + flag_random_seed is specified.
>> >> > +
>> >> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
>> >> >
>> >> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
>> >> speculative data.
>> >> > Index: toplev.c
>> >> > ===================================================================
>> >> > --- toplev.c (revision 213152)
>> >> > +++ toplev.c (working copy)
>> >> > @@ -301,7 +301,7 @@ init_random_seed (void)
>> >> > HOST_WIDE_INT
>> >> > get_random_seed (bool noinit)
>> >> > {
>> >> > - if (!flag_random_seed && !noinit)
>> >> > + if (!noinit)
>> >> > init_random_seed ();
>> >> > return random_seed;
>> >> > }
>> >> > Index: testsuite/ChangeLog
>> >> > ===================================================================
>> >> > --- testsuite/ChangeLog (revision 213152)
>> >> > +++ testsuite/ChangeLog (working copy)
>> >> > @@ -1,3 +1,8 @@
>> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
>> >> > +
>> >> > + PR lto/61868
>> >> > + * gcc.dg/pr61868.c: New test.
>> >> > +
>> >> > 2014-07-28 Richard Biener <rguenther@suse.de>
>> >> >
>> >> > PR rtl-optimization/61801
>> >> > Index: testsuite/gcc.dg/pr61868.c
>> >> > ===================================================================
>> >> > --- testsuite/gcc.dg/pr61868.c (revision 0)
>> >> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
>> >> > @@ -0,0 +1,9 @@
>> >> > +/* { dg-do compile } */
>> >> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
>> >> > +extern int foo (int);
>> >> > +int main ()
>> >> > +{
>> >> > + foo (100);
>> >> > + return 0;
>> >> > +}
>> >> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
>> >> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] PR61868
2014-07-30 7:49 ` Richard Biener
2014-07-30 9:13 ` Bingfeng Mei
@ 2014-07-30 15:01 ` Andi Kleen
1 sibling, 0 replies; 11+ messages in thread
From: Andi Kleen @ 2014-07-30 15:01 UTC (permalink / raw)
To: Richard Biener; +Cc: Bingfeng Mei, gcc-patches
On Wed, Jul 30, 2014 at 09:46:48AM +0200, Richard Biener wrote:
> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> > Hi,
> > Please find the patches for pr61868. The problem is that even with -frandom-seed gcc always uses 0 instead of specified number/string for places such as lto section names. init_random_seed is never called with -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
>
> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
>
> Andi, wasn't this used to support partial linking of LTO objects? Thus,
> this shortcut was on purpose? Otherwise passing -frandom-seed to
> LTO would break that?
I don't think it was on purpose. Partial linking doesn't need
the seeds. The seeding was only to avoid compare failures in
the gcc build.
-Andi
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] PR61868
2014-07-30 13:19 ` Richard Biener
@ 2014-07-30 15:23 ` Bingfeng Mei
2014-07-31 3:49 ` Jeff Law
0 siblings, 1 reply; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-30 15:23 UTC (permalink / raw)
To: Richard Biener; +Cc: Andi Kleen, gcc-patches
Yes, that fix is better. Here are updated patches. LTO-bootstrapped and tested. OK?
Bingfeng
Index: ChangeLog
===================================================================
--- ChangeLog (revision 213152)
+++ ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2014-07-29 Bingfeng Mei <bmei@broadcom.com>
+
+ PR lto/61868
+ * toplev.c (init_random_seed): Move piece of code never called to
+ set_random_seed.
+ (set_random_seed): see above.
+
2014-07-28 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (cgraph_node::create_indirect_edge): Copy speculative data.
Index: toplev.c
===================================================================
--- toplev.c (revision 213152)
+++ toplev.c (working copy)
@@ -282,16 +282,7 @@ init_local_tick (void)
static void
init_random_seed (void)
{
- if (flag_random_seed)
- {
- char *endp;
-
- /* When the driver passed in a hex number don't crc it again */
- random_seed = strtoul (flag_random_seed, &endp, 0);
- if (!(endp > flag_random_seed && *endp == 0))
- random_seed = crc32_string (0, flag_random_seed);
- }
- else if (!random_seed)
+ if (!random_seed)
random_seed = local_tick ^ getpid (); /* Old racey fallback method */
}
@@ -314,6 +305,15 @@ set_random_seed (const char *val)
{
const char *old = flag_random_seed;
flag_random_seed = val;
+ if (flag_random_seed)
+ {
+ char *endp;
+
+ /* When the driver passed in a hex number don't crc it again */
+ random_seed = strtoul (flag_random_seed, &endp, 0);
+ if (!(endp > flag_random_seed && *endp == 0))
+ random_seed = crc32_string (0, flag_random_seed);
+ }
return old;
}
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 213152)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-07-29 Bingfeng Mei <bmei@broadcom.com>
+
+ PR lto/61868
+ * gcc.dg/pr61868.c: New test.
+
2014-07-28 Richard Biener <rguenther@suse.de>
PR rtl-optimization/61801
Index: testsuite/gcc.dg/pr61868.c
===================================================================
--- testsuite/gcc.dg/pr61868.c (revision 0)
+++ testsuite/gcc.dg/pr61868.c (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-flto -frandom-seed=0x12345" } */
+extern int foo (int);
+int main ()
+{
+ foo (100);
+ return 0;
+}
+/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: 30 July 2014 14:08
> To: Bingfeng Mei
> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
>
> On Wed, Jul 30, 2014 at 2:48 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> > On the second thought, maybe the change should be made in
> set_random_seed. Otherwise, init_random_seed is invoked every time
> get_random_seed get called (not sure how often). What do you think?
> >
> > const char *
> > set_random_seed (const char *val)
> > {
> > const char *old = flag_random_seed;
> > flag_random_seed = val;
> > + init_random_seed ();
> > return old;
> > }
>
> I think it makes more sense to move the if (flag_random_seed)
> code from init_random_seed inline here as init_random_seed is
> never called with flag_random_set == true.
>
> Richard.
>
> > Bingfeng
> >
> >> -----Original Message-----
> >> From: Richard Biener [mailto:richard.guenther@gmail.com]
> >> Sent: 30 July 2014 10:43
> >> To: Bingfeng Mei
> >> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
> >> Subject: Re: [PATCH] PR61868
> >>
> >> On Wed, Jul 30, 2014 at 10:52 AM, Bingfeng Mei <bmei@broadcom.com>
> wrote:
> >> > Yes, opts-global.c fills flag_random_seed with string passed in
> >> command line. But init_random_seed in toplev.c is the one that
> processes
> >> the flag and set random_seed variable, which is returned by
> >> get_random_seed function.
> >>
> >> Err, I meant opts-global.c:handle_common_deferred_options
> >>
> >> > By default, my configuration enables LTO. How to test LTO bootstrap?
> >>
> >> configure with --with-build-config=bootstrap-lto (and reduce the
> >> set of languages to c,c++ to get a sane bootstrap time).
> >>
> >> Richard.
> >>
> >> > Bingfeng
> >> >
> >> >> -----Original Message-----
> >> >> From: Richard Biener [mailto:richard.guenther@gmail.com]
> >> >> Sent: 30 July 2014 08:47
> >> >> To: Bingfeng Mei; Andi Kleen
> >> >> Cc: gcc-patches@gcc.gnu.org
> >> >> Subject: Re: [PATCH] PR61868
> >> >>
> >> >> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <bmei@broadcom.com>
> >> wrote:
> >> >> > Hi,
> >> >> > Please find the patches for pr61868. The problem is that even
> with
> >> -
> >> >> frandom-seed gcc always uses 0 instead of specified number/string
> for
> >> >> places such as lto section names. init_random_seed is never called
> >> with
> >> >> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
> >> >>
> >> >> Hmm, but -frandom-seed= is honored by opts.c calling
> set_random_seed?
> >> >>
> >> >> Andi, wasn't this used to support partial linking of LTO objects?
> >> Thus,
> >> >> this shortcut was on purpose? Otherwise passing -frandom-seed to
> >> >> LTO would break that?
> >> >>
> >> >> Bingfeng, did you test if LTO bootstrap still works after this
> patch?
> >> >>
> >> >> Thanks,
> >> >> Richard.
> >> >>
> >> >> > Thanks,
> >> >> > Bingfeng Mei
> >> >> >
> >> >> >
> >> >> >
> ===================================================================
> >> >> > --- ChangeLog (revision 213152)
> >> >> > +++ ChangeLog (working copy)
> >> >> > @@ -1,3 +1,9 @@
> >> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> >> > +
> >> >> > + PR lto/61868
> >> >> > + * toplev.c (init_random_seed): Generate random seed when
> >> >> > + flag_random_seed is specified.
> >> >> > +
> >> >> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
> >> >> >
> >> >> > * cgraph.c (cgraph_node::create_indirect_edge): Copy
> >> >> speculative data.
> >> >> > Index: toplev.c
> >> >> >
> ===================================================================
> >> >> > --- toplev.c (revision 213152)
> >> >> > +++ toplev.c (working copy)
> >> >> > @@ -301,7 +301,7 @@ init_random_seed (void)
> >> >> > HOST_WIDE_INT
> >> >> > get_random_seed (bool noinit)
> >> >> > {
> >> >> > - if (!flag_random_seed && !noinit)
> >> >> > + if (!noinit)
> >> >> > init_random_seed ();
> >> >> > return random_seed;
> >> >> > }
> >> >> > Index: testsuite/ChangeLog
> >> >> >
> ===================================================================
> >> >> > --- testsuite/ChangeLog (revision 213152)
> >> >> > +++ testsuite/ChangeLog (working copy)
> >> >> > @@ -1,3 +1,8 @@
> >> >> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> >> >> > +
> >> >> > + PR lto/61868
> >> >> > + * gcc.dg/pr61868.c: New test.
> >> >> > +
> >> >> > 2014-07-28 Richard Biener <rguenther@suse.de>
> >> >> >
> >> >> > PR rtl-optimization/61801
> >> >> > Index: testsuite/gcc.dg/pr61868.c
> >> >> >
> ===================================================================
> >> >> > --- testsuite/gcc.dg/pr61868.c (revision 0)
> >> >> > +++ testsuite/gcc.dg/pr61868.c (revision 0)
> >> >> > @@ -0,0 +1,9 @@
> >> >> > +/* { dg-do compile } */
> >> >> > +/* { dg-options "-flto -frandom-seed=0x12345" } */
> >> >> > +extern int foo (int);
> >> >> > +int main ()
> >> >> > +{
> >> >> > + foo (100);
> >> >> > + return 0;
> >> >> > +}
> >> >> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> >> >> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] PR61868
2014-07-30 15:23 ` Bingfeng Mei
@ 2014-07-31 3:49 ` Jeff Law
2014-07-31 9:11 ` Bingfeng Mei
0 siblings, 1 reply; 11+ messages in thread
From: Jeff Law @ 2014-07-31 3:49 UTC (permalink / raw)
To: Bingfeng Mei, Richard Biener; +Cc: Andi Kleen, gcc-patches
On 07/30/14 09:20, Bingfeng Mei wrote:
> Yes, that fix is better. Here are updated patches. LTO-bootstrapped and tested. OK?
>
> Bingfeng
>
> Index: ChangeLog
> ===================================================================
> --- ChangeLog (revision 213152)
> +++ ChangeLog (working copy)
> @@ -1,3 +1,10 @@
> +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> +
> + PR lto/61868
> + * toplev.c (init_random_seed): Move piece of code never called to
> + set_random_seed.
> + (set_random_seed): see above.
> +
> 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
OK for the trunk.
Thanks,
Jeff
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] PR61868
2014-07-31 3:49 ` Jeff Law
@ 2014-07-31 9:11 ` Bingfeng Mei
0 siblings, 0 replies; 11+ messages in thread
From: Bingfeng Mei @ 2014-07-31 9:11 UTC (permalink / raw)
To: Jeff Law, Richard Biener; +Cc: Andi Kleen, gcc-patches
Thanks, Jeff. Checked in.
Bingfeng
> -----Original Message-----
> From: Jeff Law [mailto:law@redhat.com]
> Sent: 31 July 2014 04:43
> To: Bingfeng Mei; Richard Biener
> Cc: Andi Kleen; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
>
> On 07/30/14 09:20, Bingfeng Mei wrote:
> > Yes, that fix is better. Here are updated patches. LTO-bootstrapped
> and tested. OK?
> >
> > Bingfeng
> >
> > Index: ChangeLog
> > ===================================================================
> > --- ChangeLog (revision 213152)
> > +++ ChangeLog (working copy)
> > @@ -1,3 +1,10 @@
> > +2014-07-29 Bingfeng Mei <bmei@broadcom.com>
> > +
> > + PR lto/61868
> > + * toplev.c (init_random_seed): Move piece of code never called
> to
> > + set_random_seed.
> > + (set_random_seed): see above.
> > +
> > 2014-07-28 Jan Hubicka <hubicka@ucw.cz>
> OK for the trunk.
>
> Thanks,
> Jeff
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-07-31 8:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 13:36 [PATCH] PR61868 Bingfeng Mei
2014-07-30 7:49 ` Richard Biener
2014-07-30 9:13 ` Bingfeng Mei
2014-07-30 9:46 ` Richard Biener
2014-07-30 10:48 ` Bingfeng Mei
2014-07-30 12:56 ` Bingfeng Mei
2014-07-30 13:19 ` Richard Biener
2014-07-30 15:23 ` Bingfeng Mei
2014-07-31 3:49 ` Jeff Law
2014-07-31 9:11 ` Bingfeng Mei
2014-07-30 15:01 ` 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).