* [PATCH, PR70045] Unshare create_empty_if_region_on_edge argument
@ 2016-03-11 15:14 Tom de Vries
[not found] ` <CAFk3UF-5xD9=NOb7Dr09WJN_f_0Zdtk=QX00vBQyizP2Xczhdw@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2016-03-11 15:14 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches, Sebastian Pop
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hi,
this patch fixes PR70045, a graphite 6 regression.
The problem is as follows: in graphite_create_new_loop_guard, a
condition cond_expr is constructed using an upper bound expression *ub.
During the call:
...
exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
...
the cond_expr is modified in place, which has as side-effect that *ub is
modified.
The patch fixes this by unsharing the cond_expr before passing it as
argument to create_empty_if_region_on_edge.
Bootstrapped and reg-tested on x86_64.
OK for stage4 trunk?
Thanks,
- Tom
[-- Attachment #2: 0001-Unshare-create_empty_if_region_on_edge-argument.patch --]
[-- Type: text/x-patch, Size: 1584 bytes --]
Unshare create_empty_if_region_on_edge argument
2016-03-11 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/70045
* graphite-isl-ast-to-gimple.c (graphite_create_new_loop_guard): Unshare
create_empty_if_region_on_edge argument.
* gcc.dg/graphite/pr70045.c: New test.
---
gcc/graphite-isl-ast-to-gimple.c | 3 ++-
gcc/testsuite/gcc.dg/graphite/pr70045.c | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index 89a4118..8dd5dc8 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -821,7 +821,8 @@ graphite_create_new_loop_guard (edge entry_edge,
if (integer_onep (cond_expr))
exit_edge = entry_edge;
else
- exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
+ exit_edge = create_empty_if_region_on_edge (entry_edge,
+ unshare_expr (cond_expr));
return exit_edge;
}
diff --git a/gcc/testsuite/gcc.dg/graphite/pr70045.c b/gcc/testsuite/gcc.dg/graphite/pr70045.c
new file mode 100644
index 0000000..9f98b1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr70045.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-interchange" } */
+
+int a, b, d, e, f;
+int c[9];
+void
+fn1 ()
+{
+ e = 1;
+ for (; e >= 0; e--)
+ {
+ d = 1;
+ for (; d >= 0; d--)
+ {
+ f = 0;
+ for (; f <= 1; f++)
+ {
+ a = 0;
+ for (; a < 9; a++)
+ {
+ b = 0;
+ for (; b < 2; b++)
+ c[a + b] = 3;
+ }
+ }
+ }
+ }
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH, PR70045] Unshare create_empty_if_region_on_edge argument
[not found] ` <CAFk3UF-5xD9=NOb7Dr09WJN_f_0Zdtk=QX00vBQyizP2Xczhdw@mail.gmail.com>
@ 2016-03-14 8:57 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-03-14 8:57 UTC (permalink / raw)
To: Sebastian Pop; +Cc: Tom de Vries, gcc-patches
On Fri, 11 Mar 2016, Sebastian Pop wrote:
> On Fri, Mar 11, 2016 at 9:14 AM, Tom de Vries <Tom_deVries@mentor.com>
> wrote:
>
> > Hi,
> >
> > this patch fixes PR70045, a graphite 6 regression.
> >
> > The problem is as follows: in graphite_create_new_loop_guard, a condition
> > cond_expr is constructed using an upper bound expression *ub.
> >
> > During the call:
> > ...
> > exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
> > ...
> > the cond_expr is modified in place, which has as side-effect that *ub is
> > modified.
> >
> > The patch fixes this by unsharing the cond_expr before passing it as
> > argument to create_empty_if_region_on_edge.
> >
> > Bootstrapped and reg-tested on x86_64.
> >
> > OK for stage4 trunk?
> >
> >
> Thanks Tom, the patch looks good to me.
> I will let Richi decide whether it is still appropriate to commit the
> change to trunk.
As it is a regression it's fine.
Richard.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-14 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 15:14 [PATCH, PR70045] Unshare create_empty_if_region_on_edge argument Tom de Vries
[not found] ` <CAFk3UF-5xD9=NOb7Dr09WJN_f_0Zdtk=QX00vBQyizP2Xczhdw@mail.gmail.com>
2016-03-14 8:57 ` 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).