[PR tree-optimization/68599] Avoid over-zealous optimization with -funsafe-loop-optim...
authorJeff Law <law@redhat.com>
Thu, 3 Dec 2015 15:40:08 +0000 (08:40 -0700)
committerJeff Law <law@gcc.gnu.org>
Thu, 3 Dec 2015 15:40:08 +0000 (08:40 -0700)
PR tree-optimization/68599
* loop-init.c (rtl_loop_init): Set LOOPS_HAVE_RECORDED_EXITS
in call to loop_optimizer_init.
* loop-iv.c (get_simple_loop_desc): Only allow unsafe loop
optimization to drop the assumptions/infinite notations if
the loop has a single exit.

From-SVN: r231231

gcc/ChangeLog
gcc/loop-init.c
gcc/loop-iv.c

index f764ba938f09b5d6a06ccb3bbb887bd34c90f04f..5fe3c1c0da64450a5319ad1ae82cf4a35a22ad16 100644 (file)
@@ -1,3 +1,12 @@
+2015-12-03  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/68599
+       * loop-init.c (rtl_loop_init): Set LOOPS_HAVE_RECORDED_EXITS
+       in call to loop_optimizer_init.
+       * loop-iv.c (get_simple_loop_desc): Only allow unsafe loop
+       optimization to drop the assumptions/infinite notations if
+       the loop has a single exit.
+
 2015-12-03  Richard Sandiford  <richard.sandiford@arm.com>
 
        * doc/md.texi (vec_load_lanes@var{m}@var{n}): Document that
index e32c94ab1c061ff49f766c4cb7a53eed17ce048b..120316d65625c691ec846fc9655cb19a82ef3cb6 100644 (file)
@@ -395,7 +395,7 @@ rtl_loop_init (void)
       dump_flow_info (dump_file, dump_flags);
     }
 
-  loop_optimizer_init (LOOPS_NORMAL);
+  loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS);
   return 0;
 }
 
index c7d51643e92262b78f3810d986e72546faecd0e3..dfa3ca382043bc7c089399cc40ab6cc052a1800e 100644 (file)
@@ -3054,7 +3054,7 @@ get_simple_loop_desc (struct loop *loop)
            }
        }
 
-      if (flag_unsafe_loop_optimizations)
+      if (flag_unsafe_loop_optimizations && single_exit (loop))
        {
          desc->assumptions = NULL_RTX;
          desc->infinite = NULL_RTX;