The following fixes PR57318 where we estimate volatile loads to
be eliminated.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Ok for the branch?

Thanks,
Richard.

2013-05-21  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/57318
        * tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Do not
        estimate stmts with side-effects as likely eliminated.

Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
*** gcc/tree-ssa-loop-ivcanon.c (revision 199137)
--- gcc/tree-ssa-loop-ivcanon.c (working copy)
*************** tree_estimate_loop_size (struct loop *lo
*** 257,264 ****
  
          /* Look for reasons why we might optimize this stmt away. */
  
          /* Exit conditional.  */
!         if (exit && body[i] == exit->src
                   && stmt == last_stmt (exit->src))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))
--- 257,266 ----
  
          /* Look for reasons why we might optimize this stmt away. */
  
+         if (gimple_has_side_effects (stmt))
+           ;
          /* Exit conditional.  */
!         else if (exit && body[i] == exit->src
                   && stmt == last_stmt (exit->src))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))

Reply via email to