From 46bd784bfb29e94841b7d2702277d77445a7a47f Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 3 Dec 2015 08:40:08 -0700 Subject: [PATCH] [PR tree-optimization/68599] Avoid over-zealous optimization with -funsafe-loop-optimizations 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 | 9 +++++++++ gcc/loop-init.c | 2 +- gcc/loop-iv.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f764ba938f0..5fe3c1c0da6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-12-03 Jeff Law + + 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 * doc/md.texi (vec_load_lanes@var{m}@var{n}): Document that diff --git a/gcc/loop-init.c b/gcc/loop-init.c index e32c94ab1c0..120316d6562 100644 --- a/gcc/loop-init.c +++ b/gcc/loop-init.c @@ -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; } diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index c7d51643e92..dfa3ca38204 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -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; -- 2.30.2