1 /* Dead code elimination pass for the GNU compiler.
2 Copyright (C) 2002-2013 Free Software Foundation, Inc.
3 Contributed by Ben Elliston <bje@redhat.com>
4 and Andrew MacLeod <amacleod@redhat.com>
5 Adapted to use control dependence by Steven Bosscher, SUSE Labs.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 3, or (at your option) any
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 /* Dead code elimination.
27 Building an Optimizing Compiler,
28 Robert Morgan, Butterworth-Heinemann, 1998, Section 8.9.
30 Advanced Compiler Design and Implementation,
31 Steven Muchnick, Morgan Kaufmann, 1997, Section 18.10.
33 Dead-code elimination is the removal of statements which have no
34 impact on the program's output. "Dead statements" have no impact
35 on the program's output, while "necessary statements" may have
38 The algorithm consists of three phases:
39 1. Marking as necessary all statements known to be necessary,
40 e.g. most function calls, writing a value to memory, etc;
41 2. Propagating necessary statements, e.g., the statements
42 giving values to operands in necessary statements; and
43 3. Removing dead statements. */
47 #include "coretypes.h"
51 #include "gimple-pretty-print.h"
52 #include "basic-block.h"
54 #include "gimple-iterator.h"
55 #include "gimple-ssa.h"
57 #include "tree-phinodes.h"
58 #include "ssa-iterators.h"
59 #include "tree-ssanames.h"
60 #include "tree-ssa-loop-niter.h"
61 #include "tree-into-ssa.h"
63 #include "tree-pass.h"
66 #include "tree-scalar-evolution.h"
68 static struct stmt_stats
76 #define STMT_NECESSARY GF_PLF_1
78 static vec
<gimple
> worklist
;
80 /* Vector indicating an SSA name has already been processed and marked
82 static sbitmap processed
;
84 /* Vector indicating that the last statement of a basic block has already
85 been marked as necessary. */
86 static sbitmap last_stmt_necessary
;
88 /* Vector indicating that BB contains statements that are live. */
89 static sbitmap bb_contains_live_stmts
;
91 /* Before we can determine whether a control branch is dead, we need to
92 compute which blocks are control dependent on which edges.
94 We expect each block to be control dependent on very few edges so we
95 use a bitmap for each block recording its edges. An array holds the
96 bitmap. The Ith bit in the bitmap is set if that block is dependent
98 static control_dependences
*cd
;
100 /* Vector indicating that a basic block has already had all the edges
101 processed that it is control dependent on. */
102 static sbitmap visited_control_parents
;
104 /* TRUE if this pass alters the CFG (by removing control statements).
107 If this pass alters the CFG, then it will arrange for the dominators
109 static bool cfg_altered
;
112 /* If STMT is not already marked necessary, mark it, and add it to the
113 worklist if ADD_TO_WORKLIST is true. */
116 mark_stmt_necessary (gimple stmt
, bool add_to_worklist
)
120 if (gimple_plf (stmt
, STMT_NECESSARY
))
123 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
125 fprintf (dump_file
, "Marking useful stmt: ");
126 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
127 fprintf (dump_file
, "\n");
130 gimple_set_plf (stmt
, STMT_NECESSARY
, true);
132 worklist
.safe_push (stmt
);
133 if (bb_contains_live_stmts
&& !is_gimple_debug (stmt
))
134 bitmap_set_bit (bb_contains_live_stmts
, gimple_bb (stmt
)->index
);
138 /* Mark the statement defining operand OP as necessary. */
141 mark_operand_necessary (tree op
)
148 ver
= SSA_NAME_VERSION (op
);
149 if (bitmap_bit_p (processed
, ver
))
151 stmt
= SSA_NAME_DEF_STMT (op
);
152 gcc_assert (gimple_nop_p (stmt
)
153 || gimple_plf (stmt
, STMT_NECESSARY
));
156 bitmap_set_bit (processed
, ver
);
158 stmt
= SSA_NAME_DEF_STMT (op
);
161 if (gimple_plf (stmt
, STMT_NECESSARY
) || gimple_nop_p (stmt
))
164 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
166 fprintf (dump_file
, "marking necessary through ");
167 print_generic_expr (dump_file
, op
, 0);
168 fprintf (dump_file
, " stmt ");
169 print_gimple_stmt (dump_file
, stmt
, 0, 0);
172 gimple_set_plf (stmt
, STMT_NECESSARY
, true);
173 if (bb_contains_live_stmts
)
174 bitmap_set_bit (bb_contains_live_stmts
, gimple_bb (stmt
)->index
);
175 worklist
.safe_push (stmt
);
179 /* Mark STMT as necessary if it obviously is. Add it to the worklist if
180 it can make other statements necessary.
182 If AGGRESSIVE is false, control statements are conservatively marked as
186 mark_stmt_if_obviously_necessary (gimple stmt
, bool aggressive
)
188 /* With non-call exceptions, we have to assume that all statements could
189 throw. If a statement could throw, it can be deemed necessary. */
190 if (cfun
->can_throw_non_call_exceptions
191 && !cfun
->can_delete_dead_exceptions
192 && stmt_could_throw_p (stmt
))
194 mark_stmt_necessary (stmt
, true);
198 /* Statements that are implicitly live. Most function calls, asm
199 and return statements are required. Labels and GIMPLE_BIND nodes
200 are kept because they are control flow, and we have no way of
201 knowing whether they can be removed. DCE can eliminate all the
202 other statements in a block, and CFG can then remove the block
204 switch (gimple_code (stmt
))
208 mark_stmt_necessary (stmt
, false);
214 mark_stmt_necessary (stmt
, true);
219 tree callee
= gimple_call_fndecl (stmt
);
220 if (callee
!= NULL_TREE
221 && DECL_BUILT_IN_CLASS (callee
) == BUILT_IN_NORMAL
)
222 switch (DECL_FUNCTION_CODE (callee
))
224 case BUILT_IN_MALLOC
:
225 case BUILT_IN_CALLOC
:
226 case BUILT_IN_ALLOCA
:
227 case BUILT_IN_ALLOCA_WITH_ALIGN
:
232 /* Most, but not all function calls are required. Function calls that
233 produce no result and have no side effects (i.e. const pure
234 functions) are unnecessary. */
235 if (gimple_has_side_effects (stmt
))
237 mark_stmt_necessary (stmt
, true);
240 if (!gimple_call_lhs (stmt
))
246 /* Debug temps without a value are not useful. ??? If we could
247 easily locate the debug temp bind stmt for a use thereof,
248 would could refrain from marking all debug temps here, and
249 mark them only if they're used. */
250 if (!gimple_debug_bind_p (stmt
)
251 || gimple_debug_bind_has_value_p (stmt
)
252 || TREE_CODE (gimple_debug_bind_get_var (stmt
)) != DEBUG_EXPR_DECL
)
253 mark_stmt_necessary (stmt
, false);
257 gcc_assert (!simple_goto_p (stmt
));
258 mark_stmt_necessary (stmt
, true);
262 gcc_assert (EDGE_COUNT (gimple_bb (stmt
)->succs
) == 2);
267 mark_stmt_necessary (stmt
, true);
271 if (TREE_CODE (gimple_assign_lhs (stmt
)) == SSA_NAME
272 && TREE_CLOBBER_P (gimple_assign_rhs1 (stmt
)))
280 /* If the statement has volatile operands, it needs to be preserved.
281 Same for statements that can alter control flow in unpredictable
283 if (gimple_has_volatile_ops (stmt
) || is_ctrl_altering_stmt (stmt
))
285 mark_stmt_necessary (stmt
, true);
289 if (stmt_may_clobber_global_p (stmt
))
291 mark_stmt_necessary (stmt
, true);
299 /* Mark the last statement of BB as necessary. */
302 mark_last_stmt_necessary (basic_block bb
)
304 gimple stmt
= last_stmt (bb
);
306 bitmap_set_bit (last_stmt_necessary
, bb
->index
);
307 bitmap_set_bit (bb_contains_live_stmts
, bb
->index
);
309 /* We actually mark the statement only if it is a control statement. */
310 if (stmt
&& is_ctrl_stmt (stmt
))
311 mark_stmt_necessary (stmt
, true);
315 /* Mark control dependent edges of BB as necessary. We have to do this only
316 once for each basic block so we set the appropriate bit after we're done.
318 When IGNORE_SELF is true, ignore BB in the list of control dependences. */
321 mark_control_dependent_edges_necessary (basic_block bb
, bool ignore_self
)
324 unsigned edge_number
;
325 bool skipped
= false;
327 gcc_assert (bb
!= EXIT_BLOCK_PTR
);
329 if (bb
== ENTRY_BLOCK_PTR
)
332 EXECUTE_IF_SET_IN_BITMAP (cd
->get_edges_dependent_on (bb
->index
),
335 basic_block cd_bb
= cd
->get_edge (edge_number
)->src
;
337 if (ignore_self
&& cd_bb
== bb
)
343 if (!bitmap_bit_p (last_stmt_necessary
, cd_bb
->index
))
344 mark_last_stmt_necessary (cd_bb
);
348 bitmap_set_bit (visited_control_parents
, bb
->index
);
352 /* Find obviously necessary statements. These are things like most function
353 calls, and stores to file level variables.
355 If EL is NULL, control statements are conservatively marked as
356 necessary. Otherwise it contains the list of edges used by control
357 dependence analysis. */
360 find_obviously_necessary_stmts (bool aggressive
)
363 gimple_stmt_iterator gsi
;
370 /* PHI nodes are never inherently necessary. */
371 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
373 phi
= gsi_stmt (gsi
);
374 gimple_set_plf (phi
, STMT_NECESSARY
, false);
377 /* Check all statements in the block. */
378 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
380 stmt
= gsi_stmt (gsi
);
381 gimple_set_plf (stmt
, STMT_NECESSARY
, false);
382 mark_stmt_if_obviously_necessary (stmt
, aggressive
);
386 /* Pure and const functions are finite and thus have no infinite loops in
388 flags
= flags_from_decl_or_type (current_function_decl
);
389 if ((flags
& (ECF_CONST
|ECF_PURE
)) && !(flags
& ECF_LOOPING_CONST_OR_PURE
))
392 /* Prevent the empty possibly infinite loops from being removed. */
398 if (mark_irreducible_loops ())
402 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
403 if ((e
->flags
& EDGE_DFS_BACK
)
404 && (e
->flags
& EDGE_IRREDUCIBLE_LOOP
))
407 fprintf (dump_file
, "Marking back edge of irreducible loop %i->%i\n",
408 e
->src
->index
, e
->dest
->index
);
409 mark_control_dependent_edges_necessary (e
->dest
, false);
413 FOR_EACH_LOOP (li
, loop
, 0)
414 if (!finite_loop_p (loop
))
417 fprintf (dump_file
, "can not prove finiteness of loop %i\n", loop
->num
);
418 mark_control_dependent_edges_necessary (loop
->latch
, false);
425 /* Return true if REF is based on an aliased base, otherwise false. */
428 ref_may_be_aliased (tree ref
)
430 gcc_assert (TREE_CODE (ref
) != WITH_SIZE_EXPR
);
431 while (handled_component_p (ref
))
432 ref
= TREE_OPERAND (ref
, 0);
433 if (TREE_CODE (ref
) == MEM_REF
434 && TREE_CODE (TREE_OPERAND (ref
, 0)) == ADDR_EXPR
)
435 ref
= TREE_OPERAND (TREE_OPERAND (ref
, 0), 0);
436 return !(DECL_P (ref
)
437 && !may_be_aliased (ref
));
440 static bitmap visited
= NULL
;
441 static unsigned int longest_chain
= 0;
442 static unsigned int total_chain
= 0;
443 static unsigned int nr_walks
= 0;
444 static bool chain_ovfl
= false;
446 /* Worker for the walker that marks reaching definitions of REF,
447 which is based on a non-aliased decl, necessary. It returns
448 true whenever the defining statement of the current VDEF is
449 a kill for REF, as no dominating may-defs are necessary for REF
450 anymore. DATA points to the basic-block that contains the
451 stmt that refers to REF. */
454 mark_aliased_reaching_defs_necessary_1 (ao_ref
*ref
, tree vdef
, void *data
)
456 gimple def_stmt
= SSA_NAME_DEF_STMT (vdef
);
458 /* All stmts we visit are necessary. */
459 mark_operand_necessary (vdef
);
461 /* If the stmt lhs kills ref, then we can stop walking. */
462 if (gimple_has_lhs (def_stmt
)
463 && TREE_CODE (gimple_get_lhs (def_stmt
)) != SSA_NAME
464 /* The assignment is not necessarily carried out if it can throw
465 and we can catch it in the current function where we could inspect
467 ??? We only need to care about the RHS throwing. For aggregate
468 assignments or similar calls and non-call exceptions the LHS
469 might throw as well. */
470 && !stmt_can_throw_internal (def_stmt
))
472 tree base
, lhs
= gimple_get_lhs (def_stmt
);
473 HOST_WIDE_INT size
, offset
, max_size
;
475 base
= get_ref_base_and_extent (lhs
, &offset
, &size
, &max_size
);
476 /* We can get MEM[symbol: sZ, index: D.8862_1] here,
477 so base == refd->base does not always hold. */
478 if (base
== ref
->base
)
480 /* For a must-alias check we need to be able to constrain
481 the accesses properly. */
482 if (size
!= -1 && size
== max_size
483 && ref
->max_size
!= -1)
485 if (offset
<= ref
->offset
486 && offset
+ size
>= ref
->offset
+ ref
->max_size
)
489 /* Or they need to be exactly the same. */
491 /* Make sure there is no induction variable involved
492 in the references (gcc.c-torture/execute/pr42142.c).
493 The simplest way is to check if the kill dominates
495 /* But when both are in the same block we cannot
496 easily tell whether we came from a backedge
497 unless we decide to compute stmt UIDs
499 && (basic_block
) data
!= gimple_bb (def_stmt
)
500 && dominated_by_p (CDI_DOMINATORS
, (basic_block
) data
,
501 gimple_bb (def_stmt
))
502 && operand_equal_p (ref
->ref
, lhs
, 0))
507 /* Otherwise keep walking. */
512 mark_aliased_reaching_defs_necessary (gimple stmt
, tree ref
)
516 gcc_assert (!chain_ovfl
);
517 ao_ref_init (&refd
, ref
);
518 chain
= walk_aliased_vdefs (&refd
, gimple_vuse (stmt
),
519 mark_aliased_reaching_defs_necessary_1
,
520 gimple_bb (stmt
), NULL
);
521 if (chain
> longest_chain
)
522 longest_chain
= chain
;
523 total_chain
+= chain
;
527 /* Worker for the walker that marks reaching definitions of REF, which
528 is not based on a non-aliased decl. For simplicity we need to end
529 up marking all may-defs necessary that are not based on a non-aliased
530 decl. The only job of this walker is to skip may-defs based on
531 a non-aliased decl. */
534 mark_all_reaching_defs_necessary_1 (ao_ref
*ref ATTRIBUTE_UNUSED
,
535 tree vdef
, void *data ATTRIBUTE_UNUSED
)
537 gimple def_stmt
= SSA_NAME_DEF_STMT (vdef
);
539 /* We have to skip already visited (and thus necessary) statements
540 to make the chaining work after we dropped back to simple mode. */
542 && bitmap_bit_p (processed
, SSA_NAME_VERSION (vdef
)))
544 gcc_assert (gimple_nop_p (def_stmt
)
545 || gimple_plf (def_stmt
, STMT_NECESSARY
));
549 /* We want to skip stores to non-aliased variables. */
551 && gimple_assign_single_p (def_stmt
))
553 tree lhs
= gimple_assign_lhs (def_stmt
);
554 if (!ref_may_be_aliased (lhs
))
558 /* We want to skip statments that do not constitute stores but have
559 a virtual definition. */
560 if (is_gimple_call (def_stmt
))
562 tree callee
= gimple_call_fndecl (def_stmt
);
563 if (callee
!= NULL_TREE
564 && DECL_BUILT_IN_CLASS (callee
) == BUILT_IN_NORMAL
)
565 switch (DECL_FUNCTION_CODE (callee
))
567 case BUILT_IN_MALLOC
:
568 case BUILT_IN_CALLOC
:
569 case BUILT_IN_ALLOCA
:
570 case BUILT_IN_ALLOCA_WITH_ALIGN
:
578 mark_operand_necessary (vdef
);
584 mark_all_reaching_defs_necessary (gimple stmt
)
586 walk_aliased_vdefs (NULL
, gimple_vuse (stmt
),
587 mark_all_reaching_defs_necessary_1
, NULL
, &visited
);
590 /* Return true for PHI nodes with one or identical arguments
593 degenerate_phi_p (gimple phi
)
596 tree op
= gimple_phi_arg_def (phi
, 0);
597 for (i
= 1; i
< gimple_phi_num_args (phi
); i
++)
598 if (gimple_phi_arg_def (phi
, i
) != op
)
603 /* Propagate necessity using the operands of necessary statements.
604 Process the uses on each statement in the worklist, and add all
605 feeding statements which contribute to the calculation of this
606 value to the worklist.
608 In conservative mode, EL is NULL. */
611 propagate_necessity (bool aggressive
)
615 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
616 fprintf (dump_file
, "\nProcessing worklist:\n");
618 while (worklist
.length () > 0)
620 /* Take STMT from worklist. */
621 stmt
= worklist
.pop ();
623 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
625 fprintf (dump_file
, "processing: ");
626 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
627 fprintf (dump_file
, "\n");
632 /* Mark the last statement of the basic blocks on which the block
633 containing STMT is control dependent, but only if we haven't
635 basic_block bb
= gimple_bb (stmt
);
636 if (bb
!= ENTRY_BLOCK_PTR
637 && !bitmap_bit_p (visited_control_parents
, bb
->index
))
638 mark_control_dependent_edges_necessary (bb
, false);
641 if (gimple_code (stmt
) == GIMPLE_PHI
642 /* We do not process virtual PHI nodes nor do we track their
644 && !virtual_operand_p (gimple_phi_result (stmt
)))
646 /* PHI nodes are somewhat special in that each PHI alternative has
647 data and control dependencies. All the statements feeding the
648 PHI node's arguments are always necessary. In aggressive mode,
649 we also consider the control dependent edges leading to the
650 predecessor block associated with each PHI alternative as
654 for (k
= 0; k
< gimple_phi_num_args (stmt
); k
++)
656 tree arg
= PHI_ARG_DEF (stmt
, k
);
657 if (TREE_CODE (arg
) == SSA_NAME
)
658 mark_operand_necessary (arg
);
661 /* For PHI operands it matters from where the control flow arrives
662 to the BB. Consider the following example:
672 We need to mark control dependence of the empty basic blocks, since they
673 contains computation of PHI operands.
675 Doing so is too restrictive in the case the predecestor block is in
681 for (i = 0; i<1000; ++i)
687 There is PHI for J in the BB containing return statement.
688 In this case the control dependence of predecestor block (that is
689 within the empty loop) also contains the block determining number
690 of iterations of the block that would prevent removing of empty
693 This scenario can be avoided by splitting critical edges.
694 To save the critical edge splitting pass we identify how the control
695 dependence would look like if the edge was split.
697 Consider the modified CFG created from current CFG by splitting
698 edge B->C. In the postdominance tree of modified CFG, C' is
699 always child of C. There are two cases how chlids of C' can look
704 In this case the only basic block C' is control dependent on is B.
706 2) C' has single child that is B
708 In this case control dependence of C' is same as control
709 dependence of B in original CFG except for block B itself.
710 (since C' postdominate B in modified CFG)
712 Now how to decide what case happens? There are two basic options:
714 a) C postdominate B. Then C immediately postdominate B and
715 case 2 happens iff there is no other way from B to C except
718 There is other way from B to C iff there is succesor of B that
719 is not postdominated by B. Testing this condition is somewhat
720 expensive, because we need to iterate all succesors of B.
721 We are safe to assume that this does not happen: we will mark B
722 as needed when processing the other path from B to C that is
723 conrol dependent on B and marking control dependencies of B
724 itself is harmless because they will be processed anyway after
725 processing control statement in B.
727 b) C does not postdominate B. Always case 1 happens since there is
728 path from C to exit that does not go through B and thus also C'. */
730 if (aggressive
&& !degenerate_phi_p (stmt
))
732 for (k
= 0; k
< gimple_phi_num_args (stmt
); k
++)
734 basic_block arg_bb
= gimple_phi_arg_edge (stmt
, k
)->src
;
737 != get_immediate_dominator (CDI_POST_DOMINATORS
, arg_bb
))
739 if (!bitmap_bit_p (last_stmt_necessary
, arg_bb
->index
))
740 mark_last_stmt_necessary (arg_bb
);
742 else if (arg_bb
!= ENTRY_BLOCK_PTR
743 && !bitmap_bit_p (visited_control_parents
,
745 mark_control_dependent_edges_necessary (arg_bb
, true);
751 /* Propagate through the operands. Examine all the USE, VUSE and
752 VDEF operands in this statement. Mark all the statements
753 which feed this statement's uses as necessary. */
757 /* If this is a call to free which is directly fed by an
758 allocation function do not mark that necessary through
759 processing the argument. */
760 if (gimple_call_builtin_p (stmt
, BUILT_IN_FREE
))
762 tree ptr
= gimple_call_arg (stmt
, 0);
765 /* If the pointer we free is defined by an allocation
766 function do not add the call to the worklist. */
767 if (TREE_CODE (ptr
) == SSA_NAME
768 && is_gimple_call (def_stmt
= SSA_NAME_DEF_STMT (ptr
))
769 && (def_callee
= gimple_call_fndecl (def_stmt
))
770 && DECL_BUILT_IN_CLASS (def_callee
) == BUILT_IN_NORMAL
771 && (DECL_FUNCTION_CODE (def_callee
) == BUILT_IN_MALLOC
772 || DECL_FUNCTION_CODE (def_callee
) == BUILT_IN_CALLOC
))
776 FOR_EACH_SSA_TREE_OPERAND (use
, stmt
, iter
, SSA_OP_USE
)
777 mark_operand_necessary (use
);
779 use
= gimple_vuse (stmt
);
783 /* If we dropped to simple mode make all immediately
784 reachable definitions necessary. */
787 mark_all_reaching_defs_necessary (stmt
);
791 /* For statements that may load from memory (have a VUSE) we
792 have to mark all reaching (may-)definitions as necessary.
793 We partition this task into two cases:
794 1) explicit loads based on decls that are not aliased
795 2) implicit loads (like calls) and explicit loads not
796 based on decls that are not aliased (like indirect
797 references or loads from globals)
798 For 1) we mark all reaching may-defs as necessary, stopping
799 at dominating kills. For 2) we want to mark all dominating
800 references necessary, but non-aliased ones which we handle
801 in 1). By keeping a global visited bitmap for references
802 we walk for 2) we avoid quadratic behavior for those. */
804 if (is_gimple_call (stmt
))
806 tree callee
= gimple_call_fndecl (stmt
);
809 /* Calls to functions that are merely acting as barriers
810 or that only store to memory do not make any previous
812 if (callee
!= NULL_TREE
813 && DECL_BUILT_IN_CLASS (callee
) == BUILT_IN_NORMAL
814 && (DECL_FUNCTION_CODE (callee
) == BUILT_IN_MEMSET
815 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_MEMSET_CHK
816 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_MALLOC
817 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_CALLOC
818 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_FREE
819 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_VA_END
820 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_ALLOCA
821 || (DECL_FUNCTION_CODE (callee
)
822 == BUILT_IN_ALLOCA_WITH_ALIGN
)
823 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_STACK_SAVE
824 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_STACK_RESTORE
825 || DECL_FUNCTION_CODE (callee
) == BUILT_IN_ASSUME_ALIGNED
))
828 /* Calls implicitly load from memory, their arguments
829 in addition may explicitly perform memory loads. */
830 mark_all_reaching_defs_necessary (stmt
);
831 for (i
= 0; i
< gimple_call_num_args (stmt
); ++i
)
833 tree arg
= gimple_call_arg (stmt
, i
);
834 if (TREE_CODE (arg
) == SSA_NAME
835 || is_gimple_min_invariant (arg
))
837 if (TREE_CODE (arg
) == WITH_SIZE_EXPR
)
838 arg
= TREE_OPERAND (arg
, 0);
839 if (!ref_may_be_aliased (arg
))
840 mark_aliased_reaching_defs_necessary (stmt
, arg
);
843 else if (gimple_assign_single_p (stmt
))
846 /* If this is a load mark things necessary. */
847 rhs
= gimple_assign_rhs1 (stmt
);
848 if (TREE_CODE (rhs
) != SSA_NAME
849 && !is_gimple_min_invariant (rhs
)
850 && TREE_CODE (rhs
) != CONSTRUCTOR
)
852 if (!ref_may_be_aliased (rhs
))
853 mark_aliased_reaching_defs_necessary (stmt
, rhs
);
855 mark_all_reaching_defs_necessary (stmt
);
858 else if (gimple_code (stmt
) == GIMPLE_RETURN
)
860 tree rhs
= gimple_return_retval (stmt
);
861 /* A return statement may perform a load. */
863 && TREE_CODE (rhs
) != SSA_NAME
864 && !is_gimple_min_invariant (rhs
)
865 && TREE_CODE (rhs
) != CONSTRUCTOR
)
867 if (!ref_may_be_aliased (rhs
))
868 mark_aliased_reaching_defs_necessary (stmt
, rhs
);
870 mark_all_reaching_defs_necessary (stmt
);
873 else if (gimple_code (stmt
) == GIMPLE_ASM
)
876 mark_all_reaching_defs_necessary (stmt
);
877 /* Inputs may perform loads. */
878 for (i
= 0; i
< gimple_asm_ninputs (stmt
); ++i
)
880 tree op
= TREE_VALUE (gimple_asm_input_op (stmt
, i
));
881 if (TREE_CODE (op
) != SSA_NAME
882 && !is_gimple_min_invariant (op
)
883 && TREE_CODE (op
) != CONSTRUCTOR
884 && !ref_may_be_aliased (op
))
885 mark_aliased_reaching_defs_necessary (stmt
, op
);
888 else if (gimple_code (stmt
) == GIMPLE_TRANSACTION
)
890 /* The beginning of a transaction is a memory barrier. */
891 /* ??? If we were really cool, we'd only be a barrier
892 for the memories touched within the transaction. */
893 mark_all_reaching_defs_necessary (stmt
);
898 /* If we over-used our alias oracle budget drop to simple
899 mode. The cost metric allows quadratic behavior
900 (number of uses times number of may-defs queries) up to
901 a constant maximal number of queries and after that falls back to
902 super-linear complexity. */
903 if (/* Constant but quadratic for small functions. */
904 total_chain
> 128 * 128
905 /* Linear in the number of may-defs. */
906 && total_chain
> 32 * longest_chain
907 /* Linear in the number of uses. */
908 && total_chain
> nr_walks
* 32)
912 bitmap_clear (visited
);
918 /* Remove dead PHI nodes from block BB. */
921 remove_dead_phis (basic_block bb
)
923 bool something_changed
= false;
925 gimple_stmt_iterator gsi
;
927 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);)
930 phi
= gsi_stmt (gsi
);
932 /* We do not track necessity of virtual PHI nodes. Instead do
933 very simple dead PHI removal here. */
934 if (virtual_operand_p (gimple_phi_result (phi
)))
936 /* Virtual PHI nodes with one or identical arguments
938 if (degenerate_phi_p (phi
))
940 tree vdef
= gimple_phi_result (phi
);
941 tree vuse
= gimple_phi_arg_def (phi
, 0);
944 imm_use_iterator iter
;
946 FOR_EACH_IMM_USE_STMT (use_stmt
, iter
, vdef
)
947 FOR_EACH_IMM_USE_ON_STMT (use_p
, iter
)
948 SET_USE (use_p
, vuse
);
949 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vdef
)
950 && TREE_CODE (vuse
) == SSA_NAME
)
951 SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vuse
) = 1;
954 gimple_set_plf (phi
, STMT_NECESSARY
, true);
957 if (!gimple_plf (phi
, STMT_NECESSARY
))
959 something_changed
= true;
960 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
962 fprintf (dump_file
, "Deleting : ");
963 print_gimple_stmt (dump_file
, phi
, 0, TDF_SLIM
);
964 fprintf (dump_file
, "\n");
967 remove_phi_node (&gsi
, true);
968 stats
.removed_phis
++;
974 return something_changed
;
977 /* Forward edge E to respective POST_DOM_BB and update PHIs. */
980 forward_edge_to_pdom (edge e
, basic_block post_dom_bb
)
982 gimple_stmt_iterator gsi
;
986 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
987 fprintf (dump_file
, "Redirecting edge %i->%i to %i\n", e
->src
->index
,
988 e
->dest
->index
, post_dom_bb
->index
);
990 e2
= redirect_edge_and_branch (e
, post_dom_bb
);
993 /* If edge was already around, no updating is necessary. */
997 if (!gimple_seq_empty_p (phi_nodes (post_dom_bb
)))
999 /* We are sure that for every live PHI we are seeing control dependent BB.
1000 This means that we can pick any edge to duplicate PHI args from. */
1001 FOR_EACH_EDGE (e2
, ei
, post_dom_bb
->preds
)
1004 for (gsi
= gsi_start_phis (post_dom_bb
); !gsi_end_p (gsi
);)
1006 gimple phi
= gsi_stmt (gsi
);
1008 source_location locus
;
1010 /* PHIs for virtuals have no control dependency relation on them.
1011 We are lost here and must force renaming of the symbol. */
1012 if (virtual_operand_p (gimple_phi_result (phi
)))
1014 mark_virtual_phi_result_for_renaming (phi
);
1015 remove_phi_node (&gsi
, true);
1019 /* Dead PHI do not imply control dependency. */
1020 if (!gimple_plf (phi
, STMT_NECESSARY
))
1026 op
= gimple_phi_arg_def (phi
, e2
->dest_idx
);
1027 locus
= gimple_phi_arg_location (phi
, e2
->dest_idx
);
1028 add_phi_arg (phi
, op
, e
, locus
);
1029 /* The resulting PHI if not dead can only be degenerate. */
1030 gcc_assert (degenerate_phi_p (phi
));
1037 /* Remove dead statement pointed to by iterator I. Receives the basic block BB
1038 containing I so that we don't have to look it up. */
1041 remove_dead_stmt (gimple_stmt_iterator
*i
, basic_block bb
)
1043 gimple stmt
= gsi_stmt (*i
);
1045 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1047 fprintf (dump_file
, "Deleting : ");
1048 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
1049 fprintf (dump_file
, "\n");
1054 /* If we have determined that a conditional branch statement contributes
1055 nothing to the program, then we not only remove it, but we also change
1056 the flow graph so that the current block will simply fall-thru to its
1057 immediate post-dominator. The blocks we are circumventing will be
1058 removed by cleanup_tree_cfg if this change in the flow graph makes them
1060 if (is_ctrl_stmt (stmt
))
1062 basic_block post_dom_bb
;
1066 post_dom_bb
= get_immediate_dominator (CDI_POST_DOMINATORS
, bb
);
1068 e
= find_edge (bb
, post_dom_bb
);
1070 /* If edge is already there, try to use it. This avoids need to update
1071 PHI nodes. Also watch for cases where post dominator does not exists
1072 or is exit block. These can happen for infinite loops as we create
1073 fake edges in the dominator tree. */
1076 else if (! post_dom_bb
|| post_dom_bb
== EXIT_BLOCK_PTR
)
1077 e
= EDGE_SUCC (bb
, 0);
1079 e
= forward_edge_to_pdom (EDGE_SUCC (bb
, 0), post_dom_bb
);
1081 e
->probability
= REG_BR_PROB_BASE
;
1082 e
->count
= bb
->count
;
1084 /* The edge is no longer associated with a conditional, so it does
1085 not have TRUE/FALSE flags. */
1086 e
->flags
&= ~(EDGE_TRUE_VALUE
| EDGE_FALSE_VALUE
);
1088 /* The lone outgoing edge from BB will be a fallthru edge. */
1089 e
->flags
|= EDGE_FALLTHRU
;
1091 /* Remove the remaining outgoing edges. */
1092 for (ei
= ei_start (bb
->succs
); (e2
= ei_safe_edge (ei
)); )
1102 /* If this is a store into a variable that is being optimized away,
1103 add a debug bind stmt if possible. */
1104 if (MAY_HAVE_DEBUG_STMTS
1105 && gimple_assign_single_p (stmt
)
1106 && is_gimple_val (gimple_assign_rhs1 (stmt
)))
1108 tree lhs
= gimple_assign_lhs (stmt
);
1109 if ((TREE_CODE (lhs
) == VAR_DECL
|| TREE_CODE (lhs
) == PARM_DECL
)
1110 && !DECL_IGNORED_P (lhs
)
1111 && is_gimple_reg_type (TREE_TYPE (lhs
))
1112 && !is_global_var (lhs
)
1113 && !DECL_HAS_VALUE_EXPR_P (lhs
))
1115 tree rhs
= gimple_assign_rhs1 (stmt
);
1117 = gimple_build_debug_bind (lhs
, unshare_expr (rhs
), stmt
);
1118 gsi_insert_after (i
, note
, GSI_SAME_STMT
);
1122 unlink_stmt_vdef (stmt
);
1123 gsi_remove (i
, true);
1124 release_defs (stmt
);
1127 /* Eliminate unnecessary statements. Any instruction not marked as necessary
1128 contributes nothing to the program, and can be deleted. */
1131 eliminate_unnecessary_stmts (void)
1133 bool something_changed
= false;
1135 gimple_stmt_iterator gsi
, psi
;
1140 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1141 fprintf (dump_file
, "\nEliminating unnecessary statements:\n");
1143 clear_special_calls ();
1145 /* Walking basic blocks and statements in reverse order avoids
1146 releasing SSA names before any other DEFs that refer to them are
1147 released. This helps avoid loss of debug information, as we get
1148 a chance to propagate all RHSs of removed SSAs into debug uses,
1149 rather than only the latest ones. E.g., consider:
1155 If we were to release x_3 before a_5, when we reached a_5 and
1156 tried to substitute it into the debug stmt, we'd see x_3 there,
1157 but x_3's DEF, type, etc would have already been disconnected.
1158 By going backwards, the debug stmt first changes to:
1160 # DEBUG a => x_3 - b_4
1164 # DEBUG a => y_1 + z_2 - b_4
1167 gcc_assert (dom_info_available_p (CDI_DOMINATORS
));
1168 h
= get_all_dominated_blocks (CDI_DOMINATORS
, single_succ (ENTRY_BLOCK_PTR
));
1174 /* Remove dead statements. */
1175 for (gsi
= gsi_last_bb (bb
); !gsi_end_p (gsi
); gsi
= psi
)
1177 stmt
= gsi_stmt (gsi
);
1184 /* We can mark a call to free as not necessary if the
1185 defining statement of its argument is an allocation
1186 function and that is not necessary itself. */
1187 if (gimple_call_builtin_p (stmt
, BUILT_IN_FREE
))
1189 tree ptr
= gimple_call_arg (stmt
, 0);
1192 if (TREE_CODE (ptr
) != SSA_NAME
)
1194 def_stmt
= SSA_NAME_DEF_STMT (ptr
);
1195 if (!is_gimple_call (def_stmt
)
1196 || gimple_plf (def_stmt
, STMT_NECESSARY
))
1198 callee2
= gimple_call_fndecl (def_stmt
);
1199 if (callee2
== NULL_TREE
1200 || DECL_BUILT_IN_CLASS (callee2
) != BUILT_IN_NORMAL
1201 || (DECL_FUNCTION_CODE (callee2
) != BUILT_IN_MALLOC
1202 && DECL_FUNCTION_CODE (callee2
) != BUILT_IN_CALLOC
))
1204 gimple_set_plf (stmt
, STMT_NECESSARY
, false);
1207 /* If GSI is not necessary then remove it. */
1208 if (!gimple_plf (stmt
, STMT_NECESSARY
))
1210 if (!is_gimple_debug (stmt
))
1211 something_changed
= true;
1212 remove_dead_stmt (&gsi
, bb
);
1214 else if (is_gimple_call (stmt
))
1216 tree name
= gimple_call_lhs (stmt
);
1218 notice_special_calls (stmt
);
1220 /* When LHS of var = call (); is dead, simplify it into
1221 call (); saving one operand. */
1223 && TREE_CODE (name
) == SSA_NAME
1224 && !bitmap_bit_p (processed
, SSA_NAME_VERSION (name
))
1225 /* Avoid doing so for allocation calls which we
1226 did not mark as necessary, it will confuse the
1227 special logic we apply to malloc/free pair removal. */
1228 && (!(call
= gimple_call_fndecl (stmt
))
1229 || DECL_BUILT_IN_CLASS (call
) != BUILT_IN_NORMAL
1230 || (DECL_FUNCTION_CODE (call
) != BUILT_IN_MALLOC
1231 && DECL_FUNCTION_CODE (call
) != BUILT_IN_CALLOC
1232 && DECL_FUNCTION_CODE (call
) != BUILT_IN_ALLOCA
1233 && (DECL_FUNCTION_CODE (call
)
1234 != BUILT_IN_ALLOCA_WITH_ALIGN
))))
1236 something_changed
= true;
1237 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1239 fprintf (dump_file
, "Deleting LHS of call: ");
1240 print_gimple_stmt (dump_file
, stmt
, 0, TDF_SLIM
);
1241 fprintf (dump_file
, "\n");
1244 gimple_call_set_lhs (stmt
, NULL_TREE
);
1245 maybe_clean_or_replace_eh_stmt (stmt
, stmt
);
1247 release_ssa_name (name
);
1255 /* Since we don't track liveness of virtual PHI nodes, it is possible that we
1256 rendered some PHI nodes unreachable while they are still in use.
1257 Mark them for renaming. */
1260 basic_block prev_bb
;
1262 find_unreachable_blocks ();
1264 /* Delete all unreachable basic blocks in reverse dominator order. */
1265 for (bb
= EXIT_BLOCK_PTR
->prev_bb
; bb
!= ENTRY_BLOCK_PTR
; bb
= prev_bb
)
1267 prev_bb
= bb
->prev_bb
;
1269 if (!bitmap_bit_p (bb_contains_live_stmts
, bb
->index
)
1270 || !(bb
->flags
& BB_REACHABLE
))
1272 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1273 if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi
))))
1276 imm_use_iterator iter
;
1278 FOR_EACH_IMM_USE_STMT (stmt
, iter
, gimple_phi_result (gsi_stmt (gsi
)))
1280 if (!(gimple_bb (stmt
)->flags
& BB_REACHABLE
))
1282 if (gimple_code (stmt
) == GIMPLE_PHI
1283 || gimple_plf (stmt
, STMT_NECESSARY
))
1286 BREAK_FROM_IMM_USE_STMT (iter
);
1290 mark_virtual_phi_result_for_renaming (gsi_stmt (gsi
));
1293 if (!(bb
->flags
& BB_REACHABLE
))
1295 /* Speed up the removal of blocks that don't
1296 dominate others. Walking backwards, this should
1297 be the common case. ??? Do we need to recompute
1298 dominators because of cfg_altered? */
1299 if (!MAY_HAVE_DEBUG_STMTS
1300 || !first_dom_son (CDI_DOMINATORS
, bb
))
1301 delete_basic_block (bb
);
1304 h
= get_all_dominated_blocks (CDI_DOMINATORS
, bb
);
1309 prev_bb
= bb
->prev_bb
;
1310 /* Rearrangements to the CFG may have failed
1311 to update the dominators tree, so that
1312 formerly-dominated blocks are now
1313 otherwise reachable. */
1314 if (!!(bb
->flags
& BB_REACHABLE
))
1316 delete_basic_block (bb
);
1327 /* Remove dead PHI nodes. */
1328 something_changed
|= remove_dead_phis (bb
);
1331 return something_changed
;
1335 /* Print out removed statement statistics. */
1342 percg
= ((float) stats
.removed
/ (float) stats
.total
) * 100;
1343 fprintf (dump_file
, "Removed %d of %d statements (%d%%)\n",
1344 stats
.removed
, stats
.total
, (int) percg
);
1346 if (stats
.total_phis
== 0)
1349 percg
= ((float) stats
.removed_phis
/ (float) stats
.total_phis
) * 100;
1351 fprintf (dump_file
, "Removed %d of %d PHI nodes (%d%%)\n",
1352 stats
.removed_phis
, stats
.total_phis
, (int) percg
);
1355 /* Initialization for this pass. Set up the used data structures. */
1358 tree_dce_init (bool aggressive
)
1360 memset ((void *) &stats
, 0, sizeof (stats
));
1364 last_stmt_necessary
= sbitmap_alloc (last_basic_block
);
1365 bitmap_clear (last_stmt_necessary
);
1366 bb_contains_live_stmts
= sbitmap_alloc (last_basic_block
);
1367 bitmap_clear (bb_contains_live_stmts
);
1370 processed
= sbitmap_alloc (num_ssa_names
+ 1);
1371 bitmap_clear (processed
);
1373 worklist
.create (64);
1374 cfg_altered
= false;
1377 /* Cleanup after this pass. */
1380 tree_dce_done (bool aggressive
)
1385 sbitmap_free (visited_control_parents
);
1386 sbitmap_free (last_stmt_necessary
);
1387 sbitmap_free (bb_contains_live_stmts
);
1388 bb_contains_live_stmts
= NULL
;
1391 sbitmap_free (processed
);
1393 worklist
.release ();
1396 /* Main routine to eliminate dead code.
1398 AGGRESSIVE controls the aggressiveness of the algorithm.
1399 In conservative mode, we ignore control dependence and simply declare
1400 all but the most trivially dead branches necessary. This mode is fast.
1401 In aggressive mode, control dependences are taken into account, which
1402 results in more dead code elimination, but at the cost of some time.
1404 FIXME: Aggressive mode before PRE doesn't work currently because
1405 the dominance info is not invalidated after DCE1. This is
1406 not an issue right now because we only run aggressive DCE
1407 as the last tree SSA pass, but keep this in mind when you
1408 start experimenting with pass ordering. */
1411 perform_tree_ssa_dce (bool aggressive
)
1413 bool something_changed
= 0;
1415 calculate_dominance_info (CDI_DOMINATORS
);
1417 /* Preheaders are needed for SCEV to work.
1418 Simple lateches and recorded exits improve chances that loop will
1419 proved to be finite in testcases such as in loop-15.c and loop-24.c */
1421 loop_optimizer_init (LOOPS_NORMAL
1422 | LOOPS_HAVE_RECORDED_EXITS
);
1424 tree_dce_init (aggressive
);
1428 /* Compute control dependence. */
1429 calculate_dominance_info (CDI_POST_DOMINATORS
);
1430 cd
= new control_dependences (create_edge_list ());
1432 visited_control_parents
= sbitmap_alloc (last_basic_block
);
1433 bitmap_clear (visited_control_parents
);
1435 mark_dfs_back_edges ();
1438 find_obviously_necessary_stmts (aggressive
);
1441 loop_optimizer_finalize ();
1447 visited
= BITMAP_ALLOC (NULL
);
1448 propagate_necessity (aggressive
);
1449 BITMAP_FREE (visited
);
1451 something_changed
|= eliminate_unnecessary_stmts ();
1452 something_changed
|= cfg_altered
;
1454 /* We do not update postdominators, so free them unconditionally. */
1455 free_dominance_info (CDI_POST_DOMINATORS
);
1457 /* If we removed paths in the CFG, then we need to update
1458 dominators as well. I haven't investigated the possibility
1459 of incrementally updating dominators. */
1461 free_dominance_info (CDI_DOMINATORS
);
1463 statistics_counter_event (cfun
, "Statements deleted", stats
.removed
);
1464 statistics_counter_event (cfun
, "PHI nodes deleted", stats
.removed_phis
);
1466 /* Debugging dumps. */
1467 if (dump_file
&& (dump_flags
& (TDF_STATS
|TDF_DETAILS
)))
1470 tree_dce_done (aggressive
);
1472 if (something_changed
)
1473 return TODO_update_ssa
| TODO_cleanup_cfg
;
1477 /* Pass entry points. */
1481 return perform_tree_ssa_dce (/*aggressive=*/false);
1485 tree_ssa_dce_loop (void)
1488 todo
= perform_tree_ssa_dce (/*aggressive=*/false);
1491 free_numbers_of_iterations_estimates ();
1498 tree_ssa_cd_dce (void)
1500 return perform_tree_ssa_dce (/*aggressive=*/optimize
>= 2);
1506 return flag_tree_dce
!= 0;
1511 const pass_data pass_data_dce
=
1513 GIMPLE_PASS
, /* type */
1515 OPTGROUP_NONE
, /* optinfo_flags */
1516 true, /* has_gate */
1517 true, /* has_execute */
1518 TV_TREE_DCE
, /* tv_id */
1519 ( PROP_cfg
| PROP_ssa
), /* properties_required */
1520 0, /* properties_provided */
1521 0, /* properties_destroyed */
1522 0, /* todo_flags_start */
1523 TODO_verify_ssa
, /* todo_flags_finish */
1526 class pass_dce
: public gimple_opt_pass
1529 pass_dce (gcc::context
*ctxt
)
1530 : gimple_opt_pass (pass_data_dce
, ctxt
)
1533 /* opt_pass methods: */
1534 opt_pass
* clone () { return new pass_dce (m_ctxt
); }
1535 bool gate () { return gate_dce (); }
1536 unsigned int execute () { return tree_ssa_dce (); }
1538 }; // class pass_dce
1543 make_pass_dce (gcc::context
*ctxt
)
1545 return new pass_dce (ctxt
);
1550 const pass_data pass_data_dce_loop
=
1552 GIMPLE_PASS
, /* type */
1553 "dceloop", /* name */
1554 OPTGROUP_NONE
, /* optinfo_flags */
1555 true, /* has_gate */
1556 true, /* has_execute */
1557 TV_TREE_DCE
, /* tv_id */
1558 ( PROP_cfg
| PROP_ssa
), /* properties_required */
1559 0, /* properties_provided */
1560 0, /* properties_destroyed */
1561 0, /* todo_flags_start */
1562 TODO_verify_ssa
, /* todo_flags_finish */
1565 class pass_dce_loop
: public gimple_opt_pass
1568 pass_dce_loop (gcc::context
*ctxt
)
1569 : gimple_opt_pass (pass_data_dce_loop
, ctxt
)
1572 /* opt_pass methods: */
1573 opt_pass
* clone () { return new pass_dce_loop (m_ctxt
); }
1574 bool gate () { return gate_dce (); }
1575 unsigned int execute () { return tree_ssa_dce_loop (); }
1577 }; // class pass_dce_loop
1582 make_pass_dce_loop (gcc::context
*ctxt
)
1584 return new pass_dce_loop (ctxt
);
1589 const pass_data pass_data_cd_dce
=
1591 GIMPLE_PASS
, /* type */
1593 OPTGROUP_NONE
, /* optinfo_flags */
1594 true, /* has_gate */
1595 true, /* has_execute */
1596 TV_TREE_CD_DCE
, /* tv_id */
1597 ( PROP_cfg
| PROP_ssa
), /* properties_required */
1598 0, /* properties_provided */
1599 0, /* properties_destroyed */
1600 0, /* todo_flags_start */
1601 ( TODO_verify_ssa
| TODO_verify_flow
), /* todo_flags_finish */
1604 class pass_cd_dce
: public gimple_opt_pass
1607 pass_cd_dce (gcc::context
*ctxt
)
1608 : gimple_opt_pass (pass_data_cd_dce
, ctxt
)
1611 /* opt_pass methods: */
1612 opt_pass
* clone () { return new pass_cd_dce (m_ctxt
); }
1613 bool gate () { return gate_dce (); }
1614 unsigned int execute () { return tree_ssa_cd_dce (); }
1616 }; // class pass_cd_dce
1621 make_pass_cd_dce (gcc::context
*ctxt
)
1623 return new pass_cd_dce (ctxt
);