1 /* Detection of Static Control Parts (SCoP) for Graphite.
2 Copyright (C) 2009-2015 Free Software Foundation, Inc.
3 Contributed by Sebastian Pop <sebastian.pop@amd.com> and
4 Tobias Grosser <grosser@fim.uni-passau.de>.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 /* Workaround for GMP 5.1.3 bug, see PR56019. */
28 #include <isl/constraint.h>
31 #include <isl/union_map.h>
34 #include "coretypes.h"
42 #include "fold-const.h"
43 #include "gimple-iterator.h"
45 #include "tree-ssa-loop-manip.h"
46 #include "tree-ssa-loop-niter.h"
47 #include "tree-ssa-loop.h"
48 #include "tree-into-ssa.h"
51 #include "tree-data-ref.h"
52 #include "tree-scalar-evolution.h"
53 #include "tree-pass.h"
54 #include "graphite-poly.h"
55 #include "tree-ssa-propagate.h"
56 #include "graphite-scop-detection.h"
57 #include "gimple-pretty-print.h"
59 /* Lightweight representation of sese for scop detection.
60 TODO: Make all this as a constant_edge. */
63 sese_l (edge e
, edge x
) : entry (e
), exit (x
) {}
65 /* This is to push objects of sese_l in a vec. */
66 sese_l (int i
) : entry (NULL
), exit (NULL
) { gcc_assert (i
== 0); }
68 operator bool () const { return entry
&& exit
; }
71 operator= (const sese_l
&s
)
82 /* APIs for getting entry/exit of an sese. */
102 set_dump_file (FILE *f
)
108 friend debug_printer
&
109 operator<< (debug_printer
&output
, int i
)
111 fprintf (output
.dump_file
, "%d", i
);
114 friend debug_printer
&
115 operator<< (debug_printer
&output
, const char *s
)
117 fprintf (output
.dump_file
, "%s", s
);
122 #define DEBUG_PRINT(args) do \
124 if (dump_file && (dump_flags & TDF_DETAILS)) { args; } \
128 /* Return true if BB is empty, contains only DEBUG_INSNs. */
131 trivially_empty_bb_p (basic_block bb
)
133 gimple_stmt_iterator gsi
;
135 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
136 if (gimple_code (gsi_stmt (gsi
)) != GIMPLE_DEBUG
)
142 /* Returns true when P1 and P2 are close phis with the same
146 same_close_phi_node (gphi
*p1
, gphi
*p2
)
148 return operand_equal_p (gimple_phi_arg_def (p1
, 0),
149 gimple_phi_arg_def (p2
, 0), 0);
152 /* Store the GRAPHITE representation of BB. */
154 static gimple_poly_bb_p
155 new_gimple_poly_bb (basic_block bb
, vec
<data_reference_p
> drs
)
157 gimple_poly_bb_p gbb
;
159 gbb
= XNEW (struct gimple_poly_bb
);
162 GBB_DATA_REFS (gbb
) = drs
;
163 GBB_CONDITIONS (gbb
).create (0);
164 GBB_CONDITION_CASES (gbb
).create (0);
169 /* Compare the depth of two basic_block's P1 and P2. */
172 compare_bb_depths (const void *p1
, const void *p2
)
174 const_basic_block
const bb1
= *(const_basic_block
const *)p1
;
175 const_basic_block
const bb2
= *(const_basic_block
const *)p2
;
176 int d1
= loop_depth (bb1
->loop_father
);
177 int d2
= loop_depth (bb2
->loop_father
);
188 /* Sort the basic blocks from DOM such that the first are the ones at
189 a deepest loop level. */
192 graphite_sort_dominated_info (vec
<basic_block
> dom
)
194 dom
.qsort (compare_bb_depths
);
197 static void make_close_phi_nodes_unique (basic_block bb
);
199 /* Remove the close phi node at GSI and replace its rhs with the rhs
203 remove_duplicate_close_phi (gphi
*phi
, gphi_iterator
*gsi
)
207 imm_use_iterator imm_iter
;
208 tree res
= gimple_phi_result (phi
);
209 tree def
= gimple_phi_result (gsi
->phi ());
211 gcc_assert (same_close_phi_node (phi
, gsi
->phi ()));
213 FOR_EACH_IMM_USE_STMT (use_stmt
, imm_iter
, def
)
215 FOR_EACH_IMM_USE_ON_STMT (use_p
, imm_iter
)
216 SET_USE (use_p
, res
);
218 update_stmt (use_stmt
);
220 /* It is possible that we just created a duplicate close-phi
221 for an already-processed containing loop. Check for this
222 case and clean it up. */
223 if (gimple_code (use_stmt
) == GIMPLE_PHI
224 && gimple_phi_num_args (use_stmt
) == 1)
225 make_close_phi_nodes_unique (gimple_bb (use_stmt
));
228 remove_phi_node (gsi
, true);
231 /* Removes all the close phi duplicates from BB. */
234 make_close_phi_nodes_unique (basic_block bb
)
238 for (psi
= gsi_start_phis (bb
); !gsi_end_p (psi
); gsi_next (&psi
))
240 gphi_iterator gsi
= psi
;
241 gphi
*phi
= psi
.phi ();
243 /* At this point, PHI should be a close phi in normal form. */
244 gcc_assert (gimple_phi_num_args (phi
) == 1);
246 /* Iterate over the next phis and remove duplicates. */
248 while (!gsi_end_p (gsi
))
249 if (same_close_phi_node (phi
, gsi
.phi ()))
250 remove_duplicate_close_phi (phi
, &gsi
);
256 /* Transforms LOOP to the canonical loop closed SSA form. */
259 canonicalize_loop_closed_ssa (loop_p loop
)
261 edge e
= single_exit (loop
);
264 if (!e
|| e
->flags
& EDGE_ABNORMAL
)
269 if (single_pred_p (bb
))
271 e
= split_block_after_labels (bb
);
272 DEBUG_PRINT (dp
<< "\nSplitting bb_" << bb
->index
);
273 make_close_phi_nodes_unique (e
->src
);
278 basic_block close
= split_edge (e
);
280 e
= single_succ_edge (close
);
281 DEBUG_PRINT (dp
<< "\nSplitting edge (" << e
->src
->index
<< ","
282 << e
->dest
->index
<< ")\n");
284 for (psi
= gsi_start_phis (bb
); !gsi_end_p (psi
); gsi_next (&psi
))
286 gphi
*phi
= psi
.phi ();
289 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
290 if (gimple_phi_arg_edge (phi
, i
) == e
)
292 tree res
, arg
= gimple_phi_arg_def (phi
, i
);
296 if (TREE_CODE (arg
) != SSA_NAME
)
299 close_phi
= create_phi_node (NULL_TREE
, close
);
300 res
= create_new_def_for (arg
, close_phi
,
301 gimple_phi_result_ptr (close_phi
));
302 add_phi_arg (close_phi
, arg
,
303 gimple_phi_arg_edge (close_phi
, 0),
305 use_p
= gimple_phi_arg_imm_use_ptr (phi
, i
);
306 replace_exp (use_p
, res
);
311 make_close_phi_nodes_unique (close
);
314 /* The code above does not properly handle changes in the post dominance
315 information (yet). */
316 recompute_all_dominators ();
319 /* Converts the current loop closed SSA form to a canonical form
320 expected by the Graphite code generation.
322 The loop closed SSA form has the following invariant: a variable
323 defined in a loop that is used outside the loop appears only in the
324 phi nodes in the destination of the loop exit. These phi nodes are
325 called close phi nodes.
327 The canonical loop closed SSA form contains the extra invariants:
329 - when the loop contains only one exit, the close phi nodes contain
330 only one argument. That implies that the basic block that contains
331 the close phi nodes has only one predecessor, that is a basic block
334 - the basic block containing the close phi nodes does not contain
337 - there exist only one phi node per definition in the loop.
341 canonicalize_loop_closed_ssa_form (void)
345 #ifdef ENABLE_CHECKING
346 verify_loop_closed_ssa (true);
349 FOR_EACH_LOOP (loop
, 0)
350 canonicalize_loop_closed_ssa (loop
);
352 rewrite_into_loop_closed_ssa (NULL
, TODO_update_ssa
);
353 update_ssa (TODO_update_ssa
);
355 #ifdef ENABLE_CHECKING
356 verify_loop_closed_ssa (true);
360 /* Can all ivs be represented by a signed integer?
361 As ISL might generate negative values in its expressions, signed loop ivs
362 are required in the backend. */
365 loop_ivs_can_be_represented (loop_p loop
)
367 unsigned type_long_long
= TYPE_PRECISION (long_long_integer_type_node
);
368 for (gphi_iterator psi
= gsi_start_phis (loop
->header
); !gsi_end_p (psi
);
371 gphi
*phi
= psi
.phi ();
372 tree res
= PHI_RESULT (phi
);
373 tree type
= TREE_TYPE (res
);
375 if (TYPE_UNSIGNED (type
) && TYPE_PRECISION (type
) >= type_long_long
)
382 /* Returns a COND_EXPR statement when BB has a single predecessor, the
383 edge between BB and its predecessor is not a loop exit edge, and
384 the last statement of the single predecessor is a COND_EXPR. */
387 single_pred_cond_non_loop_exit (basic_block bb
)
389 if (single_pred_p (bb
))
391 edge e
= single_pred_edge (bb
);
392 basic_block pred
= e
->src
;
395 if (loop_depth (pred
->loop_father
) > loop_depth (bb
->loop_father
))
398 stmt
= last_stmt (pred
);
400 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
401 return as_a
<gcond
*> (stmt
);
410 /* Build the maximal scop containing LOOPs and add it to SCOPS. */
415 scop_detection () : scops (vNULL
) {}
417 /* A marker for invalid sese_l. */
418 static sese_l invalid_sese
;
420 /* Return the SCOPS in this SCOP_DETECTION. */
428 /* Return an sese_l around the LOOP. */
430 sese_l
get_sese (loop_p loop
);
432 /* Return the closest dominator with a single entry edge. In case of a
433 back-loop the back-edge is not counted. */
435 static edge
get_nearest_dom_with_single_entry (basic_block dom
);
437 /* Return the closest post-dominator with a single exit edge. In case of a
438 back-loop the back-edge is not counted. */
440 static edge
get_nearest_pdom_with_single_exit (basic_block dom
);
442 /* Print S to FILE. */
444 static void print_sese (FILE *file
, sese_l s
);
446 /* Merge scops at same loop depth and returns the new sese.
447 Returns a new SESE when merge was successful, INVALID_SESE otherwise. */
449 sese_l
merge_sese (sese_l first
, sese_l second
) const;
451 /* Build scop outer->inner if possible. */
453 sese_l
build_scop_depth (sese_l s
, loop_p loop
);
455 /* If loop and loop->next are valid scops, try to merge them. */
457 sese_l
build_scop_breadth (sese_l s1
, loop_p loop
);
459 /* Return true when LOOP is a valid scop, that is a Static Control Part, a
460 region of code that can be represented in the polyhedral model. SCOP
461 defines the region we analyse. */
463 bool loop_is_valid_scop (loop_p loop
, sese_l scop
) const;
465 /* Return true when BEGIN is the preheader edge of a loop with a single exit
468 static bool region_has_one_loop (sese_l s
);
470 /* Add to SCOPS a scop starting at SCOP_BEGIN and ending at SCOP_END. */
472 void add_scop (sese_l s
);
474 /* Returns true if S1 subsumes/surrounds S2. */
475 static bool subsumes (sese_l s1
, sese_l s2
);
477 /* Remove a SCoP which is subsumed by S1. */
478 void remove_subscops (sese_l s1
);
480 /* Returns true if S1 intersects with S2. Since we already know that S1 does
481 not subsume S2 or vice-versa, we only check for entry bbs. */
483 static bool intersects (sese_l s1
, sese_l s2
);
485 /* Remove one of the scops when it intersects with any other. */
487 void remove_intersecting_scops (sese_l s1
);
489 /* Return true when the body of LOOP has statements that can be represented
492 bool loop_body_is_valid_scop (loop_p loop
, sese_l scop
) const;
494 /* Return true when BB contains a harmful operation for a scop: that
495 can be a function call with side effects, the induction variables
496 are not linear with respect to SCOP, etc. The current open
497 scop should end before this statement. */
499 bool harmful_stmt_in_bb (sese_l scop
, basic_block bb
) const;
501 /* Return true when a statement in SCOP cannot be represented by Graphite.
502 The assumptions are that L1 dominates L2, and SCOP->entry dominates L1.
503 Limit the number of bbs between adjacent loops to
504 PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
506 bool harmful_stmt_in_region (sese_l scop
) const;
508 /* Return true only when STMT is simple enough for being handled by Graphite.
509 This depends on SCOP, as the parameters are initialized relatively to
510 this basic block, the linear functions are initialized based on the
511 outermost loop containing STMT inside the SCOP. BB is the place where we
512 try to evaluate the STMT. */
514 bool stmt_simple_for_scop_p (sese_l scop
, gimple
*stmt
,
515 basic_block bb
) const;
517 /* Something like "n * m" is not allowed. */
519 static bool graphite_can_represent_init (tree e
);
521 /* Return true when SCEV can be represented in the polyhedral model.
523 An expression can be represented, if it can be expressed as an
524 affine expression. For loops (i, j) and parameters (m, n) all
525 affine expressions are of the form:
527 x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
529 1 i + 20 j + (-2) m + 25
531 Something like "i * n" or "n * m" is not allowed. */
533 static bool graphite_can_represent_scev (tree scev
);
535 /* Return true when EXPR can be represented in the polyhedral model.
537 This means an expression can be represented, if it is linear with respect
538 to the loops and the strides are non parametric. LOOP is the place where
539 the expr will be evaluated. SCOP defines the region we analyse. */
541 static bool graphite_can_represent_expr (sese_l scop
, loop_p loop
,
544 /* Return true if the data references of STMT can be represented by Graphite.
545 We try to analyze the data references in a loop contained in the SCOP. */
547 static bool stmt_has_simple_data_refs_p (sese_l scop
, gimple
*stmt
);
549 /* Remove the close phi node at GSI and replace its rhs with the rhs
552 static void remove_duplicate_close_phi (gphi
*phi
, gphi_iterator
*gsi
);
554 /* Returns true when Graphite can represent LOOP in SCOP.
555 FIXME: For the moment, graphite cannot be used on loops that iterate using
556 induction variables that wrap. */
558 static bool can_represent_loop_1 (loop_p loop
, sese_l scop
);
560 /* Return true when all the loops within LOOP can be represented by
563 static bool can_represent_loop (loop_p loop
, sese_l scop
);
565 /* Generates a polyhedral black box only if the bb contains interesting
568 static gimple_poly_bb_p
try_generate_gimple_bb (scop_p scop
, basic_block bb
);
570 /* Returns true if all predecessors of BB, that are not dominated by BB, are
571 marked in MAP. The predecessors dominated by BB are loop latches and will
572 be handled after BB. */
574 static bool all_non_dominated_preds_marked_p (basic_block bb
, sbitmap map
);
576 /* Recursive helper function for build_scops_bbs. */
578 static void build_scop_bbs_1 (scop_p scop
, sbitmap visited
, basic_block bb
);
580 /* Gather the basic blocks belonging to the SCOP. */
582 static void build_scop_bbs (scop_p scop
);
584 /* Returns the number of pbbs that are in loops contained in SCOP. */
586 static int nb_pbbs_in_loops (scop_p scop
);
588 static bool graphite_can_represent_stmt (sese_l
, gimple
*, basic_block
);
594 sese_l
scop_detection::invalid_sese (0);
596 /* Return an sese_l around the LOOP. */
599 scop_detection::get_sese (loop_p loop
)
604 if (!loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS
))
606 edge scop_end
= single_exit (loop
);
609 edge scop_begin
= loop_preheader_edge (loop
);
610 sese_l
s (scop_begin
, scop_end
);
614 /* Return the closest dominator with a single entry edge. */
617 scop_detection::get_nearest_dom_with_single_entry (basic_block dom
)
621 /* If e1->src dominates e2->src then e1->src will also dominate dom. */
622 if (dom
->preds
->length () == 2)
624 edge e1
= (*dom
->preds
)[0];
625 edge e2
= (*dom
->preds
)[1];
626 if (dominated_by_p (CDI_DOMINATORS
, e2
->src
, e1
->src
))
628 if (dominated_by_p (CDI_DOMINATORS
, e1
->src
, e2
->src
))
632 while (dom
->preds
->length () != 1)
634 if (dom
->preds
->length () < 1)
636 dom
= get_immediate_dominator (CDI_DOMINATORS
, dom
);
640 return (*dom
->preds
)[0];
643 /* Return the closest post-dominator with a single exit edge. In case of a
644 back-loop the back-edge is not counted. */
647 scop_detection::get_nearest_pdom_with_single_exit (basic_block dom
)
651 if (dom
->succs
->length () == 2)
653 edge e1
= (*dom
->succs
)[0];
654 edge e2
= (*dom
->succs
)[1];
655 if (dominated_by_p (CDI_POST_DOMINATORS
, e2
->dest
, e1
->dest
))
657 if (dominated_by_p (CDI_POST_DOMINATORS
, e1
->dest
, e2
->dest
))
661 while (dom
->succs
->length () != 1)
663 if (dom
->succs
->length () < 1)
665 dom
= get_immediate_dominator (CDI_POST_DOMINATORS
, dom
);
669 return (*dom
->succs
)[0];
672 /* Print S to FILE. */
675 scop_detection::print_sese (FILE *file
, sese_l s
)
677 fprintf (file
, "(entry_edge (bb_%d, bb_%d), exit_edge (bb_%d, bb_%d))\n",
678 s
.entry
->src
->index
, s
.entry
->dest
->index
,
679 s
.exit
->src
->index
, s
.exit
->dest
->index
);
682 /* Merge scops at same loop depth and returns the new sese.
683 Returns a new SESE when merge was successful, INVALID_SESE otherwise. */
686 scop_detection::merge_sese (sese_l first
, sese_l second
) const
688 /* In the trivial case first/second may be NULL. */
694 DEBUG_PRINT (dp
<< "[try-merging-sese] s1: "; print_sese (dump_file
, first
);
695 dp
<< "[try-merging-sese] s2: ";
696 print_sese (dump_file
, second
));
698 /* Assumption: Both the sese's should be at the same loop depth or one scop
699 should subsume the other like in case of nested loops. */
701 /* Find the common dominators for entry,
702 and common post-dominators for the exit. */
703 basic_block dom
= nearest_common_dominator (CDI_DOMINATORS
,
704 get_entry_bb (first
.entry
),
705 get_entry_bb (second
.entry
));
707 edge entry
= get_nearest_dom_with_single_entry (dom
);
711 basic_block pdom
= nearest_common_dominator (CDI_POST_DOMINATORS
,
712 get_exit_bb (first
.exit
),
713 get_exit_bb (second
.exit
));
714 pdom
= nearest_common_dominator (CDI_POST_DOMINATORS
, dom
, pdom
);
716 edge exit
= get_nearest_pdom_with_single_exit (pdom
);
720 sese_l
combined (entry
, exit
);
722 /* FIXME: We could iterate to find the dom which dominates pdom, and pdom
723 which post-dominates dom, until it stabilizes. Also, ENTRY->SRC and
724 EXIT->DEST should be in the same loop nest. */
725 if (!dominated_by_p (CDI_DOMINATORS
, pdom
, dom
)
726 || loop_depth (entry
->src
->loop_father
)
727 != loop_depth (exit
->dest
->loop_father
))
730 /* For now we just want to bail out when exit does not post-dominate entry.
731 TODO: We might just add a basic_block at the exit to make exit
732 post-dominate entry (the entire region). */
733 if (!dominated_by_p (CDI_POST_DOMINATORS
, get_entry_bb (entry
),
735 || !dominated_by_p (CDI_DOMINATORS
, get_exit_bb (exit
),
736 get_entry_bb (entry
)))
738 DEBUG_PRINT (dp
<< "[scop-detection-fail] cannot merge seses.\n");
742 /* FIXME: We should remove this piece of code once
743 canonicalize_loop_closed_ssa has been removed, because that function
744 adds a BB with single exit. */
745 if (!trivially_empty_bb_p (get_exit_bb (combined
.exit
)))
747 /* Find the first empty succ (with single exit) of combined.exit. */
748 basic_block imm_succ
= combined
.exit
->dest
;
749 if (single_succ_p (imm_succ
) && trivially_empty_bb_p (imm_succ
))
750 combined
.exit
= single_succ_edge (imm_succ
);
753 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] Discarding SCoP because "
754 << "no single exit (empty succ) for sese exit";
755 print_sese (dump_file
, combined
));
760 /* Analyze all the BBs in new sese. */
761 if (harmful_stmt_in_region (combined
))
764 DEBUG_PRINT (dp
<< "[merged-sese] s1: "; print_sese (dump_file
, combined
));
769 /* Build scop outer->inner if possible. */
772 scop_detection::build_scop_depth (sese_l s
, loop_p loop
)
777 DEBUG_PRINT (dp
<< "\n[Depth loop_" << loop
->num
<< "]");
778 s
= build_scop_depth (s
, loop
->inner
);
780 sese_l s2
= merge_sese (s
, get_sese (loop
));
783 /* s might be a valid scop, so return it and start analyzing from the
785 build_scop_depth (invalid_sese
, loop
->next
);
789 if (!loop_is_valid_scop (loop
, s2
))
790 return build_scop_depth (invalid_sese
, loop
->next
);
792 return build_scop_breadth (s2
, loop
);
795 /* If loop and loop->next are valid scops, try to merge them. */
798 scop_detection::build_scop_breadth (sese_l s1
, loop_p loop
)
802 DEBUG_PRINT (dp
<< "\n[Breadth loop_" << loop
->num
<< "]");
806 sese_l s2
= build_scop_depth (invalid_sese
, l
->next
);
814 sese_l combined
= merge_sese (s1
, s2
);
826 /* Returns true when Graphite can represent LOOP in SCOP.
827 FIXME: For the moment, graphite cannot be used on loops that iterate using
828 induction variables that wrap. */
831 scop_detection::can_represent_loop_1 (loop_p loop
, sese_l scop
)
834 struct tree_niter_desc niter_desc
;
836 return single_exit (loop
)
837 && number_of_iterations_exit (loop
, single_exit (loop
), &niter_desc
, false)
838 && niter_desc
.control
.no_overflow
839 && (niter
= number_of_latch_executions (loop
))
840 && !chrec_contains_undetermined (niter
)
841 && graphite_can_represent_expr (scop
, loop
, niter
);
844 /* Return true when all the loops within LOOP can be represented by
848 scop_detection::can_represent_loop (loop_p loop
, sese_l scop
)
850 if (!can_represent_loop_1 (loop
, scop
))
852 if (loop
->inner
&& !can_represent_loop (loop
->inner
, scop
))
854 if (loop
->next
&& !can_represent_loop (loop
->next
, scop
))
860 /* Return true when LOOP is a valid scop, that is a Static Control Part, a
861 region of code that can be represented in the polyhedral model. SCOP
862 defines the region we analyse. */
865 scop_detection::loop_is_valid_scop (loop_p loop
, sese_l scop
) const
870 if (!can_represent_loop (loop
, scop
))
872 DEBUG_PRINT (dp
<< "[scop-detection-fail] cannot represent loop_"
873 << loop
->num
<< "\n");
877 if (loop_body_is_valid_scop (loop
, scop
))
879 DEBUG_PRINT (dp
<< "[valid-scop] loop_" << loop
->num
880 << "is a valid scop.\n");
886 /* Return true when BEGIN is the preheader edge of a loop with a single exit
890 scop_detection::region_has_one_loop (sese_l s
)
892 edge begin
= s
.entry
;
894 /* Check for a single perfectly nested loop. */
895 if (begin
->dest
->loop_father
->inner
)
898 /* Otherwise, check whether we have adjacent loops. */
899 return begin
->dest
->loop_father
== end
->src
->loop_father
;
902 /* Add to SCOPS a scop starting at SCOP_BEGIN and ending at SCOP_END. */
905 scop_detection::add_scop (sese_l s
)
909 /* Do not add scops with only one loop. */
910 if (region_has_one_loop (s
))
912 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] Discarding one loop SCoP";
913 print_sese (dump_file
, s
));
917 if (get_exit_bb (s
.exit
) == EXIT_BLOCK_PTR_FOR_FN (cfun
))
919 DEBUG_PRINT (dp
<< "\n[scop-detection-fail] "
920 << "Discarding SCoP exiting to return";
921 print_sese (dump_file
, s
));
925 /* Remove all the scops which are subsumed by s. */
928 /* Replace this with split-intersecting scops. */
929 remove_intersecting_scops (s
);
932 DEBUG_PRINT (dp
<< "\nAdding SCoP "; print_sese (dump_file
, s
));
935 /* Return true when a statement in SCOP cannot be represented by Graphite.
936 The assumptions are that L1 dominates L2, and SCOP->entry dominates L1.
937 Limit the number of bbs between adjacent loops to
938 PARAM_SCOP_MAX_NUM_BBS_BETWEEN_LOOPS. */
941 scop_detection::harmful_stmt_in_region (sese_l scop
) const
943 basic_block exit_bb
= get_exit_bb (scop
.exit
);
944 basic_block entry_bb
= get_entry_bb (scop
.entry
);
946 DEBUG_PRINT (dp
<< "\n[checking-harmful-bbs] ";
947 print_sese (dump_file
, scop
));
948 gcc_assert (dominated_by_p (CDI_DOMINATORS
, exit_bb
, entry_bb
));
950 int depth
= bb_dom_dfs_in (CDI_DOMINATORS
, exit_bb
)
951 - bb_dom_dfs_in (CDI_DOMINATORS
, entry_bb
);
953 gcc_assert (depth
> 0);
956 = get_dominated_to_depth (CDI_DOMINATORS
, entry_bb
, depth
);
959 FOR_EACH_VEC_ELT (dom
, i
, bb
)
961 DEBUG_PRINT (dp
<< "\nVisiting bb_" << bb
->index
);
963 /* We don't want to analyze any bb outside sese. */
964 if (!dominated_by_p (CDI_POST_DOMINATORS
, bb
, exit_bb
))
967 if (harmful_stmt_in_bb (scop
, bb
))
974 /* Returns true if S1 subsumes/surrounds S2. */
976 scop_detection::subsumes (sese_l s1
, sese_l s2
)
978 if (dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
.entry
),
979 get_entry_bb (s1
.entry
))
980 && dominated_by_p (CDI_POST_DOMINATORS
, get_entry_bb (s2
.exit
),
981 get_entry_bb (s1
.exit
)))
986 /* Remove a SCoP which is subsumed by S1. */
988 scop_detection::remove_subscops (sese_l s1
)
992 FOR_EACH_VEC_ELT_REVERSE (scops
, j
, s2
)
994 if (subsumes (s1
, s2
))
996 DEBUG_PRINT (dp
<< "\nRemoving sub-SCoP";
997 print_sese (dump_file
, s2
));
998 scops
.unordered_remove (j
);
1003 /* Returns true if S1 intersects with S2. Since we already know that S1 does
1004 not subsume S2 or vice-versa, we only check for entry bbs. */
1007 scop_detection::intersects (sese_l s1
, sese_l s2
)
1009 if (dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
.entry
),
1010 get_entry_bb (s1
.entry
))
1011 && !dominated_by_p (CDI_DOMINATORS
, get_entry_bb (s2
.entry
),
1012 get_exit_bb (s1
.exit
)))
1014 if ((s1
.exit
== s2
.entry
) || (s2
.exit
== s1
.entry
))
1020 /* Remove one of the scops when it intersects with any other. */
1023 scop_detection::remove_intersecting_scops (sese_l s1
)
1027 FOR_EACH_VEC_ELT_REVERSE (scops
, j
, s2
)
1029 if (intersects (s1
, s2
))
1031 DEBUG_PRINT (dp
<< "\nRemoving intersecting SCoP";
1032 print_sese (dump_file
, s2
); dp
<< "Intersects with:";
1033 print_sese (dump_file
, s1
));
1034 scops
.unordered_remove (j
);
1039 /* Something like "n * m" is not allowed. */
1042 scop_detection::graphite_can_represent_init (tree e
)
1044 switch (TREE_CODE (e
))
1046 case POLYNOMIAL_CHREC
:
1047 return graphite_can_represent_init (CHREC_LEFT (e
))
1048 && graphite_can_represent_init (CHREC_RIGHT (e
));
1051 if (chrec_contains_symbols (TREE_OPERAND (e
, 0)))
1052 return graphite_can_represent_init (TREE_OPERAND (e
, 0))
1053 && tree_fits_shwi_p (TREE_OPERAND (e
, 1));
1055 return graphite_can_represent_init (TREE_OPERAND (e
, 1))
1056 && tree_fits_shwi_p (TREE_OPERAND (e
, 0));
1059 case POINTER_PLUS_EXPR
:
1061 return graphite_can_represent_init (TREE_OPERAND (e
, 0))
1062 && graphite_can_represent_init (TREE_OPERAND (e
, 1));
1067 case NON_LVALUE_EXPR
:
1068 return graphite_can_represent_init (TREE_OPERAND (e
, 0));
1077 /* Return true when SCEV can be represented in the polyhedral model.
1079 An expression can be represented, if it can be expressed as an
1080 affine expression. For loops (i, j) and parameters (m, n) all
1081 affine expressions are of the form:
1083 x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
1085 1 i + 20 j + (-2) m + 25
1087 Something like "i * n" or "n * m" is not allowed. */
1090 scop_detection::graphite_can_represent_scev (tree scev
)
1092 if (chrec_contains_undetermined (scev
))
1095 /* We disable the handling of pointer types, because it’s currently not
1096 supported by Graphite with the ISL AST generator. SSA_NAME nodes are
1097 the only nodes, which are disabled in case they are pointers to object
1098 types, but this can be changed. */
1100 if (POINTER_TYPE_P (TREE_TYPE (scev
)) && TREE_CODE (scev
) == SSA_NAME
)
1103 switch (TREE_CODE (scev
))
1108 case NON_LVALUE_EXPR
:
1109 return graphite_can_represent_scev (TREE_OPERAND (scev
, 0));
1112 case POINTER_PLUS_EXPR
:
1114 return graphite_can_represent_scev (TREE_OPERAND (scev
, 0))
1115 && graphite_can_represent_scev (TREE_OPERAND (scev
, 1));
1118 return !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev
, 0)))
1119 && !CONVERT_EXPR_CODE_P (TREE_CODE (TREE_OPERAND (scev
, 1)))
1120 && !(chrec_contains_symbols (TREE_OPERAND (scev
, 0))
1121 && chrec_contains_symbols (TREE_OPERAND (scev
, 1)))
1122 && graphite_can_represent_init (scev
)
1123 && graphite_can_represent_scev (TREE_OPERAND (scev
, 0))
1124 && graphite_can_represent_scev (TREE_OPERAND (scev
, 1));
1126 case POLYNOMIAL_CHREC
:
1127 /* Check for constant strides. With a non constant stride of
1128 'n' we would have a value of 'iv * n'. Also check that the
1129 initial value can represented: for example 'n * m' cannot be
1131 if (!evolution_function_right_is_integer_cst (scev
)
1132 || !graphite_can_represent_init (scev
))
1134 return graphite_can_represent_scev (CHREC_LEFT (scev
));
1140 /* Only affine functions can be represented. */
1141 if (tree_contains_chrecs (scev
, NULL
) || !scev_is_linear_expression (scev
))
1147 /* Return true when EXPR can be represented in the polyhedral model.
1149 This means an expression can be represented, if it is linear with respect to
1150 the loops and the strides are non parametric. LOOP is the place where the
1151 expr will be evaluated. SCOP defines the region we analyse. */
1154 scop_detection::graphite_can_represent_expr (sese_l scop
, loop_p loop
,
1157 sese region
= new_sese (scop
.entry
, scop
.exit
);
1158 tree scev
= scalar_evolution_in_region (region
, loop
, expr
);
1160 return graphite_can_represent_scev (scev
);
1163 /* Return true if the data references of STMT can be represented by Graphite.
1164 We try to analyze the data references in a loop contained in the SCOP. */
1167 scop_detection::stmt_has_simple_data_refs_p (sese_l scop
, gimple
*stmt
)
1169 sese region
= new_sese (scop
.entry
, scop
.exit
);
1170 loop_p nest
= outermost_loop_in_sese (region
, gimple_bb (stmt
));
1171 loop_p loop
= loop_containing_stmt (stmt
);
1172 vec
<data_reference_p
> drs
= vNULL
;
1174 graphite_find_data_references_in_stmt (nest
, loop
, stmt
, &drs
);
1177 data_reference_p dr
;
1178 FOR_EACH_VEC_ELT (drs
, j
, dr
)
1180 int nb_subscripts
= DR_NUM_DIMENSIONS (dr
);
1182 if (nb_subscripts
< 1)
1184 free_data_refs (drs
);
1188 tree ref
= DR_REF (dr
);
1190 for (int i
= nb_subscripts
- 1; i
>= 0; i
--)
1192 if (!graphite_can_represent_scev (DR_ACCESS_FN (dr
, i
))
1193 || (TREE_CODE (ref
) != ARRAY_REF
&& TREE_CODE (ref
) != MEM_REF
1194 && TREE_CODE (ref
) != COMPONENT_REF
))
1196 free_data_refs (drs
);
1200 ref
= TREE_OPERAND (ref
, 0);
1204 free_data_refs (drs
);
1208 /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
1209 Calls have side-effects, except those to const or pure
1213 stmt_has_side_effects (gimple
*stmt
)
1215 if (gimple_has_volatile_ops (stmt
)
1216 || (gimple_code (stmt
) == GIMPLE_CALL
1217 && !(gimple_call_flags (stmt
) & (ECF_CONST
| ECF_PURE
)))
1218 || (gimple_code (stmt
) == GIMPLE_ASM
))
1220 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1221 << "Statement has side-effects:\n";
1222 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
| TDF_MEMSYMS
));
1228 /* Returns true if STMT can be represented in polyhedral model. LABEL,
1229 simple COND stmts, pure calls, and assignments can be repesented. */
1232 scop_detection::graphite_can_represent_stmt (sese_l scop
, gimple
*stmt
,
1235 loop_p loop
= bb
->loop_father
;
1236 switch (gimple_code (stmt
))
1243 /* We can handle all binary comparisons. Inequalities are
1244 also supported as they can be represented with union of
1246 enum tree_code code
= gimple_cond_code (stmt
);
1247 if (!(code
== LT_EXPR
1252 || code
== NE_EXPR
))
1254 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1255 << "Graphite cannot handle cond stmt:\n";
1256 print_gimple_stmt (dump_file
, stmt
, 0,
1257 TDF_VOPS
| TDF_MEMSYMS
));
1261 for (unsigned i
= 0; i
< 2; ++i
)
1263 tree op
= gimple_op (stmt
, i
);
1264 if (!graphite_can_represent_expr (scop
, loop
, op
)
1265 /* We can only constrain on integer type. */
1266 || (TREE_CODE (TREE_TYPE (op
)) != INTEGER_TYPE
))
1268 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1269 << "Graphite cannot represent stmt:\n";
1270 print_gimple_stmt (dump_file
, stmt
, 0,
1271 TDF_VOPS
| TDF_MEMSYMS
));
1284 /* These nodes cut a new scope. */
1286 dp
<< "[scop-detection-fail] "
1287 << "Gimple stmt not handled in Graphite:\n";
1288 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
| TDF_MEMSYMS
));
1293 /* Return true only when STMT is simple enough for being handled by Graphite.
1294 This depends on SCOP, as the parameters are initialized relatively to
1295 this basic block, the linear functions are initialized based on the outermost
1296 loop containing STMT inside the SCOP. BB is the place where we try to
1297 evaluate the STMT. */
1300 scop_detection::stmt_simple_for_scop_p (sese_l scop
, gimple
*stmt
,
1301 basic_block bb
) const
1305 if (is_gimple_debug (stmt
))
1308 if (stmt_has_side_effects (stmt
))
1311 if (!stmt_has_simple_data_refs_p (scop
, stmt
))
1313 DEBUG_PRINT (dp
<< "[scop-detection-fail] "
1314 << "Graphite cannot handle data-refs in stmt:\n";
1315 print_gimple_stmt (dump_file
, stmt
, 0, TDF_VOPS
|TDF_MEMSYMS
););
1319 return graphite_can_represent_stmt (scop
, stmt
, bb
);
1322 /* Return true when BB contains a harmful operation for a scop: that
1323 can be a function call with side effects, the induction variables
1324 are not linear with respect to SCOP, etc. The current open
1325 scop should end before this statement. */
1328 scop_detection::harmful_stmt_in_bb (sese_l scop
, basic_block bb
) const
1330 gimple_stmt_iterator gsi
;
1332 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1333 if (!stmt_simple_for_scop_p (scop
, gsi_stmt (gsi
), bb
))
1339 /* Pretty print to FILE all the SCoPs in DOT format and mark them with
1340 different colors. If there are not enough colors, paint the
1341 remaining SCoPs in gray.
1344 - "*" after the node number denotes the entry of a SCoP,
1345 - "#" after the node number denotes the exit of a SCoP,
1346 - "()" around the node number denotes the entry or the
1347 exit nodes of the SCOP. These are not part of SCoP. */
1350 dot_all_scops_1 (FILE *file
, vec
<scop_p
> scops
)
1359 /* Disable debugging while printing graph. */
1360 int tmp_dump_flags
= dump_flags
;
1363 fprintf (file
, "digraph all {\n");
1365 FOR_ALL_BB_FN (bb
, cfun
)
1367 int part_of_scop
= false;
1369 /* Use HTML for every bb label. So we are able to print bbs
1370 which are part of two different SCoPs, with two different
1371 background colors. */
1372 fprintf (file
, "%d [label=<\n <TABLE BORDER=\"0\" CELLBORDER=\"1\" ",
1374 fprintf (file
, "CELLSPACING=\"0\">\n");
1376 /* Select color for SCoP. */
1377 FOR_EACH_VEC_ELT (scops
, i
, scop
)
1379 sese region
= SCOP_REGION (scop
);
1380 if (bb_in_sese_p (bb
, region
) || (SESE_EXIT_BB (region
) == bb
)
1381 || (SESE_ENTRY_BB (region
) == bb
))
1394 case 3: /* purple */
1397 case 4: /* orange */
1400 case 5: /* yellow */
1440 fprintf (file
, " <TR><TD WIDTH=\"50\" BGCOLOR=\"%s\">",
1443 if (!bb_in_sese_p (bb
, region
))
1444 fprintf (file
, " (");
1446 if (bb
== SESE_ENTRY_BB (region
) && bb
== SESE_EXIT_BB (region
))
1447 fprintf (file
, " %d*# ", bb
->index
);
1448 else if (bb
== SESE_ENTRY_BB (region
))
1449 fprintf (file
, " %d* ", bb
->index
);
1450 else if (bb
== SESE_EXIT_BB (region
))
1451 fprintf (file
, " %d# ", bb
->index
);
1453 fprintf (file
, " %d ", bb
->index
);
1455 fprintf (file
, "{lp_%d}", bb
->loop_father
->num
);
1457 if (!bb_in_sese_p (bb
, region
))
1458 fprintf (file
, ")");
1460 fprintf (file
, "</TD></TR>\n");
1461 part_of_scop
= true;
1467 fprintf (file
, " <TR><TD WIDTH=\"50\" BGCOLOR=\"#ffffff\">");
1468 fprintf (file
, " %d {lp_%d} </TD></TR>\n", bb
->index
,
1469 bb
->loop_father
->num
);
1471 fprintf (file
, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
1474 FOR_ALL_BB_FN (bb
, cfun
)
1476 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1477 fprintf (file
, "%d -> %d;\n", bb
->index
, e
->dest
->index
);
1480 fputs ("}\n\n", file
);
1482 /* Enable debugging again. */
1483 dump_flags
= tmp_dump_flags
;
1486 /* Display all SCoPs using dotty. */
1489 dot_all_scops (vec
<scop_p
> scops
)
1491 /* When debugging, enable the following code. This cannot be used
1492 in production compilers because it calls "system". */
1495 FILE *stream
= fopen ("/tmp/allscops.dot", "w");
1496 gcc_assert (stream
);
1498 dot_all_scops_1 (stream
, scops
);
1501 x
= system ("dotty /tmp/allscops.dot &");
1503 dot_all_scops_1 (stderr
, scops
);
1507 /* Display all SCoPs using dotty. */
1510 dot_scop (scop_p scop
)
1512 auto_vec
<scop_p
, 1> scops
;
1515 scops
.safe_push (scop
);
1517 /* When debugging, enable the following code. This cannot be used
1518 in production compilers because it calls "system". */
1522 FILE *stream
= fopen ("/tmp/allscops.dot", "w");
1523 gcc_assert (stream
);
1525 dot_all_scops_1 (stream
, scops
);
1527 x
= system ("dotty /tmp/allscops.dot &");
1530 dot_all_scops_1 (stderr
, scops
);
1534 /* Return true when the body of LOOP has statements that can be represented as a
1538 scop_detection::loop_body_is_valid_scop (loop_p loop
, sese_l scop
) const
1540 if (!loop_ivs_can_be_represented (loop
))
1542 DEBUG_PRINT (dp
<< "[scop-detection-fail] loop_" << loop
->num
1543 << "IV cannot be represented.\n");
1547 if (!loop_nest_has_data_refs (loop
))
1549 DEBUG_PRINT (dp
<< "[scop-detection-fail] loop_" << loop
->num
1550 << "does not have any data reference.\n");
1554 basic_block
*bbs
= get_loop_body (loop
);
1555 for (unsigned i
= 0; i
< loop
->num_nodes
; i
++)
1557 basic_block bb
= bbs
[i
];
1559 if (harmful_stmt_in_bb (scop
, bb
))
1569 if (!loop_body_is_valid_scop (loop
, scop
))
1578 /* Generates a polyhedral black box only if the bb contains interesting
1582 scop_detection::try_generate_gimple_bb (scop_p scop
, basic_block bb
)
1584 vec
<data_reference_p
> drs
;
1586 sese region
= SCOP_REGION (scop
);
1587 loop_p nest
= outermost_loop_in_sese (region
, bb
);
1589 loop_p loop
= bb
->loop_father
;
1590 if (!loop_in_sese_p (loop
, region
))
1593 gimple_stmt_iterator gsi
;
1594 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1596 gimple
*stmt
= gsi_stmt (gsi
);
1597 if (is_gimple_debug (stmt
))
1600 graphite_find_data_references_in_stmt (nest
, loop
, stmt
, &drs
);
1603 return new_gimple_poly_bb (bb
, drs
);
1606 /* Returns true if all predecessors of BB, that are not dominated by BB, are
1607 marked in MAP. The predecessors dominated by BB are loop latches and will
1608 be handled after BB. */
1611 scop_detection::all_non_dominated_preds_marked_p (basic_block bb
, sbitmap map
)
1616 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
1617 if (!bitmap_bit_p (map
, e
->src
->index
)
1618 && !dominated_by_p (CDI_DOMINATORS
, e
->src
, bb
))
1624 /* Recursive helper function for build_scops_bbs. */
1627 scop_detection::build_scop_bbs_1 (scop_p scop
, sbitmap visited
, basic_block bb
)
1629 sese region
= SCOP_REGION (scop
);
1630 vec
<basic_block
> dom
;
1633 if (bitmap_bit_p (visited
, bb
->index
) || !bb_in_sese_p (bb
, region
))
1636 pbb
= new_poly_bb (scop
, try_generate_gimple_bb (scop
, bb
));
1637 SCOP_BBS (scop
).safe_push (pbb
);
1638 bitmap_set_bit (visited
, bb
->index
);
1640 dom
= get_dominated_by (CDI_DOMINATORS
, bb
);
1645 graphite_sort_dominated_info (dom
);
1647 while (!dom
.is_empty ())
1652 FOR_EACH_VEC_ELT (dom
, i
, dom_bb
)
1653 if (all_non_dominated_preds_marked_p (dom_bb
, visited
))
1655 build_scop_bbs_1 (scop
, visited
, dom_bb
);
1656 dom
.unordered_remove (i
);
1664 /* Gather the basic blocks belonging to the SCOP. */
1667 scop_detection::build_scop_bbs (scop_p scop
)
1669 sbitmap visited
= sbitmap_alloc (last_basic_block_for_fn (cfun
));
1670 sese region
= SCOP_REGION (scop
);
1672 bitmap_clear (visited
);
1673 build_scop_bbs_1 (scop
, visited
, SESE_ENTRY_BB (region
));
1674 sbitmap_free (visited
);
1677 /* Returns the number of pbbs that are in loops contained in SCOP. */
1680 scop_detection::nb_pbbs_in_loops (scop_p scop
)
1686 FOR_EACH_VEC_ELT (SCOP_BBS (scop
), i
, pbb
)
1687 if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb
)), SCOP_REGION (scop
)))
1693 class sese_dom_walker
: public dom_walker
1696 sese_dom_walker (cdi_direction
, sese
);
1698 virtual void before_dom_children (basic_block
);
1699 virtual void after_dom_children (basic_block
);
1702 auto_vec
<gimple
*, 3> m_conditions
, m_cases
;
1706 sese_dom_walker::sese_dom_walker (cdi_direction direction
, sese region
)
1707 : dom_walker (direction
), m_region (region
)
1711 /* Call-back for dom_walk executed before visiting the dominated
1715 sese_dom_walker::before_dom_children (basic_block bb
)
1717 gimple_poly_bb_p gbb
;
1720 if (!bb_in_sese_p (bb
, m_region
))
1723 stmt
= single_pred_cond_non_loop_exit (bb
);
1727 edge e
= single_pred_edge (bb
);
1729 m_conditions
.safe_push (stmt
);
1731 if (e
->flags
& EDGE_TRUE_VALUE
)
1732 m_cases
.safe_push (stmt
);
1734 m_cases
.safe_push (NULL
);
1737 gbb
= gbb_from_bb (bb
);
1741 GBB_CONDITIONS (gbb
) = m_conditions
.copy ();
1742 GBB_CONDITION_CASES (gbb
) = m_cases
.copy ();
1746 /* Call-back for dom_walk executed after visiting the dominated
1750 sese_dom_walker::after_dom_children (basic_block bb
)
1752 if (!bb_in_sese_p (bb
, m_region
))
1755 if (single_pred_cond_non_loop_exit (bb
))
1757 m_conditions
.pop ();
1762 /* Find Static Control Parts (SCoP) in the current function and pushes
1766 build_scops (vec
<scop_p
> *scops
)
1769 dp
.set_dump_file (dump_file
);
1771 canonicalize_loop_closed_ssa_form ();
1774 sb
.build_scop_depth (scop_detection::invalid_sese
, current_loops
->tree_root
);
1776 /* Now create scops from the lightweight SESEs. */
1777 vec
<sese_l
> scops_l
= sb
.get_scops ();
1780 FOR_EACH_VEC_ELT (scops_l
, i
, s
)
1782 sese sese_reg
= new_sese (s
.entry
, s
.exit
);
1783 scop_p scop
= new_scop (sese_reg
);
1785 /* Do not optimize a scop containing only PBBs that do not belong
1787 if (sb
.nb_pbbs_in_loops (scop
) == 0)
1789 free_sese (sese_reg
);
1794 scops
->safe_push (scop
);
1798 FOR_EACH_VEC_ELT (*scops
, i
, scop
)
1800 sb
.build_scop_bbs (scop
);
1801 sese region
= SCOP_REGION (scop
);
1802 build_sese_loop_nests (region
);
1803 /* Record all conditions in REGION. */
1804 sese_dom_walker (CDI_DOMINATORS
, region
).walk (cfun
->cfg
->x_entry_block_ptr
);
1807 DEBUG_PRINT (dp
<< "number of SCoPs: " << (scops
? scops
->length () : 0););
1810 #endif /* HAVE_isl */