Introduce gimple_cond and use it in various places
commit23338b76061bb16d7bc97bba091ce7586da350eb
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 26 Mar 2014 20:17:24 +0000 (26 16:17 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 24 Oct 2014 21:23:35 +0000 (24 17:23 -0400)
tree8eb2e8f2d8facfd2a89149452d53de37130f761e
parent2112404bd25c264b01eadb33ebd4d5bbab78bb4e
Introduce gimple_cond and use it in various places

This corresponds to:
  [PATCH 04/89] Introduce gimple_cond and use it in various places
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01153.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> This is generally fine. It needs minor tweaks due to the change in how
> we're handling const stuff, but otherwise it looks ready to go.
> So, once you've flushed the queue of dependencies and reworked
> this to fit into the new world order, it's OK for the trunk. Please
> post the final version for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00595.html

gcc/
* coretypes.h (gimple_cond): New typedef.
(const_gimple_cond): Likewise.

* gimple.h (struct gimple_statement_cond): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_COND.
(is_a_helper <gimple_statement_cond>::test): New.
(gimple_build_cond): Return a gimple_cond, rather than just
a gimple.
(gimple_build_cond_from_tree): Likewise.

* gdbhooks.py (build_pretty_printer): Add gimple_cond and its
variants, using the gimple printer.

* cfgexpand.c (expand_gimple_cond): Require a gimple_cond rather
than just a gimple.
* gimple.h (gimple_cond_set_condition_from_tree): Likewise.
(gimple_cond_true_p): Likewise.
(gimple_cond_false_p): Likewise.
(gimple_cond_set_condition): Likewise.
* gimple.c (gimple_cond_set_condition_from_tree): Likewise.
* gimple-fold.c (fold_gimple_cond): Likewise.
* gimple-pretty-print.c (dump_gimple_cond): Likewise.
* tree-ssa-dom.c (canonicalize_comparison): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Likewise.
* tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise.
(recognize_bits_test): Likewise.
* tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
(thread_around_empty_blocks): Likewise.
(thread_through_normal_block): Likewise.
(thread_across_edge): Likewise.
* tree-ssa-threadedge.h (thread_across_edge): Likewise.
* tree-vrp.c (range_fits_type_p): Likewise.

* cfgexpand.c (expand_gimple_basic_block): Add checked cast to
gimple_cond in regions where a stmt is known to have code GIMPLE_COND.
* gimple-fold.c (fold_stmt_1): Likewise.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-ssa-dom.c (optimize_stmt): Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise.
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Likewise.
* tree-vrp.c (simplify_stmt_using_ranges): Likewise.

* cfgloopmanip.c (create_empty_loop_on_edge): Update local to be a
gimple_cond.
* tree-vrp.c (identify_jump_threads): Likewise.

* gimple.c (gimple_build_cond): Return a gimple_cond, rather than
just a gimple.
(gimple_build_cond_from_tree): Likewise.

* tree-ssa-dom.c (class dom_opt_dom_walker): Strengthen type of
field "m_dummy_cond" from a plain gimple to a gimple_cond.

* tree-ssa-ifcombine.c (ifcombine_ifandif): Introduce locals
inner_stmt and outer_stmt so that inner_cond and outer_cond can be
of type gimple_cond once we know that we have code == GIMPLE_COND.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Introduce local
"last" so that stmt can be of type gimple_cond.
17 files changed:
gcc/ChangeLog.gimple-classes
gcc/cfgexpand.c
gcc/cfgloopmanip.c
gcc/coretypes.h
gcc/gdbhooks.py
gcc/gimple-fold.c
gcc/gimple-pretty-print.c
gcc/gimple.c
gcc/gimple.h
gcc/tree-ssa-dom.c
gcc/tree-ssa-forwprop.c
gcc/tree-ssa-ifcombine.c
gcc/tree-ssa-loop-unswitch.c
gcc/tree-ssa-pre.c
gcc/tree-ssa-threadedge.c
gcc/tree-ssa-threadedge.h
gcc/tree-vrp.c