aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-07-25 13:24:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-07-25 13:24:51 +0000
commit1aa54f90e68dc927e80e14c7e4bf9b42525e3c76 (patch)
tree2b8bb2985d182e0067a33a9d5b70c12080b8464d
parente294f495894cd2d9e217565e340284b2edda4671 (diff)
downloadgcc-1aa54f90e68dc927e80e14c7e4bf9b42525e3c76.zip
gcc-1aa54f90e68dc927e80e14c7e4bf9b42525e3c76.tar.gz
gcc-1aa54f90e68dc927e80e14c7e4bf9b42525e3c76.tar.bz2
re PR tree-optimization/81455 (Compile-time hog w/ -O1 -funswitch-loops)
2017-07-25 Richard Biener <rguenther@suse.de> PR tree-optimization/81455 * tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to not walk in cycles when looking for guards. * gcc.dg/pr81455.c: New testcase. From-SVN: r250518
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr81455.c15
-rw-r--r--gcc/tree-ssa-loop-unswitch.c11
4 files changed, 34 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cc4bcdd..4597d3b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2017-07-25 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/81455
+ * tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to
+ not walk in cycles when looking for guards.
+
+2017-07-25 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/81529
* tree-vect-stmts.c (process_use): Disregard live induction PHIs
when optimizing backedge uses.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e28a732..0aee7d9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2017-07-25 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/81455
+ * gcc.dg/pr81455.c: New testcase.
+
+2017-07-25 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/81529
* gfortran.dg/pr81529.f90: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr81455.c b/gcc/testsuite/gcc.dg/pr81455.c
new file mode 100644
index 0000000..8ab8863
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81455.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -funswitch-loops" } */
+
+void
+jh (unsigned int aw, int sn)
+{
+ int xs;
+
+ for (xs = 0; xs < 1; ++xs)
+ aw &= 1;
+
+ while (aw < 1 || ++sn < 1)
+ {
+ }
+}
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 204cd0d..57aba4f 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -582,8 +582,9 @@ find_loop_guard (struct loop *loop)
gcond *cond;
do
{
+ basic_block next = NULL;
if (single_succ_p (header))
- header = single_succ (header);
+ next = single_succ (header);
else
{
cond = dyn_cast <gcond *> (last_stmt (header));
@@ -593,12 +594,16 @@ find_loop_guard (struct loop *loop)
/* Make sure to skip earlier hoisted guards that are left
in place as if (true). */
if (gimple_cond_true_p (cond))
- header = te->dest;
+ next = te->dest;
else if (gimple_cond_false_p (cond))
- header = fe->dest;
+ next = fe->dest;
else
break;
}
+ /* Never traverse a backedge. */
+ if (header->loop_father->header == next)
+ return NULL;
+ header = next;
}
while (1);
if (!flow_bb_inside_loop_p (loop, te->dest)