summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-23 12:59:17 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-23 12:59:17 +0000
commit27f9c4ff34ea46e85db077ef795b36d5afd93c96 (patch)
tree9fb8f64603818b3925ac8f939c7c8bf463bb6431
parentc3eecfcf5dec120f81398d85a545f5a967a5e31a (diff)
downloadgcc-27f9c4ff34ea46e85db077ef795b36d5afd93c96.tar.gz
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/trunk@156995 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.graphite8
-rw-r--r--gcc/sese.c12
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr43097.f25
3 files changed, 42 insertions, 3 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 56b46942ffa..aae16e7fc22 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 ebf915494b3..d7a9faa1ad8 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 00000000000..4ddeed8ae7d
--- /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