This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][commited] PR 21171


Hello,

ivopts may replace a reference to volatile memory with a non-volatile
one, which causes this PR.

The fix is below, bootstrapped & regtested on i686, commited as obvious.

Zdenek

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.8479
diff -c -3 -p -r2.8479 ChangeLog
*** ChangeLog	27 Apr 2005 09:11:07 -0000	2.8479
--- ChangeLog	27 Apr 2005 14:23:21 -0000
***************
*** 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: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.63
diff -c -3 -p -r2.63 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	26 Apr 2005 22:43:53 -0000	2.63
--- tree-ssa-loop-ivopts.c	27 Apr 2005 14:23:21 -0000
*************** find_interesting_uses_address (struct iv
*** 1518,1523 ****
--- 1518,1528 ----
    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
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.5404
diff -c -3 -p -r1.5404 ChangeLog
*** testsuite/ChangeLog	27 Apr 2005 09:11:46 -0000	1.5404
--- testsuite/ChangeLog	27 Apr 2005 14:23:21 -0000
***************
*** 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,
Index: testsuite/gcc.dg/tree-ssa/pr21171.c
===================================================================
RCS file: testsuite/gcc.dg/tree-ssa/pr21171.c
diff -N testsuite/gcc.dg/tree-ssa/pr21171.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/tree-ssa/pr21171.c	27 Apr 2005 14:23:22 -0000
***************
*** 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]