1 /* If-conversion for vectorizer.
2 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 Free Software Foundation, Inc.
4 Contributed by Devang Patel <dpatel@apple.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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/>. */
22 /* This pass implements a tree level if-conversion of loops. Its
23 initial goal is to help the vectorizer to vectorize loops with
26 A short description of if-conversion:
28 o Decide if a loop is if-convertible or not.
29 o Walk all loop basic blocks in breadth first order (BFS order).
30 o Remove conditional statements (at the end of basic block)
31 and propagate condition into destination basic blocks'
33 o Replace modify expression with conditional modify expression
34 using current basic block's condition.
35 o Merge all basic blocks
36 o Replace phi nodes with conditional modify expr
37 o Merge all basic blocks into header
39 Sample transformation:
44 # i_23 = PHI <0(0), i_18(10)>;
47 if (j_15 > 41) goto <L1>; else goto <L17>;
54 # iftmp.2_4 = PHI <0(8), 42(2)>;
58 if (i_18 <= 15) goto <L19>; else goto <L18>;
68 # i_23 = PHI <0(0), i_18(10)>;
73 iftmp.2_4 = j_15 > 41 ? 42 : 0;
76 if (i_18 <= 15) goto <L19>; else goto <L18>;
86 #include "coretypes.h"
90 #include "basic-block.h"
91 #include "gimple-pretty-print.h"
92 #include "tree-flow.h"
94 #include "tree-chrec.h"
95 #include "tree-data-ref.h"
96 #include "tree-scalar-evolution.h"
97 #include "tree-pass.h"
100 /* List of basic blocks in if-conversion-suitable order. */
101 static basic_block
*ifc_bbs
;
103 /* Structure used to predicate basic blocks. This is attached to the
104 ->aux field of the BBs in the loop to be if-converted. */
105 typedef struct bb_predicate_s
{
107 /* The condition under which this basic block is executed. */
110 /* PREDICATE is gimplified, and the sequence of statements is
111 recorded here, in order to avoid the duplication of computations
112 that occur in previous conditions. See PR44483. */
113 gimple_seq predicate_gimplified_stmts
;
116 /* Returns true when the basic block BB has a predicate. */
119 bb_has_predicate (basic_block bb
)
121 return bb
->aux
!= NULL
;
124 /* Returns the gimplified predicate for basic block BB. */
127 bb_predicate (basic_block bb
)
129 return ((bb_predicate_p
) bb
->aux
)->predicate
;
132 /* Sets the gimplified predicate COND for basic block BB. */
135 set_bb_predicate (basic_block bb
, tree cond
)
137 gcc_assert ((TREE_CODE (cond
) == TRUTH_NOT_EXPR
138 && is_gimple_condexpr (TREE_OPERAND (cond
, 0)))
139 || is_gimple_condexpr (cond
));
140 ((bb_predicate_p
) bb
->aux
)->predicate
= cond
;
143 /* Returns the sequence of statements of the gimplification of the
144 predicate for basic block BB. */
146 static inline gimple_seq
147 bb_predicate_gimplified_stmts (basic_block bb
)
149 return ((bb_predicate_p
) bb
->aux
)->predicate_gimplified_stmts
;
152 /* Sets the sequence of statements STMTS of the gimplification of the
153 predicate for basic block BB. */
156 set_bb_predicate_gimplified_stmts (basic_block bb
, gimple_seq stmts
)
158 ((bb_predicate_p
) bb
->aux
)->predicate_gimplified_stmts
= stmts
;
161 /* Adds the sequence of statements STMTS to the sequence of statements
162 of the predicate for basic block BB. */
165 add_bb_predicate_gimplified_stmts (basic_block bb
, gimple_seq stmts
)
168 (&(((bb_predicate_p
) bb
->aux
)->predicate_gimplified_stmts
), stmts
);
171 /* Initializes to TRUE the predicate of basic block BB. */
174 init_bb_predicate (basic_block bb
)
176 bb
->aux
= XNEW (struct bb_predicate_s
);
177 set_bb_predicate_gimplified_stmts (bb
, NULL
);
178 set_bb_predicate (bb
, boolean_true_node
);
181 /* Free the predicate of basic block BB. */
184 free_bb_predicate (basic_block bb
)
188 if (!bb_has_predicate (bb
))
191 /* Release the SSA_NAMEs created for the gimplification of the
193 stmts
= bb_predicate_gimplified_stmts (bb
);
196 gimple_stmt_iterator i
;
198 for (i
= gsi_start (stmts
); !gsi_end_p (i
); gsi_next (&i
))
199 free_stmt_operands (gsi_stmt (i
));
206 /* Free the predicate of BB and reinitialize it with the true
210 reset_bb_predicate (basic_block bb
)
212 free_bb_predicate (bb
);
213 init_bb_predicate (bb
);
216 /* Returns a new SSA_NAME of type TYPE that is assigned the value of
217 the expression EXPR. Inserts the statement created for this
218 computation before GSI and leaves the iterator GSI at the same
222 ifc_temp_var (tree type
, tree expr
, gimple_stmt_iterator
*gsi
)
224 const char *name
= "_ifc_";
228 /* Create new temporary variable. */
229 var
= create_tmp_var (type
, name
);
230 add_referenced_var (var
);
232 /* Build new statement to assign EXPR to new variable. */
233 stmt
= gimple_build_assign (var
, expr
);
235 /* Get SSA name for the new variable and set make new statement
236 its definition statement. */
237 new_name
= make_ssa_name (var
, stmt
);
238 gimple_assign_set_lhs (stmt
, new_name
);
239 SSA_NAME_DEF_STMT (new_name
) = stmt
;
242 gsi_insert_before (gsi
, stmt
, GSI_SAME_STMT
);
243 return gimple_assign_lhs (stmt
);
246 /* Return true when COND is a true predicate. */
249 is_true_predicate (tree cond
)
251 return (cond
== NULL_TREE
252 || cond
== boolean_true_node
253 || integer_onep (cond
));
256 /* Returns true when BB has a predicate that is not trivial: true or
260 is_predicated (basic_block bb
)
262 return !is_true_predicate (bb_predicate (bb
));
265 /* Parses the predicate COND and returns its comparison code and
266 operands OP0 and OP1. */
268 static enum tree_code
269 parse_predicate (tree cond
, tree
*op0
, tree
*op1
)
273 if (TREE_CODE (cond
) == SSA_NAME
274 && is_gimple_assign (s
= SSA_NAME_DEF_STMT (cond
)))
276 if (TREE_CODE_CLASS (gimple_assign_rhs_code (s
)) == tcc_comparison
)
278 *op0
= gimple_assign_rhs1 (s
);
279 *op1
= gimple_assign_rhs2 (s
);
280 return gimple_assign_rhs_code (s
);
283 else if (gimple_assign_rhs_code (s
) == TRUTH_NOT_EXPR
)
285 tree op
= gimple_assign_rhs1 (s
);
286 tree type
= TREE_TYPE (op
);
287 enum tree_code code
= parse_predicate (op
, op0
, op1
);
289 return code
== ERROR_MARK
? ERROR_MARK
290 : invert_tree_comparison (code
, HONOR_NANS (TYPE_MODE (type
)));
296 if (TREE_CODE_CLASS (TREE_CODE (cond
)) == tcc_comparison
)
298 *op0
= TREE_OPERAND (cond
, 0);
299 *op1
= TREE_OPERAND (cond
, 1);
300 return TREE_CODE (cond
);
306 /* Returns the fold of predicate C1 OR C2 at location LOC. */
309 fold_or_predicates (location_t loc
, tree c1
, tree c2
)
311 tree op1a
, op1b
, op2a
, op2b
;
312 enum tree_code code1
= parse_predicate (c1
, &op1a
, &op1b
);
313 enum tree_code code2
= parse_predicate (c2
, &op2a
, &op2b
);
315 if (code1
!= ERROR_MARK
&& code2
!= ERROR_MARK
)
317 tree t
= maybe_fold_or_comparisons (code1
, op1a
, op1b
,
323 return fold_build2_loc (loc
, TRUTH_OR_EXPR
, boolean_type_node
, c1
, c2
);
326 /* Add condition NC to the predicate list of basic block BB. */
329 add_to_predicate_list (basic_block bb
, tree nc
)
333 if (is_true_predicate (nc
))
336 if (!is_predicated (bb
))
340 bc
= bb_predicate (bb
);
341 bc
= fold_or_predicates (EXPR_LOCATION (bc
), nc
, bc
);
342 if (is_true_predicate (bc
))
344 reset_bb_predicate (bb
);
349 /* Allow a TRUTH_NOT_EXPR around the main predicate. */
350 if (TREE_CODE (bc
) == TRUTH_NOT_EXPR
)
351 tp
= &TREE_OPERAND (bc
, 0);
354 if (!is_gimple_condexpr (*tp
))
357 *tp
= force_gimple_operand_1 (*tp
, &stmts
, is_gimple_condexpr
, NULL_TREE
);
358 add_bb_predicate_gimplified_stmts (bb
, stmts
);
360 set_bb_predicate (bb
, bc
);
363 /* Add the condition COND to the previous condition PREV_COND, and add
364 this to the predicate list of the destination of edge E. LOOP is
365 the loop to be if-converted. */
368 add_to_dst_predicate_list (struct loop
*loop
, edge e
,
369 tree prev_cond
, tree cond
)
371 if (!flow_bb_inside_loop_p (loop
, e
->dest
))
374 if (!is_true_predicate (prev_cond
))
375 cond
= fold_build2 (TRUTH_AND_EXPR
, boolean_type_node
,
378 add_to_predicate_list (e
->dest
, cond
);
381 /* Return true if one of the successor edges of BB exits LOOP. */
384 bb_with_exit_edge_p (struct loop
*loop
, basic_block bb
)
389 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
390 if (loop_exit_edge_p (loop
, e
))
396 /* Return true when PHI is if-convertible. PHI is part of loop LOOP
397 and it belongs to basic block BB.
399 PHI is not if-convertible if:
400 - it has more than 2 arguments.
402 When the flag_tree_loop_if_convert_stores is not set, PHI is not
404 - a virtual PHI is immediately used in another PHI node,
405 - there is a virtual PHI in a BB other than the loop->header. */
408 if_convertible_phi_p (struct loop
*loop
, basic_block bb
, gimple phi
)
410 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
412 fprintf (dump_file
, "-------------------------\n");
413 print_gimple_stmt (dump_file
, phi
, 0, TDF_SLIM
);
416 if (bb
!= loop
->header
&& gimple_phi_num_args (phi
) != 2)
418 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
419 fprintf (dump_file
, "More than two phi node args.\n");
423 if (flag_tree_loop_if_convert_stores
)
426 /* When the flag_tree_loop_if_convert_stores is not set, check
427 that there are no memory writes in the branches of the loop to be
429 if (!is_gimple_reg (SSA_NAME_VAR (gimple_phi_result (phi
))))
431 imm_use_iterator imm_iter
;
434 if (bb
!= loop
->header
)
436 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
437 fprintf (dump_file
, "Virtual phi not on loop->header.\n");
441 FOR_EACH_IMM_USE_FAST (use_p
, imm_iter
, gimple_phi_result (phi
))
443 if (gimple_code (USE_STMT (use_p
)) == GIMPLE_PHI
)
445 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
446 fprintf (dump_file
, "Difficult to handle this virtual phi.\n");
455 /* Records the status of a data reference. This struct is attached to
456 each DR->aux field. */
459 /* -1 when not initialized, 0 when false, 1 when true. */
460 int written_at_least_once
;
462 /* -1 when not initialized, 0 when false, 1 when true. */
463 int rw_unconditionally
;
466 #define IFC_DR(DR) ((struct ifc_dr *) (DR)->aux)
467 #define DR_WRITTEN_AT_LEAST_ONCE(DR) (IFC_DR (DR)->written_at_least_once)
468 #define DR_RW_UNCONDITIONALLY(DR) (IFC_DR (DR)->rw_unconditionally)
470 /* Returns true when the memory references of STMT are read or written
471 unconditionally. In other words, this function returns true when
472 for every data reference A in STMT there exist other accesses to
473 a data reference with the same base with predicates that add up (OR-up) to
474 the true predicate: this ensures that the data reference A is touched
475 (read or written) on every iteration of the if-converted loop. */
478 memrefs_read_or_written_unconditionally (gimple stmt
,
479 VEC (data_reference_p
, heap
) *drs
)
482 data_reference_p a
, b
;
483 tree ca
= bb_predicate (gimple_bb (stmt
));
485 for (i
= 0; VEC_iterate (data_reference_p
, drs
, i
, a
); i
++)
486 if (DR_STMT (a
) == stmt
)
489 int x
= DR_RW_UNCONDITIONALLY (a
);
497 for (j
= 0; VEC_iterate (data_reference_p
, drs
, j
, b
); j
++)
499 tree ref_base_a
= DR_REF (a
);
500 tree ref_base_b
= DR_REF (b
);
502 if (DR_STMT (b
) == stmt
)
505 while (TREE_CODE (ref_base_a
) == COMPONENT_REF
506 || TREE_CODE (ref_base_a
) == IMAGPART_EXPR
507 || TREE_CODE (ref_base_a
) == REALPART_EXPR
)
508 ref_base_a
= TREE_OPERAND (ref_base_a
, 0);
510 while (TREE_CODE (ref_base_b
) == COMPONENT_REF
511 || TREE_CODE (ref_base_b
) == IMAGPART_EXPR
512 || TREE_CODE (ref_base_b
) == REALPART_EXPR
)
513 ref_base_b
= TREE_OPERAND (ref_base_b
, 0);
515 if (!operand_equal_p (ref_base_a
, ref_base_b
, 0))
517 tree cb
= bb_predicate (gimple_bb (DR_STMT (b
)));
519 if (DR_RW_UNCONDITIONALLY (b
) == 1
520 || is_true_predicate (cb
)
521 || is_true_predicate (ca
522 = fold_or_predicates (EXPR_LOCATION (cb
), ca
, cb
)))
524 DR_RW_UNCONDITIONALLY (a
) = 1;
525 DR_RW_UNCONDITIONALLY (b
) = 1;
534 DR_RW_UNCONDITIONALLY (a
) = 0;
542 /* Returns true when the memory references of STMT are unconditionally
543 written. In other words, this function returns true when for every
544 data reference A written in STMT, there exist other writes to the
545 same data reference with predicates that add up (OR-up) to the true
546 predicate: this ensures that the data reference A is written on
547 every iteration of the if-converted loop. */
550 write_memrefs_written_at_least_once (gimple stmt
,
551 VEC (data_reference_p
, heap
) *drs
)
554 data_reference_p a
, b
;
555 tree ca
= bb_predicate (gimple_bb (stmt
));
557 for (i
= 0; VEC_iterate (data_reference_p
, drs
, i
, a
); i
++)
558 if (DR_STMT (a
) == stmt
562 int x
= DR_WRITTEN_AT_LEAST_ONCE (a
);
570 for (j
= 0; VEC_iterate (data_reference_p
, drs
, j
, b
); j
++)
571 if (DR_STMT (b
) != stmt
573 && same_data_refs_base_objects (a
, b
))
575 tree cb
= bb_predicate (gimple_bb (DR_STMT (b
)));
577 if (DR_WRITTEN_AT_LEAST_ONCE (b
) == 1
578 || is_true_predicate (cb
)
579 || is_true_predicate (ca
= fold_or_predicates (EXPR_LOCATION (cb
),
582 DR_WRITTEN_AT_LEAST_ONCE (a
) = 1;
583 DR_WRITTEN_AT_LEAST_ONCE (b
) = 1;
591 DR_WRITTEN_AT_LEAST_ONCE (a
) = 0;
599 /* Return true when the memory references of STMT won't trap in the
600 if-converted code. There are two things that we have to check for:
602 - writes to memory occur to writable memory: if-conversion of
603 memory writes transforms the conditional memory writes into
604 unconditional writes, i.e. "if (cond) A[i] = foo" is transformed
605 into "A[i] = cond ? foo : A[i]", and as the write to memory may not
606 be executed at all in the original code, it may be a readonly
607 memory. To check that A is not const-qualified, we check that
608 there exists at least an unconditional write to A in the current
611 - reads or writes to memory are valid memory accesses for every
612 iteration. To check that the memory accesses are correctly formed
613 and that we are allowed to read and write in these locations, we
614 check that the memory accesses to be if-converted occur at every
615 iteration unconditionally. */
618 ifcvt_memrefs_wont_trap (gimple stmt
, VEC (data_reference_p
, heap
) *refs
)
620 return write_memrefs_written_at_least_once (stmt
, refs
)
621 && memrefs_read_or_written_unconditionally (stmt
, refs
);
624 /* Wrapper around gimple_could_trap_p refined for the needs of the
625 if-conversion. Try to prove that the memory accesses of STMT could
626 not trap in the innermost loop containing STMT. */
629 ifcvt_could_trap_p (gimple stmt
, VEC (data_reference_p
, heap
) *refs
)
631 if (gimple_vuse (stmt
)
632 && !gimple_could_trap_p_1 (stmt
, false, false)
633 && ifcvt_memrefs_wont_trap (stmt
, refs
))
636 return gimple_could_trap_p (stmt
);
639 /* Return true when STMT is if-convertible.
641 GIMPLE_ASSIGN statement is not if-convertible if,
644 - LHS is not var decl. */
647 if_convertible_gimple_assign_stmt_p (gimple stmt
,
648 VEC (data_reference_p
, heap
) *refs
)
650 tree lhs
= gimple_assign_lhs (stmt
);
653 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
655 fprintf (dump_file
, "-------------------------\n");
656 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
659 if (!is_gimple_reg_type (TREE_TYPE (lhs
)))
662 /* Some of these constrains might be too conservative. */
663 if (stmt_ends_bb_p (stmt
)
664 || gimple_has_volatile_ops (stmt
)
665 || (TREE_CODE (lhs
) == SSA_NAME
666 && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs
))
667 || gimple_has_side_effects (stmt
))
669 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
670 fprintf (dump_file
, "stmt not suitable for ifcvt\n");
674 if (flag_tree_loop_if_convert_stores
)
676 if (ifcvt_could_trap_p (stmt
, refs
))
678 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
679 fprintf (dump_file
, "tree could trap...\n");
685 if (gimple_assign_rhs_could_trap_p (stmt
))
687 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
688 fprintf (dump_file
, "tree could trap...\n");
692 bb
= gimple_bb (stmt
);
694 if (TREE_CODE (lhs
) != SSA_NAME
695 && bb
!= bb
->loop_father
->header
696 && !bb_with_exit_edge_p (bb
->loop_father
, bb
))
698 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
700 fprintf (dump_file
, "LHS is not var\n");
701 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
709 /* Return true when STMT is if-convertible.
711 A statement is if-convertible if:
712 - it is an if-convertible GIMPLE_ASSIGN,
713 - it is a GIMPLE_LABEL or a GIMPLE_COND. */
716 if_convertible_stmt_p (gimple stmt
, VEC (data_reference_p
, heap
) *refs
)
718 switch (gimple_code (stmt
))
726 return if_convertible_gimple_assign_stmt_p (stmt
, refs
);
730 tree fndecl
= gimple_call_fndecl (stmt
);
733 int flags
= gimple_call_flags (stmt
);
734 if ((flags
& ECF_CONST
)
735 && !(flags
& ECF_LOOPING_CONST_OR_PURE
)
736 /* We can only vectorize some builtins at the moment,
737 so restrict if-conversion to those. */
738 && DECL_BUILT_IN (fndecl
))
745 /* Don't know what to do with 'em so don't do anything. */
746 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
748 fprintf (dump_file
, "don't know what to do\n");
749 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
758 /* Return true when BB post-dominates all its predecessors. */
761 bb_postdominates_preds (basic_block bb
)
765 for (i
= 0; i
< EDGE_COUNT (bb
->preds
); i
++)
766 if (!dominated_by_p (CDI_POST_DOMINATORS
, EDGE_PRED (bb
, i
)->src
, bb
))
772 /* Return true when BB is if-convertible. This routine does not check
773 basic block's statements and phis.
775 A basic block is not if-convertible if:
776 - it is non-empty and it is after the exit block (in BFS order),
777 - it is after the exit block but before the latch,
778 - its edges are not normal.
780 EXIT_BB is the basic block containing the exit of the LOOP. BB is
784 if_convertible_bb_p (struct loop
*loop
, basic_block bb
, basic_block exit_bb
)
789 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
790 fprintf (dump_file
, "----------[%d]-------------\n", bb
->index
);
792 if (EDGE_COUNT (bb
->preds
) > 2
793 || EDGE_COUNT (bb
->succs
) > 2)
798 if (bb
!= loop
->latch
)
800 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
801 fprintf (dump_file
, "basic block after exit bb but before latch\n");
804 else if (!empty_block_p (bb
))
806 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
807 fprintf (dump_file
, "non empty basic block after exit bb\n");
810 else if (bb
== loop
->latch
812 && !dominated_by_p (CDI_DOMINATORS
, bb
, exit_bb
))
814 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
815 fprintf (dump_file
, "latch is not dominated by exit_block\n");
820 /* Be less adventurous and handle only normal edges. */
821 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
823 (EDGE_ABNORMAL_CALL
| EDGE_EH
| EDGE_ABNORMAL
| EDGE_IRREDUCIBLE_LOOP
))
825 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
826 fprintf (dump_file
, "Difficult to handle edges\n");
830 if (EDGE_COUNT (bb
->preds
) == 2
831 && bb
!= loop
->header
832 && !bb_postdominates_preds (bb
))
838 /* Return true when all predecessor blocks of BB are visited. The
839 VISITED bitmap keeps track of the visited blocks. */
842 pred_blocks_visited_p (basic_block bb
, bitmap
*visited
)
846 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
847 if (!bitmap_bit_p (*visited
, e
->src
->index
))
853 /* Get body of a LOOP in suitable order for if-conversion. It is
854 caller's responsibility to deallocate basic block list.
855 If-conversion suitable order is, breadth first sort (BFS) order
856 with an additional constraint: select a block only if all its
857 predecessors are already selected. */
860 get_loop_body_in_if_conv_order (const struct loop
*loop
)
862 basic_block
*blocks
, *blocks_in_bfs_order
;
865 unsigned int index
= 0;
866 unsigned int visited_count
= 0;
868 gcc_assert (loop
->num_nodes
);
869 gcc_assert (loop
->latch
!= EXIT_BLOCK_PTR
);
871 blocks
= XCNEWVEC (basic_block
, loop
->num_nodes
);
872 visited
= BITMAP_ALLOC (NULL
);
874 blocks_in_bfs_order
= get_loop_body_in_bfs_order (loop
);
877 while (index
< loop
->num_nodes
)
879 bb
= blocks_in_bfs_order
[index
];
881 if (bb
->flags
& BB_IRREDUCIBLE_LOOP
)
883 free (blocks_in_bfs_order
);
884 BITMAP_FREE (visited
);
889 if (!bitmap_bit_p (visited
, bb
->index
))
891 if (pred_blocks_visited_p (bb
, &visited
)
892 || bb
== loop
->header
)
894 /* This block is now visited. */
895 bitmap_set_bit (visited
, bb
->index
);
896 blocks
[visited_count
++] = bb
;
902 if (index
== loop
->num_nodes
903 && visited_count
!= loop
->num_nodes
)
907 free (blocks_in_bfs_order
);
908 BITMAP_FREE (visited
);
912 /* Returns true when the analysis of the predicates for all the basic
913 blocks in LOOP succeeded.
915 predicate_bbs first allocates the predicates of the basic blocks.
916 These fields are then initialized with the tree expressions
917 representing the predicates under which a basic block is executed
918 in the LOOP. As the loop->header is executed at each iteration, it
919 has the "true" predicate. Other statements executed under a
920 condition are predicated with that condition, for example
927 S1 will be predicated with "x", and
928 S2 will be predicated with "!x". */
931 predicate_bbs (loop_p loop
)
935 for (i
= 0; i
< loop
->num_nodes
; i
++)
936 init_bb_predicate (ifc_bbs
[i
]);
938 for (i
= 0; i
< loop
->num_nodes
; i
++)
940 basic_block bb
= ifc_bbs
[i
];
942 gimple_stmt_iterator itr
;
944 /* The loop latch is always executed and has no extra conditions
945 to be processed: skip it. */
946 if (bb
== loop
->latch
)
948 reset_bb_predicate (loop
->latch
);
952 cond
= bb_predicate (bb
);
954 for (itr
= gsi_start_bb (bb
); !gsi_end_p (itr
); gsi_next (&itr
))
956 gimple stmt
= gsi_stmt (itr
);
958 switch (gimple_code (stmt
))
969 edge true_edge
, false_edge
;
970 location_t loc
= gimple_location (stmt
);
971 tree c
= fold_build2_loc (loc
, gimple_cond_code (stmt
),
973 gimple_cond_lhs (stmt
),
974 gimple_cond_rhs (stmt
));
976 /* Add new condition into destination's predicate list. */
977 extract_true_false_edges_from_block (gimple_bb (stmt
),
978 &true_edge
, &false_edge
);
980 /* If C is true, then TRUE_EDGE is taken. */
981 add_to_dst_predicate_list (loop
, true_edge
,
985 /* If C is false, then FALSE_EDGE is taken. */
986 c2
= build1_loc (loc
, TRUTH_NOT_EXPR
,
987 boolean_type_node
, unshare_expr (c
));
988 add_to_dst_predicate_list (loop
, false_edge
,
989 unshare_expr (cond
), c2
);
996 /* Not handled yet in if-conversion. */
1001 /* If current bb has only one successor, then consider it as an
1002 unconditional goto. */
1003 if (single_succ_p (bb
))
1005 basic_block bb_n
= single_succ (bb
);
1007 /* The successor bb inherits the predicate of its
1008 predecessor. If there is no predicate in the predecessor
1009 bb, then consider the successor bb as always executed. */
1010 if (cond
== NULL_TREE
)
1011 cond
= boolean_true_node
;
1013 add_to_predicate_list (bb_n
, cond
);
1017 /* The loop header is always executed. */
1018 reset_bb_predicate (loop
->header
);
1019 gcc_assert (bb_predicate_gimplified_stmts (loop
->header
) == NULL
1020 && bb_predicate_gimplified_stmts (loop
->latch
) == NULL
);
1025 /* Return true when LOOP is if-convertible. This is a helper function
1026 for if_convertible_loop_p. REFS and DDRS are initialized and freed
1027 in if_convertible_loop_p. */
1030 if_convertible_loop_p_1 (struct loop
*loop
,
1031 VEC (loop_p
, heap
) **loop_nest
,
1032 VEC (data_reference_p
, heap
) **refs
,
1033 VEC (ddr_p
, heap
) **ddrs
)
1037 basic_block exit_bb
= NULL
;
1039 /* Don't if-convert the loop when the data dependences cannot be
1040 computed: the loop won't be vectorized in that case. */
1041 res
= compute_data_dependences_for_loop (loop
, true, loop_nest
, refs
, ddrs
);
1045 calculate_dominance_info (CDI_DOMINATORS
);
1046 calculate_dominance_info (CDI_POST_DOMINATORS
);
1048 /* Allow statements that can be handled during if-conversion. */
1049 ifc_bbs
= get_loop_body_in_if_conv_order (loop
);
1052 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1053 fprintf (dump_file
, "Irreducible loop\n");
1057 for (i
= 0; i
< loop
->num_nodes
; i
++)
1059 basic_block bb
= ifc_bbs
[i
];
1061 if (!if_convertible_bb_p (loop
, bb
, exit_bb
))
1064 if (bb_with_exit_edge_p (loop
, bb
))
1068 res
= predicate_bbs (loop
);
1072 if (flag_tree_loop_if_convert_stores
)
1074 data_reference_p dr
;
1076 for (i
= 0; VEC_iterate (data_reference_p
, *refs
, i
, dr
); i
++)
1078 dr
->aux
= XNEW (struct ifc_dr
);
1079 DR_WRITTEN_AT_LEAST_ONCE (dr
) = -1;
1080 DR_RW_UNCONDITIONALLY (dr
) = -1;
1084 for (i
= 0; i
< loop
->num_nodes
; i
++)
1086 basic_block bb
= ifc_bbs
[i
];
1087 gimple_stmt_iterator itr
;
1089 for (itr
= gsi_start_phis (bb
); !gsi_end_p (itr
); gsi_next (&itr
))
1090 if (!if_convertible_phi_p (loop
, bb
, gsi_stmt (itr
)))
1093 /* Check the if-convertibility of statements in predicated BBs. */
1094 if (is_predicated (bb
))
1095 for (itr
= gsi_start_bb (bb
); !gsi_end_p (itr
); gsi_next (&itr
))
1096 if (!if_convertible_stmt_p (gsi_stmt (itr
), *refs
))
1101 fprintf (dump_file
, "Applying if-conversion\n");
1106 /* Return true when LOOP is if-convertible.
1107 LOOP is if-convertible if:
1109 - it has two or more basic blocks,
1110 - it has only one exit,
1111 - loop header is not the exit edge,
1112 - if its basic blocks and phi nodes are if convertible. */
1115 if_convertible_loop_p (struct loop
*loop
)
1120 VEC (data_reference_p
, heap
) *refs
;
1121 VEC (ddr_p
, heap
) *ddrs
;
1122 VEC (loop_p
, heap
) *loop_nest
;
1124 /* Handle only innermost loop. */
1125 if (!loop
|| loop
->inner
)
1127 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1128 fprintf (dump_file
, "not innermost loop\n");
1132 /* If only one block, no need for if-conversion. */
1133 if (loop
->num_nodes
<= 2)
1135 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1136 fprintf (dump_file
, "less than 2 basic blocks\n");
1140 /* More than one loop exit is too much to handle. */
1141 if (!single_exit (loop
))
1143 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1144 fprintf (dump_file
, "multiple exits\n");
1148 /* If one of the loop header's edge is an exit edge then do not
1149 apply if-conversion. */
1150 FOR_EACH_EDGE (e
, ei
, loop
->header
->succs
)
1151 if (loop_exit_edge_p (loop
, e
))
1154 refs
= VEC_alloc (data_reference_p
, heap
, 5);
1155 ddrs
= VEC_alloc (ddr_p
, heap
, 25);
1156 loop_nest
= VEC_alloc (loop_p
, heap
, 3);
1157 res
= if_convertible_loop_p_1 (loop
, &loop_nest
, &refs
, &ddrs
);
1159 if (flag_tree_loop_if_convert_stores
)
1161 data_reference_p dr
;
1164 for (i
= 0; VEC_iterate (data_reference_p
, refs
, i
, dr
); i
++)
1168 VEC_free (loop_p
, heap
, loop_nest
);
1169 free_data_refs (refs
);
1170 free_dependence_relations (ddrs
);
1174 /* Basic block BB has two predecessors. Using predecessor's bb
1175 predicate, set an appropriate condition COND for the PHI node
1176 replacement. Return the true block whose phi arguments are
1177 selected when cond is true. LOOP is the loop containing the
1178 if-converted region, GSI is the place to insert the code for the
1182 find_phi_replacement_condition (struct loop
*loop
,
1183 basic_block bb
, tree
*cond
,
1184 gimple_stmt_iterator
*gsi
)
1186 edge first_edge
, second_edge
;
1189 gcc_assert (EDGE_COUNT (bb
->preds
) == 2);
1190 first_edge
= EDGE_PRED (bb
, 0);
1191 second_edge
= EDGE_PRED (bb
, 1);
1193 /* Use condition based on following criteria:
1199 S2 is preferred over S1. Make 'b' first_bb and use its condition.
1201 2) Do not make loop header first_bb.
1204 S1: x = !(c == d)? a : b;
1207 S22: x = t1 ? b : a;
1209 S3: x = (c == d) ? b : a;
1211 S3 is preferred over S1 and S2*, Make 'b' first_bb and use
1214 4) If pred B is dominated by pred A then use pred B's condition.
1217 /* Select condition that is not TRUTH_NOT_EXPR. */
1218 tmp_cond
= bb_predicate (first_edge
->src
);
1219 gcc_assert (tmp_cond
);
1221 if (TREE_CODE (tmp_cond
) == TRUTH_NOT_EXPR
)
1225 tmp_edge
= first_edge
;
1226 first_edge
= second_edge
;
1227 second_edge
= tmp_edge
;
1230 /* Check if FIRST_BB is loop header or not and make sure that
1231 FIRST_BB does not dominate SECOND_BB. */
1232 if (first_edge
->src
== loop
->header
1233 || dominated_by_p (CDI_DOMINATORS
,
1234 second_edge
->src
, first_edge
->src
))
1236 *cond
= bb_predicate (second_edge
->src
);
1238 if (TREE_CODE (*cond
) == TRUTH_NOT_EXPR
)
1239 *cond
= TREE_OPERAND (*cond
, 0);
1241 /* Select non loop header bb. */
1242 first_edge
= second_edge
;
1245 *cond
= bb_predicate (first_edge
->src
);
1247 /* Gimplify the condition to a valid cond-expr conditonal operand. */
1248 *cond
= force_gimple_operand_gsi_1 (gsi
, unshare_expr (*cond
),
1249 is_gimple_condexpr
, NULL_TREE
,
1250 true, GSI_SAME_STMT
);
1252 return first_edge
->src
;
1255 /* Replace a scalar PHI node with a COND_EXPR using COND as condition.
1256 This routine does not handle PHI nodes with more than two
1260 S1: A = PHI <x1(1), x2(5)>
1262 S2: A = cond ? x1 : x2;
1264 The generated code is inserted at GSI that points to the top of
1265 basic block's statement list. When COND is true, phi arg from
1266 TRUE_BB is selected. */
1269 predicate_scalar_phi (gimple phi
, tree cond
,
1270 basic_block true_bb
,
1271 gimple_stmt_iterator
*gsi
)
1275 tree rhs
, res
, arg
, scev
;
1277 gcc_assert (gimple_code (phi
) == GIMPLE_PHI
1278 && gimple_phi_num_args (phi
) == 2);
1280 res
= gimple_phi_result (phi
);
1281 /* Do not handle virtual phi nodes. */
1282 if (!is_gimple_reg (SSA_NAME_VAR (res
)))
1285 bb
= gimple_bb (phi
);
1287 if ((arg
= degenerate_phi_result (phi
))
1288 || ((scev
= analyze_scalar_evolution (gimple_bb (phi
)->loop_father
,
1290 && !chrec_contains_undetermined (scev
)
1292 && (arg
= gimple_phi_arg_def (phi
, 0))))
1297 /* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
1298 if (EDGE_PRED (bb
, 1)->src
== true_bb
)
1300 arg_0
= gimple_phi_arg_def (phi
, 1);
1301 arg_1
= gimple_phi_arg_def (phi
, 0);
1305 arg_0
= gimple_phi_arg_def (phi
, 0);
1306 arg_1
= gimple_phi_arg_def (phi
, 1);
1309 gcc_checking_assert (bb
== bb
->loop_father
->header
1310 || bb_postdominates_preds (bb
));
1312 /* Build new RHS using selected condition and arguments. */
1313 rhs
= build3 (COND_EXPR
, TREE_TYPE (res
),
1314 unshare_expr (cond
), arg_0
, arg_1
);
1317 new_stmt
= gimple_build_assign (res
, rhs
);
1318 SSA_NAME_DEF_STMT (gimple_phi_result (phi
)) = new_stmt
;
1319 gsi_insert_before (gsi
, new_stmt
, GSI_SAME_STMT
);
1320 update_stmt (new_stmt
);
1322 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1324 fprintf (dump_file
, "new phi replacement stmt\n");
1325 print_gimple_stmt (dump_file
, new_stmt
, 0, TDF_SLIM
);
1329 /* Replaces in LOOP all the scalar phi nodes other than those in the
1330 LOOP->header block with conditional modify expressions. */
1333 predicate_all_scalar_phis (struct loop
*loop
)
1336 unsigned int orig_loop_num_nodes
= loop
->num_nodes
;
1339 for (i
= 1; i
< orig_loop_num_nodes
; i
++)
1342 tree cond
= NULL_TREE
;
1343 gimple_stmt_iterator gsi
, phi_gsi
;
1344 basic_block true_bb
= NULL
;
1347 if (bb
== loop
->header
)
1350 phi_gsi
= gsi_start_phis (bb
);
1351 if (gsi_end_p (phi_gsi
))
1354 /* BB has two predecessors. Using predecessor's aux field, set
1355 appropriate condition for the PHI node replacement. */
1356 gsi
= gsi_after_labels (bb
);
1357 true_bb
= find_phi_replacement_condition (loop
, bb
, &cond
, &gsi
);
1359 while (!gsi_end_p (phi_gsi
))
1361 phi
= gsi_stmt (phi_gsi
);
1362 predicate_scalar_phi (phi
, cond
, true_bb
, &gsi
);
1363 release_phi_node (phi
);
1364 gsi_next (&phi_gsi
);
1367 set_phi_nodes (bb
, NULL
);
1371 /* Insert in each basic block of LOOP the statements produced by the
1372 gimplification of the predicates. */
1375 insert_gimplified_predicates (loop_p loop
)
1379 for (i
= 0; i
< loop
->num_nodes
; i
++)
1381 basic_block bb
= ifc_bbs
[i
];
1384 if (!is_predicated (bb
))
1386 /* Do not insert statements for a basic block that is not
1387 predicated. Also make sure that the predicate of the
1388 basic block is set to true. */
1389 reset_bb_predicate (bb
);
1393 stmts
= bb_predicate_gimplified_stmts (bb
);
1396 if (flag_tree_loop_if_convert_stores
)
1398 /* Insert the predicate of the BB just after the label,
1399 as the if-conversion of memory writes will use this
1401 gimple_stmt_iterator gsi
= gsi_after_labels (bb
);
1402 gsi_insert_seq_before (&gsi
, stmts
, GSI_SAME_STMT
);
1406 /* Insert the predicate of the BB at the end of the BB
1407 as this would reduce the register pressure: the only
1408 use of this predicate will be in successor BBs. */
1409 gimple_stmt_iterator gsi
= gsi_last_bb (bb
);
1412 || stmt_ends_bb_p (gsi_stmt (gsi
)))
1413 gsi_insert_seq_before (&gsi
, stmts
, GSI_SAME_STMT
);
1415 gsi_insert_seq_after (&gsi
, stmts
, GSI_SAME_STMT
);
1418 /* Once the sequence is code generated, set it to NULL. */
1419 set_bb_predicate_gimplified_stmts (bb
, NULL
);
1424 /* Predicate each write to memory in LOOP.
1426 This function transforms control flow constructs containing memory
1429 | for (i = 0; i < N; i++)
1433 into the following form that does not contain control flow:
1435 | for (i = 0; i < N; i++)
1436 | A[i] = cond ? expr : A[i];
1438 The original CFG looks like this:
1445 | if (i < N) goto bb_5 else goto bb_2
1449 | cond = some_computation;
1450 | if (cond) goto bb_3 else goto bb_4
1462 insert_gimplified_predicates inserts the computation of the COND
1463 expression at the beginning of the destination basic block:
1470 | if (i < N) goto bb_5 else goto bb_2
1474 | cond = some_computation;
1475 | if (cond) goto bb_3 else goto bb_4
1479 | cond = some_computation;
1488 predicate_mem_writes is then predicating the memory write as follows:
1495 | if (i < N) goto bb_5 else goto bb_2
1499 | if (cond) goto bb_3 else goto bb_4
1503 | cond = some_computation;
1504 | A[i] = cond ? expr : A[i];
1512 and finally combine_blocks removes the basic block boundaries making
1513 the loop vectorizable:
1517 | if (i < N) goto bb_5 else goto bb_1
1521 | cond = some_computation;
1522 | A[i] = cond ? expr : A[i];
1523 | if (i < N) goto bb_5 else goto bb_4
1532 predicate_mem_writes (loop_p loop
)
1534 unsigned int i
, orig_loop_num_nodes
= loop
->num_nodes
;
1536 for (i
= 1; i
< orig_loop_num_nodes
; i
++)
1538 gimple_stmt_iterator gsi
;
1539 basic_block bb
= ifc_bbs
[i
];
1540 tree cond
= bb_predicate (bb
);
1544 if (is_true_predicate (cond
))
1548 if (TREE_CODE (cond
) == TRUTH_NOT_EXPR
)
1551 cond
= TREE_OPERAND (cond
, 0);
1554 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1555 if ((stmt
= gsi_stmt (gsi
))
1556 && gimple_assign_single_p (stmt
)
1557 && gimple_vdef (stmt
))
1559 tree lhs
= gimple_assign_lhs (stmt
);
1560 tree rhs
= gimple_assign_rhs1 (stmt
);
1561 tree type
= TREE_TYPE (lhs
);
1563 lhs
= ifc_temp_var (type
, unshare_expr (lhs
), &gsi
);
1564 rhs
= ifc_temp_var (type
, unshare_expr (rhs
), &gsi
);
1571 cond
= force_gimple_operand_gsi_1 (&gsi
, unshare_expr (cond
),
1572 is_gimple_condexpr
, NULL_TREE
,
1573 true, GSI_SAME_STMT
);
1574 rhs
= build3 (COND_EXPR
, type
, unshare_expr (cond
), rhs
, lhs
);
1575 gimple_assign_set_rhs1 (stmt
, ifc_temp_var (type
, rhs
, &gsi
));
1581 /* Remove all GIMPLE_CONDs and GIMPLE_LABELs of all the basic blocks
1582 other than the exit and latch of the LOOP. Also resets the
1583 GIMPLE_DEBUG information. */
1586 remove_conditions_and_labels (loop_p loop
)
1588 gimple_stmt_iterator gsi
;
1591 for (i
= 0; i
< loop
->num_nodes
; i
++)
1593 basic_block bb
= ifc_bbs
[i
];
1595 if (bb_with_exit_edge_p (loop
, bb
)
1596 || bb
== loop
->latch
)
1599 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); )
1600 switch (gimple_code (gsi_stmt (gsi
)))
1604 gsi_remove (&gsi
, true);
1608 /* ??? Should there be conditional GIMPLE_DEBUG_BINDs? */
1609 if (gimple_debug_bind_p (gsi_stmt (gsi
)))
1611 gimple_debug_bind_reset_value (gsi_stmt (gsi
));
1612 update_stmt (gsi_stmt (gsi
));
1623 /* Combine all the basic blocks from LOOP into one or two super basic
1624 blocks. Replace PHI nodes with conditional modify expressions. */
1627 combine_blocks (struct loop
*loop
)
1629 basic_block bb
, exit_bb
, merge_target_bb
;
1630 unsigned int orig_loop_num_nodes
= loop
->num_nodes
;
1635 remove_conditions_and_labels (loop
);
1636 insert_gimplified_predicates (loop
);
1637 predicate_all_scalar_phis (loop
);
1639 if (flag_tree_loop_if_convert_stores
)
1640 predicate_mem_writes (loop
);
1642 /* Merge basic blocks: first remove all the edges in the loop,
1643 except for those from the exit block. */
1645 for (i
= 0; i
< orig_loop_num_nodes
; i
++)
1648 free_bb_predicate (bb
);
1649 if (bb_with_exit_edge_p (loop
, bb
))
1651 gcc_assert (exit_bb
== NULL
);
1655 gcc_assert (exit_bb
!= loop
->latch
);
1657 for (i
= 1; i
< orig_loop_num_nodes
; i
++)
1661 for (ei
= ei_start (bb
->preds
); (e
= ei_safe_edge (ei
));)
1663 if (e
->src
== exit_bb
)
1670 if (exit_bb
!= NULL
)
1672 if (exit_bb
!= loop
->header
)
1674 /* Connect this node to loop header. */
1675 make_edge (loop
->header
, exit_bb
, EDGE_FALLTHRU
);
1676 set_immediate_dominator (CDI_DOMINATORS
, exit_bb
, loop
->header
);
1679 /* Redirect non-exit edges to loop->latch. */
1680 FOR_EACH_EDGE (e
, ei
, exit_bb
->succs
)
1682 if (!loop_exit_edge_p (loop
, e
))
1683 redirect_edge_and_branch (e
, loop
->latch
);
1685 set_immediate_dominator (CDI_DOMINATORS
, loop
->latch
, exit_bb
);
1689 /* If the loop does not have an exit, reconnect header and latch. */
1690 make_edge (loop
->header
, loop
->latch
, EDGE_FALLTHRU
);
1691 set_immediate_dominator (CDI_DOMINATORS
, loop
->latch
, loop
->header
);
1694 merge_target_bb
= loop
->header
;
1695 for (i
= 1; i
< orig_loop_num_nodes
; i
++)
1697 gimple_stmt_iterator gsi
;
1698 gimple_stmt_iterator last
;
1702 if (bb
== exit_bb
|| bb
== loop
->latch
)
1705 /* Make stmts member of loop->header. */
1706 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1707 gimple_set_bb (gsi_stmt (gsi
), merge_target_bb
);
1709 /* Update stmt list. */
1710 last
= gsi_last_bb (merge_target_bb
);
1711 gsi_insert_seq_after (&last
, bb_seq (bb
), GSI_NEW_STMT
);
1712 set_bb_seq (bb
, NULL
);
1714 delete_basic_block (bb
);
1717 /* If possible, merge loop header to the block with the exit edge.
1718 This reduces the number of basic blocks to two, to please the
1719 vectorizer that handles only loops with two nodes. */
1721 && exit_bb
!= loop
->header
1722 && can_merge_blocks_p (loop
->header
, exit_bb
))
1723 merge_blocks (loop
->header
, exit_bb
);
1728 /* Post-dominators are corrupt now. */
1729 free_dominance_info (CDI_POST_DOMINATORS
);
1732 /* If-convert LOOP when it is legal. For the moment this pass has no
1733 profitability analysis. Returns true when something changed. */
1736 tree_if_conversion (struct loop
*loop
)
1738 bool changed
= false;
1741 if (!if_convertible_loop_p (loop
)
1742 || !dbg_cnt (if_conversion_tree
))
1745 /* Now all statements are if-convertible. Combine all the basic
1746 blocks into one huge basic block doing the if-conversion
1748 combine_blocks (loop
);
1750 if (flag_tree_loop_if_convert_stores
)
1751 mark_sym_for_renaming (gimple_vop (cfun
));
1760 for (i
= 0; i
< loop
->num_nodes
; i
++)
1761 free_bb_predicate (ifc_bbs
[i
]);
1770 /* Tree if-conversion pass management. */
1773 main_tree_if_conversion (void)
1777 bool changed
= false;
1780 if (number_of_loops () <= 1)
1783 FOR_EACH_LOOP (li
, loop
, 0)
1784 changed
|= tree_if_conversion (loop
);
1787 todo
|= TODO_cleanup_cfg
;
1789 if (changed
&& flag_tree_loop_if_convert_stores
)
1790 todo
|= TODO_update_ssa_only_virtuals
;
1792 free_dominance_info (CDI_POST_DOMINATORS
);
1794 #ifdef ENABLE_CHECKING
1798 gcc_assert (!bb
->aux
);
1805 /* Returns true when the if-conversion pass is enabled. */
1808 gate_tree_if_conversion (void)
1810 return ((flag_tree_vectorize
&& flag_tree_loop_if_convert
!= 0)
1811 || flag_tree_loop_if_convert
== 1
1812 || flag_tree_loop_if_convert_stores
== 1);
1815 struct gimple_opt_pass pass_if_conversion
=
1820 gate_tree_if_conversion
, /* gate */
1821 main_tree_if_conversion
, /* execute */
1824 0, /* static_pass_number */
1825 TV_NONE
, /* tv_id */
1826 PROP_cfg
| PROP_ssa
, /* properties_required */
1827 0, /* properties_provided */
1828 0, /* properties_destroyed */
1829 0, /* todo_flags_start */
1830 TODO_verify_stmts
| TODO_verify_flow
1831 /* todo_flags_finish */