+2017-02-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69823
+ * graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
+ Properly enumerate all BBs in the region. Use auto_vec/auto_bitmap.
+
2017-02-09 Andrew Burgess <andrew.burgess@embecosm.com>
* config/arc/arc-c.def: Add __NPS400__ definition.
print_sese (dump_file, scop));
gcc_assert (dominated_by_p (CDI_DOMINATORS, exit_bb, entry_bb));
- int depth = bb_dom_dfs_in (CDI_DOMINATORS, exit_bb)
- - bb_dom_dfs_in (CDI_DOMINATORS, entry_bb);
+ auto_vec<basic_block> worklist;
+ auto_bitmap loops;
- gcc_assert (depth > 0);
-
- vec<basic_block> dom
- = get_dominated_to_depth (CDI_DOMINATORS, entry_bb, depth);
- int i;
- basic_block bb;
- bitmap loops = BITMAP_ALLOC (NULL);
- FOR_EACH_VEC_ELT (dom, i, bb)
+ worklist.safe_push (entry_bb);
+ while (! worklist.is_empty ())
{
+ basic_block bb = worklist.pop ();
DEBUG_PRINT (dp << "Visiting bb_" << bb->index << "\n");
- /* We don't want to analyze any bb outside sese. */
- if (!dominated_by_p (CDI_POST_DOMINATORS, bb, exit_bb))
- continue;
-
- /* Basic blocks dominated by the scop->exit are not in the scop. */
- if (bb != exit_bb && dominated_by_p (CDI_DOMINATORS, bb, exit_bb))
- continue;
-
/* The basic block should not be part of an irreducible loop. */
if (bb->flags & BB_IRREDUCIBLE_LOOP)
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
/* Check for unstructured control flow: CFG not generated by structured
if-then-else. */
any loop fully contained in the scop: other bbs are checked below
in loop_is_valid_in_scop. */
if (harmful_stmt_in_bb (scop, bb))
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
}
+ if (bb != exit_bb)
+ for (basic_block dom = first_dom_son (CDI_DOMINATORS, bb);
+ dom;
+ dom = next_dom_son (CDI_DOMINATORS, dom))
+ worklist.safe_push (dom);
}
/* Go through all loops and check that they are still valid in the combined
gcc_assert (loop->num == (int) j);
if (!loop_is_valid_in_scop (loop, scop))
- {
- dom.release ();
- BITMAP_FREE (loops);
- return true;
- }
+ return true;
}
- dom.release ();
- BITMAP_FREE (loops);
return false;
}