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]

Re: [PATCH] Fix more volatile issues, re-enable forwprop to stmts with volatile ops, fix PR33291, fix dumping


On Mon, 3 Sep 2007, Richard Guenther wrote:

> 
> This patch does a few things related to handling of volatile qualified
> pointers.
> 
>  1) It now prints volatile (and const) qualifiers on pointers to
>     aggregates such as 'volatile struct foo *' and it will now also
>     print multiple qualifiers on pointers, like 'volatile const *'.
> 
>  2) It fixes more of the gimplifiers and fold/fold_stmt helpers to
>     build ARRAY_REF and ADDR_EXPR with the correct canonical type.
>     This makes us retain the cast to volatile in
> 
>        volatile struct foo *p = &a->foo[0];
> 
>     after gimplification (instead of "folding" it into the ARRAY_REF
>     or the ADDR_EXPR type which is wrong).
> 
>  3) Re-enables forward propagation of ADDR_EXPRs into statements that
>     have has_volatile_ops set (all stores have that before we compute
>     aliases).  We now handle all cases correct to retain the volatileness
>     of the memory reference propagated into (fingers crossing, more
>     testcases welcome ;))
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I'll
> apply this after some waiting-for-comments hours.

It needs the following extra testsuite modifications.

        * gcc.dg/pr32721.c: Adjust volatile reference pattern.
        * gcc.dg/tree-ssa/forwprop-1.c: Remove xfail.
        * gcc.dg/tree-ssa/forwprop-2.c: Likewise.

Index: testsuite/gcc.dg/pr32721.c
===================================================================
*** testsuite/gcc.dg/pr32721.c  (revision 128037)
--- testsuite/gcc.dg/pr32721.c  (working copy)
*************** spinlock1 = &spinlock[1];
*** 14,18 ****
   while (*spinlock0);
  }

! /* { dg-final { scan-tree-dump "={v} spinlock.0." "optimized" } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */
--- 14,18 ----
   while (*spinlock0);
  }

! /* { dg-final { scan-tree-dump "={v} \\*spinlock0" "optimized" } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: testsuite/gcc.dg/tree-ssa/forwprop-1.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/forwprop-1.c      (revision 128037)
--- testsuite/gcc.dg/tree-ssa/forwprop-1.c      (working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options "-O2 -fdump-tree-forwprop" }  */
  
  /* We should be able to optimize this to b->t[i] = 1 during
     early optimizations.  */
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-O2 -fdump-tree-forwprop1" }  */ 
  
  /* We should be able to optimize this to b->t[i] = 1 during
     early optimizations.  */
*************** void f(struct a * b, __SIZE_TYPE__ i)
*** 15,22 ****
    c[i] = 1;
  }
  
! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop1" { xfail 
*-*-* } } } */
! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop2" } } */
! /* { dg-final { cleanup-tree-dump "forwprop?" } } */
!
! 
--- 15,19 ----
    c[i] = 1;
  }
  
! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop1" } } */
! /* { dg-final { cleanup-tree-dump "forwprop1" } } */
Index: testsuite/gcc.dg/tree-ssa/forwprop-2.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/forwprop-2.c      (revision 128037)
--- testsuite/gcc.dg/tree-ssa/forwprop-2.c      (working copy)
***************
*** 1,5 **** 
  /* { dg-do compile } */
! /* { dg-options "-O2 -fdump-tree-forwprop" }  */

  /* We should be able to optimize this to b->t[i] = 1 during
     early optimizations.  */
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-O2 -fdump-tree-forwprop1" }  */

  /* We should be able to optimize this to b->t[i] = 1 during
     early optimizations.  */
*************** void f(__SIZE_TYPE__ i)
*** 17,22 ****
    c[i] = 1;
  }

! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop1" { xfail 
*-*-* } } } */
! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop2" } } */
  /* { dg-final { cleanup-tree-dump "forwprop?" } } */
--- 17,21 ----
    c[i] = 1;
  }

! /* { dg-final { scan-tree-dump "t\\\[i.*\\\] = 1;" "forwprop1" } } */
  /* { dg-final { cleanup-tree-dump "forwprop?" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]