* [PATCH] Fix PR83089
@ 2017-11-22 8:54 Richard Biener
2017-11-22 20:38 ` Christophe Lyon
0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2017-11-22 8:54 UTC (permalink / raw)
To: gcc-patches
The following fixes if-conversion to free SCEV/niter estimates because
it DCEs stmts.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2017-11-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/83089
* tree-if-conv.c (pass_if_conversion::execute): If anything
changed reset SCEV and free the number of iteration estimates.
* gcc.dg/pr83089.c: New testcase.
Index: gcc/tree-if-conv.c
===================================================================
--- gcc/tree-if-conv.c (revision 254990)
+++ gcc/tree-if-conv.c (working copy)
@@ -2959,6 +2959,12 @@ pass_if_conversion::execute (function *f
&& !loop->dont_vectorize))
todo |= tree_if_conversion (loop);
+ if (todo)
+ {
+ free_numbers_of_iterations_estimates (fun);
+ scev_reset ();
+ }
+
if (flag_checking)
{
basic_block bb;
Index: gcc/testsuite/gcc.dg/pr83089.c
===================================================================
--- gcc/testsuite/gcc.dg/pr83089.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
+
+int rl, s8;
+
+void
+it (int zy, short int el)
+{
+ int hb;
+
+ while (el != 0)
+ {
+ hb = el;
+ for (rl = 0; rl < 200; ++rl)
+ {
+ for (s8 = 0; s8 < 2; ++s8)
+ {
+ }
+ if (s8 < 3)
+ zy = hb;
+ if (hb == 0)
+ ++s8;
+ zy += (s8 != -1);
+ }
+ el = zy;
+ }
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix PR83089
2017-11-22 8:54 [PATCH] Fix PR83089 Richard Biener
@ 2017-11-22 20:38 ` Christophe Lyon
2017-11-23 8:50 ` Richard Biener
0 siblings, 1 reply; 4+ messages in thread
From: Christophe Lyon @ 2017-11-22 20:38 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
On 22 November 2017 at 09:44, Richard Biener <rguenther@suse.de> wrote:
>
> The following fixes if-conversion to free SCEV/niter estimates because
> it DCEs stmts.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
>
> Richard.
>
> 2017-11-22 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/83089
> * tree-if-conv.c (pass_if_conversion::execute): If anything
> changed reset SCEV and free the number of iteration estimates.
>
> * gcc.dg/pr83089.c: New testcase.
>
> Index: gcc/tree-if-conv.c
> ===================================================================
> --- gcc/tree-if-conv.c (revision 254990)
> +++ gcc/tree-if-conv.c (working copy)
> @@ -2959,6 +2959,12 @@ pass_if_conversion::execute (function *f
> && !loop->dont_vectorize))
> todo |= tree_if_conversion (loop);
>
> + if (todo)
> + {
> + free_numbers_of_iterations_estimates (fun);
> + scev_reset ();
> + }
> +
> if (flag_checking)
> {
> basic_block bb;
> Index: gcc/testsuite/gcc.dg/pr83089.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/pr83089.c (nonexistent)
> +++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
> @@ -0,0 +1,27 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
> +
> +int rl, s8;
> +
> +void
> +it (int zy, short int el)
> +{
> + int hb;
> +
> + while (el != 0)
> + {
> + hb = el;
> + for (rl = 0; rl < 200; ++rl)
> + {
> + for (s8 = 0; s8 < 2; ++s8)
> + {
> + }
> + if (s8 < 3)
> + zy = hb;
> + if (hb == 0)
> + ++s8;
> + zy += (s8 != -1);
> + }
> + el = zy;
> + }
> +}
I see the new testcase failing to compile on bare-metal targets
(aarch64-elf, arm-eabi):
spawn -ignore SIGHUP
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/xgcc
-B/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/
/gcc/testsuite/gcc.dg/pr83089.c -fno-diagnostics-show-caret
-fdiagnostics-color=never -O2 -ftree-loop-if-convert
-ftree-parallelize-loops=2 -S -specs=aem-ve.specs -o pr83089.s
xgcc: error: unrecognized command line option '-pthread'
compiler exited with status 1
FAIL: gcc.dg/pr83089.c (test for excess errors)
Where does that -pthread come from?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix PR83089
2017-11-22 20:38 ` Christophe Lyon
@ 2017-11-23 8:50 ` Richard Biener
2017-11-23 22:45 ` Christophe Lyon
0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2017-11-23 8:50 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches
On Wed, 22 Nov 2017, Christophe Lyon wrote:
> On 22 November 2017 at 09:44, Richard Biener <rguenther@suse.de> wrote:
> >
> > The following fixes if-conversion to free SCEV/niter estimates because
> > it DCEs stmts.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
> >
> > Richard.
> >
> > 2017-11-22 Richard Biener <rguenther@suse.de>
> >
> > PR tree-optimization/83089
> > * tree-if-conv.c (pass_if_conversion::execute): If anything
> > changed reset SCEV and free the number of iteration estimates.
> >
> > * gcc.dg/pr83089.c: New testcase.
> >
> > Index: gcc/tree-if-conv.c
> > ===================================================================
> > --- gcc/tree-if-conv.c (revision 254990)
> > +++ gcc/tree-if-conv.c (working copy)
> > @@ -2959,6 +2959,12 @@ pass_if_conversion::execute (function *f
> > && !loop->dont_vectorize))
> > todo |= tree_if_conversion (loop);
> >
> > + if (todo)
> > + {
> > + free_numbers_of_iterations_estimates (fun);
> > + scev_reset ();
> > + }
> > +
> > if (flag_checking)
> > {
> > basic_block bb;
> > Index: gcc/testsuite/gcc.dg/pr83089.c
> > ===================================================================
> > --- gcc/testsuite/gcc.dg/pr83089.c (nonexistent)
> > +++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
> > @@ -0,0 +1,27 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
> > +
> > +int rl, s8;
> > +
> > +void
> > +it (int zy, short int el)
> > +{
> > + int hb;
> > +
> > + while (el != 0)
> > + {
> > + hb = el;
> > + for (rl = 0; rl < 200; ++rl)
> > + {
> > + for (s8 = 0; s8 < 2; ++s8)
> > + {
> > + }
> > + if (s8 < 3)
> > + zy = hb;
> > + if (hb == 0)
> > + ++s8;
> > + zy += (s8 != -1);
> > + }
> > + el = zy;
> > + }
> > +}
>
> I see the new testcase failing to compile on bare-metal targets
> (aarch64-elf, arm-eabi):
> spawn -ignore SIGHUP
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/xgcc
> -B/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/
> /gcc/testsuite/gcc.dg/pr83089.c -fno-diagnostics-show-caret
> -fdiagnostics-color=never -O2 -ftree-loop-if-convert
> -ftree-parallelize-loops=2 -S -specs=aem-ve.specs -o pr83089.s
> xgcc: error: unrecognized command line option '-pthread'
> compiler exited with status 1
> FAIL: gcc.dg/pr83089.c (test for excess errors)
>
> Where does that -pthread come from?
From some specs processing I guess. Didn't think that it could
happen for a compile only testcase.
Fixed with
2017-11-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/83089
* gcc.dg/pr83089.c: Require pthread.
Index: gcc/testsuite/gcc.dg/pr83089.c
===================================================================
--- gcc/testsuite/gcc.dg/pr83089.c (revision 255060)
+++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
/* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
int rl, s8;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix PR83089
2017-11-23 8:50 ` Richard Biener
@ 2017-11-23 22:45 ` Christophe Lyon
0 siblings, 0 replies; 4+ messages in thread
From: Christophe Lyon @ 2017-11-23 22:45 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
On 23 November 2017 at 09:22, Richard Biener <rguenther@suse.de> wrote:
> On Wed, 22 Nov 2017, Christophe Lyon wrote:
>
>> On 22 November 2017 at 09:44, Richard Biener <rguenther@suse.de> wrote:
>> >
>> > The following fixes if-conversion to free SCEV/niter estimates because
>> > it DCEs stmts.
>> >
>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
>> >
>> > Richard.
>> >
>> > 2017-11-22 Richard Biener <rguenther@suse.de>
>> >
>> > PR tree-optimization/83089
>> > * tree-if-conv.c (pass_if_conversion::execute): If anything
>> > changed reset SCEV and free the number of iteration estimates.
>> >
>> > * gcc.dg/pr83089.c: New testcase.
>> >
>> > Index: gcc/tree-if-conv.c
>> > ===================================================================
>> > --- gcc/tree-if-conv.c (revision 254990)
>> > +++ gcc/tree-if-conv.c (working copy)
>> > @@ -2959,6 +2959,12 @@ pass_if_conversion::execute (function *f
>> > && !loop->dont_vectorize))
>> > todo |= tree_if_conversion (loop);
>> >
>> > + if (todo)
>> > + {
>> > + free_numbers_of_iterations_estimates (fun);
>> > + scev_reset ();
>> > + }
>> > +
>> > if (flag_checking)
>> > {
>> > basic_block bb;
>> > Index: gcc/testsuite/gcc.dg/pr83089.c
>> > ===================================================================
>> > --- gcc/testsuite/gcc.dg/pr83089.c (nonexistent)
>> > +++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
>> > @@ -0,0 +1,27 @@
>> > +/* { dg-do compile } */
>> > +/* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
>> > +
>> > +int rl, s8;
>> > +
>> > +void
>> > +it (int zy, short int el)
>> > +{
>> > + int hb;
>> > +
>> > + while (el != 0)
>> > + {
>> > + hb = el;
>> > + for (rl = 0; rl < 200; ++rl)
>> > + {
>> > + for (s8 = 0; s8 < 2; ++s8)
>> > + {
>> > + }
>> > + if (s8 < 3)
>> > + zy = hb;
>> > + if (hb == 0)
>> > + ++s8;
>> > + zy += (s8 != -1);
>> > + }
>> > + el = zy;
>> > + }
>> > +}
>>
>> I see the new testcase failing to compile on bare-metal targets
>> (aarch64-elf, arm-eabi):
>> spawn -ignore SIGHUP
>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/xgcc
>> -B/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-elf/gcc3/gcc/
>> /gcc/testsuite/gcc.dg/pr83089.c -fno-diagnostics-show-caret
>> -fdiagnostics-color=never -O2 -ftree-loop-if-convert
>> -ftree-parallelize-loops=2 -S -specs=aem-ve.specs -o pr83089.s
>> xgcc: error: unrecognized command line option '-pthread'
>> compiler exited with status 1
>> FAIL: gcc.dg/pr83089.c (test for excess errors)
>>
>> Where does that -pthread come from?
>
> From some specs processing I guess. Didn't think that it could
> happen for a compile only testcase.
>
In fact, it's triggered by ftree-parallelize-loops, because in
gcc/gcc.c we have:
#define GOMP_SELF_SPECS \
"%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
"-pthread}"
> Fixed with
>
> 2017-11-23 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/83089
> * gcc.dg/pr83089.c: Require pthread.
>
Thanks,
Christophe
> Index: gcc/testsuite/gcc.dg/pr83089.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/pr83089.c (revision 255060)
> +++ gcc/testsuite/gcc.dg/pr83089.c (working copy)
> @@ -1,4 +1,5 @@
> /* { dg-do compile } */
> +/* { dg-require-effective-target pthread } */
> /* { dg-options "-O2 -ftree-loop-if-convert -ftree-parallelize-loops=2" } */
>
> int rl, s8;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-23 22:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 8:54 [PATCH] Fix PR83089 Richard Biener
2017-11-22 20:38 ` Christophe Lyon
2017-11-23 8:50 ` Richard Biener
2017-11-23 22:45 ` Christophe Lyon
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).