OSDN Git Service

PR tree-optimization/21171
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Apr 2005 14:28:11 +0000 (14:28 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Apr 2005 14:28:11 +0000 (14:28 +0000)
* tree-ssa-loop-ivopts.c (find_interesting_uses_address): Do not
record address uses if the reference is volatile.

* gcc.dg/tree-ssa/pr21171.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98828 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr21171.c [new file with mode: 0644]
gcc/tree-ssa-loop-ivopts.c

index 5a99ffa..2a545fd 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-27  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       PR tree-optimization/21171
+       * tree-ssa-loop-ivopts.c (find_interesting_uses_address): Do not
+       record address uses if the reference is volatile.
+
 2004-04-27  Paolo Bonzini  <bonzini@gnu.org>
 
        * tree-complex.c (expand_vector_operation): New, extracted from
index 0f69c32..78ac81a 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-27  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       PR tree-optimization/21171
+       * gcc.dg/tree-ssa/pr21171.c: New test.
+
 2004-04-27  Paolo Bonzini  <bonzini@gnu.org>
 
         * gcc.dg/tree-ssa/gen-vect-11.c, gcc.dg/tree-ssa/gen-vect-11a.c,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21171.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21171.c
new file mode 100644 (file)
index 0000000..a655ed6
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR 21171.  Ivopts should not rewrite references to volatile memory.  */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-vars" } */
+
+typedef        unsigned int u_int32_t;
+typedef        unsigned char u_int8_t;
+
+#define        AIC_VECTORS     32
+
+typedef volatile struct AT91RM9200_regs {
+  u_int32_t    SVR[AIC_VECTORS];
+} AT91RM9200_regs_t;
+
+#define CPUReg  ((AT91RM9200_regs_t*)0xFFF00000)
+
+extern const u_int32_t __IntTable[AIC_VECTORS];
+
+int main()
+{
+  int c;
+
+  for (c = 0; c < AIC_VECTORS; c++)
+    CPUReg->SVR[c] = __IntTable[c];
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "SVR" 1 "vars"} } */
+/* { dg-final { cleanup-tree-dump "vars" } } */
index a62c1cd..f23e8d6 100644 (file)
@@ -1518,6 +1518,11 @@ find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p)
   struct iv *civ;
   struct ifs_ivopts_data ifs_ivopts_data;
 
+  /* Do not play with volatile memory references.  A bit too conservative,
+     perhaps, but safe.  */
+  if (stmt_ann (stmt)->has_volatile_ops)
+    goto fail;
+
   /* Ignore bitfields for now.  Not really something terribly complicated
      to handle.  TODO.  */
   if (TREE_CODE (base) == COMPONENT_REF