I am testing the following patch to fix a regression that we no longer
remove some empty loops.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2016-01-19  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/69547
        * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1):
        Do not mark clobbers necessary.
        (mark_all_reaching_defs_necessary_1): Likewise.

        * g++.dg/tree-ssa/pr69547.C: New testcase.

Index: gcc/tree-ssa-dce.c
===================================================================
*** gcc/tree-ssa-dce.c  (revision 232928)
--- gcc/tree-ssa-dce.c  (working copy)
*************** mark_aliased_reaching_defs_necessary_1 (
*** 462,468 ****
    gimple *def_stmt = SSA_NAME_DEF_STMT (vdef);
  
    /* All stmts we visit are necessary.  */
!   mark_operand_necessary (vdef);
  
    /* If the stmt lhs kills ref, then we can stop walking.  */
    if (gimple_has_lhs (def_stmt)
--- 462,469 ----
    gimple *def_stmt = SSA_NAME_DEF_STMT (vdef);
  
    /* All stmts we visit are necessary.  */
!   if (! gimple_clobber_p (def_stmt))
!     mark_operand_necessary (vdef);
  
    /* If the stmt lhs kills ref, then we can stop walking.  */
    if (gimple_has_lhs (def_stmt)
*************** mark_all_reaching_defs_necessary_1 (ao_r
*** 584,590 ****
          }
      }
  
!   mark_operand_necessary (vdef);
  
    return false;
  }
--- 585,592 ----
          }
      }
  
!   if (! gimple_clobber_p (def_stmt))
!     mark_operand_necessary (vdef);
  
    return false;
  }
Index: gcc/testsuite/g++.dg/tree-ssa/pr69547.C
===================================================================
*** gcc/testsuite/g++.dg/tree-ssa/pr69547.C     (revision 0)
--- gcc/testsuite/g++.dg/tree-ssa/pr69547.C     (working copy)
***************
*** 0 ****
--- 1,15 ----
+ // { dg-do compile }
+ // { dg-options "-O2 -fdump-tree-cddce1" }
+ 
+ struct A { A () { } };
+ 
+ void foo (void*, int);
+ 
+ void bar ()
+ {
+   enum { N = 64 };
+   A a [N];
+   foo (&a, N);
+ }
+ 
+ // { dg-final { scan-tree-dump-not "if" "cddce1" } }

Reply via email to