re PR tree-optimization/49093 (ICE in vect_enhance_data_refs_alignment() with volatil...
authorIra Rosen <ira.rosen@linaro.org>
Tue, 31 May 2011 12:31:04 +0000 (12:31 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Tue, 31 May 2011 12:31:04 +0000 (12:31 +0000)
        PR tree-optimization/49093
        * tree-vect-data-refs.c (vect_analyze_data_refs): Fail for
        volatile data references.

From-SVN: r174477

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr49093.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index e29a763cb0d087b5e636861e27e10eda8e96ccd6..4270d2da80c5955e1db60dec29b3ce8c062f9aca 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-31  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/49093
+       * tree-vect-data-refs.c (vect_analyze_data_refs): Fail for volatile
+       data references.
+
 2011-05-31  Dodji Seketeli  <dodji@redhat.com>
 
        PR debug/49047
index dfa323b06abaaba6a0d20cc2671227b8a28752e4..612fc174b86f242c75a6b4ec5319d47fb5c6e6fb 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-31  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/49093
+       * gcc.dg/vect/pr49093.c: New test.
+
 2011-05-31  Dodji Seketeli  <dodji@redhat.com>
 
        PR debug/49047
diff --git a/gcc/testsuite/gcc.dg/vect/pr49093.c b/gcc/testsuite/gcc.dg/vect/pr49093.c
new file mode 100644 (file)
index 0000000..b8bded6
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize -fdump-tree-vect-details -fno-tree-fre" } */
+
+volatile unsigned char g_324[4] = {0, 1, 0, 1};
+void foo (int);
+int x, y;
+void func_81(void)
+{
+    int l_466, l_439[7] = {0}, g_97;
+lbl_473:
+    if (x) {
+        for (g_97 = 0; (g_97 < 4); ++g_97) {
+            if (y)
+              goto lbl_473;
+            g_324[g_97];
+            l_466 = l_439[g_97];
+        }
+        foo(l_466);
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index ee059977559f17b4a0c36d4921048ecd76923bcc..5023710f1e583bde3c151d7feb5ef18a704e9218 100644 (file)
@@ -2584,6 +2584,16 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
             return false;
         }
 
+      if (TREE_THIS_VOLATILE (DR_REF (dr)))
+        {
+          if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+            {
+              fprintf (vect_dump, "not vectorized: volatile type ");
+              print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+            }
+          return false;
+        }
+
       base = unshare_expr (DR_BASE_ADDRESS (dr));
       offset = unshare_expr (DR_OFFSET (dr));
       init = unshare_expr (DR_INIT (dr));