aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-01-08 08:04:35 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-01-08 08:04:35 +0000
commit4e98c66c4fa2d8f4cb09d589ad909895eb247880 (patch)
tree52b15ac06bc8fc1943d26f9cc256cdaff92ebbd3 /gcc
parentfd4a56fff2611fa6d840e801d8181bfac061f8e0 (diff)
downloadgcc-4e98c66c4fa2d8f4cb09d589ad909895eb247880.zip
gcc-4e98c66c4fa2d8f4cb09d589ad909895eb247880.tar.gz
gcc-4e98c66c4fa2d8f4cb09d589ad909895eb247880.tar.bz2
re PR tree-optimization/42221 (ICE from '-Os -fgraphite-identity')
Fix PR42221. 2009-12-23 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42221 * sese.c (expand_scalar_variables_expr): Follow the SSA links into the array indexing of ADDR_EXPRs. * testsuite/gcc.dg/graphite/pr42221.c: New. From-SVN: r155731
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.graphite8
-rw-r--r--gcc/sese.c15
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr42221.c24
3 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 165f7eb..b093edd 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,13 @@
2010-01-07 Sebastian Pop <sebastian.pop@amd.com>
+ PR middle-end/42221
+ * sese.c (expand_scalar_variables_expr): Follow the SSA links into
+ the array indexing of ADDR_EXPRs.
+
+ * testsuite/gcc.dg/graphite/pr42221.c: New.
+
+2010-01-07 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/42521
* graphite.c (graphite_finalize): Call scev_reset.
(graphite_transform_loops): Do not call scev_reset between the code
diff --git a/gcc/sese.c b/gcc/sese.c
index e59fdf6..4950c08 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -874,7 +874,20 @@ expand_scalar_variables_expr (tree type, tree op0, enum tree_code code,
return expand_scalar_variables_ssa_name (op0, bb, region, map, gsi);
if (code == ADDR_EXPR)
- return op0;
+ {
+ tree op00 = TREE_OPERAND (op0, 0);
+
+ if (handled_component_p (op00)
+ && TREE_CODE (op00) == ARRAY_REF)
+ {
+ tree e = expand_scalar_variables_expr (TREE_TYPE (op00), op00,
+ TREE_CODE (op00),
+ NULL, bb, region, map, gsi);
+ return fold_build1 (code, TREE_TYPE (op0), e);
+ }
+
+ return op0;
+ }
gcc_unreachable ();
return NULL;
diff --git a/gcc/testsuite/gcc.dg/graphite/pr42221.c b/gcc/testsuite/gcc.dg/graphite/pr42221.c
new file mode 100644
index 0000000..da8daa1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr42221.c
@@ -0,0 +1,24 @@
+/* { dg-options "-Os -fgraphite-identity" } */
+
+static void b2w(unsigned int *out, const unsigned char *in, unsigned int len)
+{
+ const unsigned char *bpend = in + len;
+ for (; in != bpend; in += 4, ++out)
+ {
+ *out = (unsigned int) (in[0] ) |
+ (unsigned int) (in[3] << 24);
+ }
+}
+static void md4step(unsigned int state[4], const unsigned char *data)
+{
+ unsigned int A, X[16];
+ b2w(X, data, 64);
+ state[0] += A;
+}
+void md4sum(void)
+{
+ unsigned char final[128];
+ unsigned int state[4];
+ md4step(state, final);
+ md4step(state, final + 64);
+}