* graphite-scop-detection.c (record_loop_in_sese): New.
(gather_bbs::before_dom_children): Call record_loop_in_sese.
(build_scops): Remove call to build_sese_loop_nests.
* sese.c (sese_record_loop): Remove.
(build_sese_loop_nests): Remove.
(new_sese_info): Remove region->loops.
(free_sese_info): Same.
* sese.h (sese_contains_loop): Same.
(build_sese_loop_nests): Remove.
(sese_contains_loop): Remove.
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r232654
+2016-01-21 Aditya Kumar <aditya.k7@samsung.com>
+ Sebastian Pop <s.pop@samsung.com>
+
+ * graphite-scop-detection.c (record_loop_in_sese): New.
+ (gather_bbs::before_dom_children): Call record_loop_in_sese.
+ (build_scops): Remove call to build_sese_loop_nests.
+ * sese.c (sese_record_loop): Remove.
+ (build_sese_loop_nests): Remove.
+ (new_sese_info): Remove region->loops.
+ (free_sese_info): Same.
+ * sese.h (sese_contains_loop): Same.
+ (build_sese_loop_nests): Remove.
+ (sese_contains_loop): Remove.
+
2016-01-21 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
{
}
+/* Record in execution order the loops fully contained in the region. */
+
+static void
+record_loop_in_sese (basic_block bb, sese_info_p region)
+{
+ loop_p father = bb->loop_father;
+ if (loop_in_sese_p (father, region->region))
+ {
+ bool found = false;
+ loop_p loop0;
+ int j;
+ FOR_EACH_VEC_ELT (region->loop_nest, j, loop0)
+ if (father == loop0)
+ {
+ found = true;
+ break;
+ }
+ if (!found)
+ region->loop_nest.safe_push (father);
+ }
+}
+
/* Call-back for dom_walk executed before visiting the dominated
blocks. */
edge
gather_bbs::before_dom_children (basic_block bb)
{
- if (!bb_in_sese_p (bb, scop->scop_info->region))
+ sese_info_p region = scop->scop_info;
+ if (!bb_in_sese_p (bb, region->region))
return NULL;
+ record_loop_in_sese (bb, region);
+
gcond *stmt = single_pred_cond_non_loop_exit (bb);
if (stmt)
continue;
}
- build_sese_loop_nests (scop->scop_info);
-
find_scop_parameters (scop);
graphite_dim_t max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS);
#include "sese.h"
#include "tree-ssa-propagate.h"
-/* Record LOOP as occurring in REGION. */
-
-static void
-sese_record_loop (sese_info_p region, loop_p loop)
-{
- if (sese_contains_loop (region, loop))
- return;
-
- bitmap_set_bit (region->loops, loop->num);
- region->loop_nest.safe_push (loop);
-}
-
-/* Build the loop nests contained in REGION. Returns true when the
- operation was successful. */
-
-void
-build_sese_loop_nests (sese_info_p region)
-{
- unsigned i;
- basic_block bb;
- struct loop *loop0, *loop1;
-
- FOR_EACH_BB_FN (bb, cfun)
- if (bb_in_sese_p (bb, region->region))
- {
- struct loop *loop = bb->loop_father;
-
- /* Only add loops if they are completely contained in the SCoP. */
- if (loop->header == bb
- && bb_in_sese_p (loop->latch, region->region))
- sese_record_loop (region, loop);
- }
-
- /* Make sure that the loops in the SESE_LOOP_NEST are ordered. It
- can be the case that an inner loop is inserted before an outer
- loop. To avoid this, semi-sort once. */
- FOR_EACH_VEC_ELT (region->loop_nest, i, loop0)
- {
- if (region->loop_nest.length () == i + 1)
- break;
-
- loop1 = region->loop_nest[i + 1];
- if (loop0->num > loop1->num)
- {
- region->loop_nest[i] = loop1;
- region->loop_nest[i + 1] = loop0;
- }
- }
-}
-
/* For a USE in BB, if BB is outside REGION, mark the USE in the
LIVEOUTS set. */
region->region.entry = entry;
region->region.exit = exit;
- region->loops = BITMAP_ALLOC (NULL);
region->loop_nest.create (3);
region->params.create (3);
region->rename_map = new rename_map_t;
void
free_sese_info (sese_info_p region)
{
- if (region->loops)
- region->loops = BITMAP_ALLOC (NULL);
-
region->params.release ();
region->loop_nest.release ();
rename_map_t *rename_map;
/* Loops completely contained in this SESE. */
- bitmap loops;
vec<loop_p> loop_nest;
/* Basic blocks contained in this SESE. */
extern sese_info_p new_sese_info (edge, edge);
extern void free_sese_info (sese_info_p);
extern void sese_insert_phis_for_liveouts (sese_info_p, basic_block, edge, edge);
-extern void build_sese_loop_nests (sese_info_p);
extern struct loop *outermost_loop_in_sese (sese_l &, basic_block);
extern tree scalar_evolution_in_region (const sese_l &, loop_p, tree);
extern bool scev_analyzable_p (tree, sese_l &);
extern bool invariant_in_sese_p_rec (tree, const sese_l &, bool *);
-/* Check that SESE contains LOOP. */
-
-static inline bool
-sese_contains_loop (sese_info_p sese, struct loop *loop)
-{
- return bitmap_bit_p (sese->loops, loop->num);
-}
-
/* The number of parameters in REGION. */
static inline unsigned