This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Merge to trunk from Graphite branch
- From: Sebastian Pop <sebpop at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, gcc-graphite <gcc-graphite at googlegroups dot com>
- Date: Tue, 23 Feb 2010 07:03:01 -0600
- Subject: [patch] Merge to trunk from Graphite branch
Hi,
I committed to trunk the attached patches to fix 4 PRs.
These patches passed regstrap and the SPEC 2006 benchmark tests.
Sebastian
From 986be805e7cad0595bd395db50681db55bfd497f Mon Sep 17 00:00:00 2001
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Feb 2010 13:10:49 +0000
Subject: [PATCH 1/7] Fix PR43026: handle COMPONENT_REFs in expand scalar expressions.
2010-02-11 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43026
* sese.c (expand_scalar_variables_expr): Handle COMPONENT_REF.
* g++.dg/graphite/pr43026.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@156956 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.graphite | 7 ++++
gcc/sese.c | 3 ++
gcc/testsuite/g++.dg/graphite/pr43026.C | 51 +++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 0 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/graphite/pr43026.C
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 4bb6dc2..cb969c5 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,12 @@
2010-02-11 Sebastian Pop <sebastian.pop@amd.com>
+ PR middle-end/43026
+ * sese.c (expand_scalar_variables_expr): Handle COMPONENT_REF.
+
+ * g++.dg/graphite/pr43026.C: New.
+
+2010-02-11 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/43012
* gcc.dg/graphite/pr43012.c: New.
diff --git a/gcc/sese.c b/gcc/sese.c
index 6fb4065..ebf9154 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -897,6 +897,9 @@ expand_scalar_variables_expr (tree type, tree op0, enum tree_code code,
return build4 (ARRAY_REF, type, base, subscript, op02, op03);
}
+ case COMPONENT_REF:
+ return op0;
+
default:
/* The above cases should catch everything. */
gcc_unreachable ();
diff --git a/gcc/testsuite/g++.dg/graphite/pr43026.C b/gcc/testsuite/g++.dg/graphite/pr43026.C
new file mode 100644
index 0000000..0e33f10
--- /dev/null
+++ b/gcc/testsuite/g++.dg/graphite/pr43026.C
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fgraphite-identity -m32" } */
+
+template<typename Tp > class vector { };
+
+template <int rank, int dim> class Tensor;
+
+template <int dim> class Tensor<1,dim> {
+public:
+ Tensor (const Tensor<1,dim> &);
+private:
+ double values[(dim != 0) ? (dim) : 1];
+};
+
+template <int dim>
+#ifdef NOINLINE
+// declaring this noinline prevents the ICE
+__attribute__ ((noinline))
+#endif
+Tensor<1,dim>::Tensor (const Tensor<1,dim> &p)
+{
+ for (unsigned int i = 0; i < dim; ++i)
+ values[i] = p.values[i];
+}
+
+template <int rank, int dim>
+class Tensor {
+ Tensor<rank-1,dim> subtensor[dim];
+};
+
+template <int dim> class Base {
+public:
+ const unsigned int npoints;
+ const unsigned int dofs;
+ const Tensor<2,dim> &s2d (const unsigned int fno,
+ const unsigned int pno) const;
+ void getf2d (vector<Tensor<2,dim> >& d2) const;
+};
+
+template <int dim>
+void Base<dim>:: getf2d
+ (vector<Tensor<2,dim> > &d2) const
+{
+ unsigned int point, sf;
+
+ for (point = 0; point < npoints; ++point)
+ for (sf = 0; sf < dofs; ++sf)
+ Tensor<2,dim> tmp = s2d (sf, point);
+}
+
+template void Base<3>::getf2d (vector<Tensor<2,3> > &) const;
--
1.6.3.3
From be0c4357df7018479c04999b2f69a14858c2ba44 Mon Sep 17 00:00:00 2001
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Feb 2010 14:55:08 +0000
Subject: [PATCH 2/7] Fix PR43140: Add -Wno-conversion-null to pr41305.C.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR middle-end/43140
* g++.dg/graphite/pr41305.C: Add -Wno-conversion-null.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@156963 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.graphite | 8 +++++++-
gcc/testsuite/g++.dg/graphite/pr41305.C | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index cb969c5..56b4694 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,4 +1,10 @@
-2010-02-11 Sebastian Pop <sebastian.pop@amd.com>
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+ Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
+
+ PR middle-end/43140
+ * g++.dg/graphite/pr41305.C: Add -Wno-conversion-null.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43026
* sese.c (expand_scalar_variables_expr): Handle COMPONENT_REF.
diff --git a/gcc/testsuite/g++.dg/graphite/pr41305.C b/gcc/testsuite/g++.dg/graphite/pr41305.C
index f558e7c..6a30b0e 100644
--- a/gcc/testsuite/g++.dg/graphite/pr41305.C
+++ b/gcc/testsuite/g++.dg/graphite/pr41305.C
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-options "-O3 -floop-interchange" }
+// { dg-options "-O3 -floop-interchange -Wno-conversion-null" }
void __throw_bad_alloc ();
--
1.6.3.3
From 0b9a70f792614cfeb710b442663c04bc6f4b5521 Mon Sep 17 00:00:00 2001
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Feb 2010 15:13:39 +0000
Subject: [PATCH 3/7] Fix PR43097: rename only SSA_NAMEs.
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43140
* sese.c (get_rename): Assert that old_name is an SSA_NAME.
(rename_variables_in_stmt): Continue when the use is not an SSA_NAME.
* gfortran.dg/graphite/pr43097.f: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@156964 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.graphite | 8 ++++++++
gcc/sese.c | 12 +++++++++---
gcc/testsuite/gfortran.dg/graphite/pr43097.f | 25 +++++++++++++++++++++++++
3 files changed, 42 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gfortran.dg/graphite/pr43097.f
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 56b4694..aae16e7 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,4 +1,12 @@
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43140
+ * sese.c (get_rename): Assert that old_name is an SSA_NAME.
+ (rename_variables_in_stmt): Continue when the use is not an SSA_NAME.
+
+ * gfortran.dg/graphite/pr43097.f: New.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR middle-end/43140
diff --git a/gcc/sese.c b/gcc/sese.c
index ebf9154..d7a9faa 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -494,6 +494,7 @@ get_rename (htab_t map, tree old_name)
struct rename_map_elt_s tmp;
PTR *slot;
+ gcc_assert (TREE_CODE (old_name) == SSA_NAME);
tmp.old_name = old_name;
slot = htab_find_slot (map, &tmp, NO_INSERT);
@@ -658,14 +659,19 @@ rename_variables_in_stmt (gimple stmt, htab_t map, gimple_stmt_iterator *insert_
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
{
tree use = USE_FROM_PTR (use_p);
- tree expr = get_rename (map, use);
- tree type_use = TREE_TYPE (use);
- tree type_expr = TREE_TYPE (expr);
+ tree expr, type_use, type_expr;
gimple_seq stmts;
+ if (TREE_CODE (use) != SSA_NAME)
+ continue;
+
+ expr = get_rename (map, use);
if (use == expr)
continue;
+ type_use = TREE_TYPE (use);
+ type_expr = TREE_TYPE (expr);
+
if (type_use != type_expr
|| (TREE_CODE (expr) != SSA_NAME
&& is_gimple_reg (use)))
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr43097.f b/gcc/testsuite/gfortran.dg/graphite/pr43097.f
new file mode 100644
index 0000000..4ddeed8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/pr43097.f
@@ -0,0 +1,25 @@
+! { dg-options "-O2 -fgraphite-identity" }
+
+ subroutine foo (ldmx,ldmy,nx,ny,v)
+ implicit real*8 (a-h, o-z)
+ dimension v(5,ldmx,ldmy,*)
+ dimension tmat(5,5)
+
+ k = 2
+ do j = 2, ny-1
+ do i = 2, nx-1
+ do ip = 1, 4
+ do m = ip+1, 5
+ v(m,i,j,k) = v(m,i,j,k) * m
+ end do
+ end do
+ do m = 5, 1, -1
+ do l = m+1, 5
+ v(m,i,j,k) = v(l,i,j,k)
+ end do
+ v(m,i,j,k) = m
+ end do
+ end do
+ end do
+ return
+ end
--
1.6.3.3
From 08cc5dfadeb3c8461ff132c36ef9297f7c8679be Mon Sep 17 00:00:00 2001
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Feb 2010 15:17:38 +0000
Subject: [PATCH 4/7] Fix PR number in the changelog entry.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@156965 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.graphite | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index aae16e7..b3a820e 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,6 +1,6 @@
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
- PR middle-end/43140
+ PR middle-end/43097
* sese.c (get_rename): Assert that old_name is an SSA_NAME.
(rename_variables_in_stmt): Continue when the use is not an SSA_NAME.
--
1.6.3.3
From 9e199674aa67ed17bf84cb68512709d7b50a3c16 Mon Sep 17 00:00:00 2001
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 22 Feb 2010 17:40:23 +0000
Subject: [PATCH 5/7] Fix PR43083: Do not handle regions ending with multiple edges on the exit BB.
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43083
* graphite-scop-detection.c (create_single_exit_edge): Move
the call to find_single_exit_edge to....
(create_sese_edges): ...here. Don't handle multiple edges
exiting the function.
(build_graphite_scops): Don't handle multiple edges
exiting the function.
* gcc.dg/graphite/pr43083.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@156970 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.graphite | 12 ++++++++++++
gcc/graphite-scop-detection.c | 17 +++++++++++------
gcc/testsuite/gcc.dg/graphite/pr43083.c | 14 ++++++++++++++
3 files changed, 37 insertions(+), 6 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/graphite/pr43083.c
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b3a820e..f1e9005 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,17 @@
2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+ PR middle-end/43083
+ * graphite-scop-detection.c (create_single_exit_edge): Move
+ the call to find_single_exit_edge to....
+ (create_sese_edges): ...here. Don't handle multiple edges
+ exiting the function.
+ (build_graphite_scops): Don't handle multiple edges
+ exiting the function.
+
+ * gcc.dg/graphite/pr43083.c: New.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/43097
* sese.c (get_rename): Assert that old_name is an SSA_NAME.
(rename_variables_in_stmt): Continue when the use is not an SSA_NAME.
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index d89f0f8..5c1dbbd 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -935,9 +935,6 @@ create_single_exit_edge (sd_region *region)
edge forwarder = NULL;
basic_block exit;
- if (find_single_exit_edge (region))
- return;
-
/* We create a forwarder bb (5) for all edges leaving this region
(3->5, 4->5). All other edges leading to the same bb, are moved
to a new bb (6). If these edges where part of another region (2->5)
@@ -1031,7 +1028,10 @@ create_sese_edges (VEC (sd_region, heap) *regions)
mark_exit_edges (regions);
for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
- create_single_exit_edge (s);
+ /* Don't handle multiple edges exiting the function. */
+ if (!find_single_exit_edge (s)
+ && s->exit != EXIT_BLOCK_PTR)
+ create_single_exit_edge (s);
unmark_exit_edges (regions);
@@ -1057,7 +1057,12 @@ build_graphite_scops (VEC (sd_region, heap) *regions,
{
edge entry = find_single_entry_edge (s);
edge exit = find_single_exit_edge (s);
- scop_p scop = new_scop (new_sese (entry, exit));
+ scop_p scop;
+
+ if (!exit)
+ continue;
+
+ scop = new_scop (new_sese (entry, exit));
VEC_safe_push (scop_p, heap, *scops, scop);
/* Are there overlapping SCoPs? */
@@ -1323,7 +1328,7 @@ build_scops (VEC (scop_p, heap) **scops)
canonicalize_loop_closed_ssa_form ();
build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father,
- ®ions, loop);
+ ®ions, loop);
create_sese_edges (regions);
build_graphite_scops (regions, scops);
diff --git a/gcc/testsuite/gcc.dg/graphite/pr43083.c b/gcc/testsuite/gcc.dg/graphite/pr43083.c
new file mode 100644
index 0000000..afb97af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr43083.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O3 -fgraphite-identity" } */
+
+extern void baz(void);
+
+static inline int bar(void)
+{
+ int i;
+ for (i = 0; i < 10; i++) baz();
+}
+
+int foo(void)
+{
+ if (bar() != 0) return 0;
+}
--
1.6.3.3
From a886129a62af29ceb93581a2a2a17a52f5a5d195 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Tue, 23 Feb 2010 06:49:39 -0600
Subject: [PATCH 6/7] Add missing changelog entry.
---
gcc/ChangeLog.graphite | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index f1e9005..1771284 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -31,6 +31,10 @@
* g++.dg/graphite/pr43026.C: New.
+2010-02-13 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Merge from mainline (154736:156693).
+
2010-02-11 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43012
--
1.6.3.3
From 347eebde254ee70a90487c0a6017243049fa83e6 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Tue, 23 Feb 2010 06:57:24 -0600
Subject: [PATCH 7/7] Add ChangeLog entries.
---
gcc/ChangeLog | 21 +++++++++++++++++++++
gcc/testsuite/ChangeLog | 21 +++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 195d69c..d500d8e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,24 @@
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43083
+ * graphite-scop-detection.c (create_single_exit_edge): Move
+ the call to find_single_exit_edge to....
+ (create_sese_edges): ...here. Don't handle multiple edges
+ exiting the function.
+ (build_graphite_scops): Don't handle multiple edges
+ exiting the function.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43097
+ * sese.c (get_rename): Assert that old_name is an SSA_NAME.
+ (rename_variables_in_stmt): Continue when the use is not an SSA_NAME.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43026
+ * sese.c (expand_scalar_variables_expr): Handle COMPONENT_REF.
+
2010-02-22 Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR c++/43126
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7ca5442..d8bcce5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,24 @@
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43083
+ * gcc.dg/graphite/pr43083.c: New.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43097
+ * gfortran.dg/graphite/pr43097.f: New.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+ Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
+
+ PR middle-end/43140
+ * g++.dg/graphite/pr41305.C: Add -Wno-conversion-null.
+
+2010-02-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43026
+ * g++.dg/graphite/pr43026.C: New.
+
2010-02-22 Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR c++/43126
--
1.6.3.3