+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
+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
--- /dev/null
+/* { 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)
+ {
+ }
+}
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));
/* 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)