Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-24 Thread David Malcolm
On Wed, 2014-04-23 at 13:58 -0600, Jeff Law wrote:
> On 04/21/14 10:56, David Malcolm wrote:
[...]
> So, generally I like it.  It looks pretty much like what I'd expect from 
> this kind of work.
> 
> So it sounds like Richi really prefers the explicit casting rather than 
> member functions.  It seems like a minor issue to me, so let's go with 
> explicit casting.
> 
> OK for the trunk with that change.  Per Richi's request, please hold off 
> until 4.9.1 goes out the door (~2 months?)

Thanks.  I see that Richi wants me to investigate ways of doing this
without introducing all the typedefs:

  http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01520.html

so I'm not going to commit this without further discussion, but for
reference, I'm attaching the port I did of patch 2 to directly use the
is-a.h API (i.e. without the casting methods in the base class) [1].
This version of the patch also fixes up the decls in doc/gimple.texi to
match the changes in gimple.h [2], and I tweaked some of the hunks to
favor dyn_cast over "check the of code, then do an as_a", for example:

-  else if (gimple_code (stmt) == GIMPLE_SWITCH)
-return simplify_switch_using_ranges (stmt);
+  else if (gimple_switch switch_stmt = dyn_cast  (stmt))
+return simplify_switch_using_ranges (switch_stmt);

It bootstrapped®rtested on x86_64-unknown-linux-gnu, but as I said
above, I'm merely posting this for reference.

> Jeff
> ps.  If/when your work exposes a problem with the existing code base, 
> please point it out.  This is just for my own curiosity than anything.

Definitely.

Dave

[1] specifically, using the revised is-a.h API from r209719.
[2] though I wish we were using Doxygen instead, to avoid having to
repeat the decls and manually keep them in sync.
commit bf955db0ef4f7e86860c1c3d30e435c79abf6c69
Author: David Malcolm 
Date:   Tue Apr 22 16:47:11 2014 -0400

Introduce gimple_switch and use it in various places

gcc/
	* gimple.h (gimple_statement_switch): New subclass of
	gimple_statement_with_ops, adding the invariant that
	stmt->code == GIMPLE_SWITCH.
	(is_a_helper ::test (gimple)): New.

	* coretypes.h (gimple_switch): New typedef
	(const_gimple_switch): Likewise.

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

	* gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
	rather than just a gimple.
	(gimple_build_switch): Likewise.
	* gimple.h (gimple_build_switch_nlabels): Likewise.
	(gimple_build_switch): Likewise.

	* gimple.h (gimple_switch_num_labels): Update type-signature to
	require a gimple_switch rather than just a gimple.
	(gimple_switch_set_num_labels): Likewise.
	(gimple_switch_set_index): Likewise.
	(gimple_switch_label): Likewise.
	(gimple_switch_set_label): Likewise.
	(gimple_switch_default_label): Likewise.
	(gimple_switch_set_default_label): Likewise.
	* expr.h (expand_case): Likewise.
	* gimple-pretty-print.c (dump_gimple_call): Likewise.
	* stmt.c (compute_cases_per_edge): Likewise.
	(expand_case): Likewise.
	* tree-cfg.h (group_case_labels_stmt): Likewise.
	* tree-cfg.c (make_gimple_switch_edges): Likewise.
	(find_taken_edge_switch_expr) Likewise.
	(find_case_label_for_value) Likewise.
	(get_cases_for_edge): Likewise.
	(group_case_labels_stmt): Likewise.
	(verify_gimple_switch): Likewise.
	* tree-eh.c (verify_norecord_switch_expr): Likewise.
	* tree-eh.c (lower_eh_constructs_2): Likewise.
	* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
	(simplify_gimple_switch): Likewise.
	* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
	(collect_switch_conv_info): Likewise.
	(build_constructors): Likewise.
	(array_value_type): Likewise.
	(build_one_array): Likewise.
	(build_arrays): Likewise.
	(gen_inbound_check): Likewise.
	(pass_convert_switch::execute): Likewise.
	* tree-vrp.c (find_switch_asserts): Likewise.
	(find_case_label_range): Likewise.
	(find_case_label_ranges): Likewise.
	(vrp_visit_switch_stmt): Likewise.
	(simplify_switch_using_ranges): Likewise.

	* tree-vrp.c (switch_update): Strengthen field "stmt" from being
	merely a gimple to being a gimple_switch.

	* cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
	gimple_switch in regions where the stmt code has been tested as
	GIMPLE_SWITCH.
	* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
	* tree-cfg.c (make_edges): Likewise.
	(end_recording_case_labels): Likewise.
	(cleanup_dead_labels): Likewise.
	(cleanup_dead_labels): Likewise.
	(group_case_labels): Likewise.
	(find_case_label_for_value): Likewise.
	(verify_gimple_stmt): Likewise.
	(gimple_verify_flow_info): Likewise.
	(gimple_redirect_edge_and_branch): Likewise.
	* tree-inline.c (estimate_num_insns): Likewise

Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-23 Thread Trevor Saunders
On Wed, Apr 23, 2014 at 01:32:24PM -0700, Richard Henderson wrote:
> On 04/23/2014 12:56 PM, Jeff Law wrote:
> > On 04/22/14 15:38, Richard Henderson wrote:
> >> On 04/22/2014 10:13 AM, David Malcolm wrote:
> >>> On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:
> > --- a/gcc/tree-loop-distribution.c
> > +++ b/gcc/tree-loop-distribution.c
> > @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop,
> > partition_t partition,
> >   }
> > else if (gimple_code (stmt) == GIMPLE_SWITCH)
> >   {
> > +  gimple_switch switch_stmt = stmt->as_a_gimple_switch ();
> 
>  maybe it would make more sense to do
>  else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
> >>>
> >>> Thanks.  Yes, or indeed something like:
> >>>
> >>>else if (gimple_switch switch_stmt = dyn_cast  (stmt))
> >>>
> >>> (modulo the "pointerness" issues mentioned in
> >>> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )
> >>>
> >>
> >> I'm not keen on embedding assignments into conditionals like this, much 
> >> less
> >> embedding variable declarations as well.  I think David's original is 
> >> perfect.
> > Likewise, though I am less annoyed by such things than I was in the past. 
> > Perhaps that's an artifact of actually liking that kind of style for 'for' 
> > loops.
> 
> I'll admit that with *just* the declaration and assignment in the if,
> it's not that bad, if others are strongly in favor of not reproducing the test
> vs the enum value.

oh, I totally see where your coming from, and tbh I think most of the
hand rolled downcasting in C++ I've written doesn't do it with an
assignment in the if.  That said I think its nice you can limmit the
scope of the variable and have fewer lines.

Trev

> 
> Perhaps I'm just reacting to previous uses of assignments within conditionals
> in gcc, which looked more like
> 
>   if (test1
>   && test2
>   && (x = foo, test3(x))
>   && test4(x)
>   && (y = bar(x), test5))
> 
> and which caused all sorts of trouble.  Especially when the if conditional
> expanded to fill an entire 80x25 screen.
> 
> 
> r~
> 


signature.asc
Description: Digital signature


Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-23 Thread Richard Henderson
On 04/23/2014 12:56 PM, Jeff Law wrote:
> On 04/22/14 15:38, Richard Henderson wrote:
>> On 04/22/2014 10:13 AM, David Malcolm wrote:
>>> On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop,
> partition_t partition,
>   }
> else if (gimple_code (stmt) == GIMPLE_SWITCH)
>   {
> +  gimple_switch switch_stmt = stmt->as_a_gimple_switch ();

 maybe it would make more sense to do
 else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
>>>
>>> Thanks.  Yes, or indeed something like:
>>>
>>>else if (gimple_switch switch_stmt = dyn_cast  (stmt))
>>>
>>> (modulo the "pointerness" issues mentioned in
>>> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )
>>>
>>
>> I'm not keen on embedding assignments into conditionals like this, much less
>> embedding variable declarations as well.  I think David's original is 
>> perfect.
> Likewise, though I am less annoyed by such things than I was in the past. 
> Perhaps that's an artifact of actually liking that kind of style for 'for' 
> loops.

I'll admit that with *just* the declaration and assignment in the if,
it's not that bad, if others are strongly in favor of not reproducing the test
vs the enum value.

Perhaps I'm just reacting to previous uses of assignments within conditionals
in gcc, which looked more like

  if (test1
  && test2
  && (x = foo, test3(x))
  && test4(x)
  && (y = bar(x), test5))

and which caused all sorts of trouble.  Especially when the if conditional
expanded to fill an entire 80x25 screen.


r~



Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-23 Thread Jeff Law

On 04/21/14 10:56, David Malcolm wrote:

gcc/
* gimple.h (gimple_statement_switch): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_SWITCH.
(gimple_statement_base::as_a_gimple_switch): New.
(gimple_statement_base::dyn_cast_gimple_switch): New.
(is_a_helper ::test (gimple)): New.

* coretypes.h (gimple_switch): New typedef
(const_gimple_switch): Likewise.

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

* gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
rather than just a gimple.
(gimple_build_switch): Likewise.
* gimple.h (gimple_build_switch_nlabels): Likewise.
(gimple_build_switch): Likewise.

* gimple.h (gimple_switch_num_labels): Update type-signature to
require a gimple_switch rather than just a gimple.
(gimple_switch_set_num_labels): Likewise.
(gimple_switch_set_index): Likewise.
(gimple_switch_label): Likewise.
(gimple_switch_set_label): Likewise.
(gimple_switch_default_label): Likewise.
(gimple_switch_set_default_label): Likewise.
* expr.h (expand_case): Likewise.
* gimple-pretty-print.c (dump_gimple_call): Likewise.
* stmt.c (compute_cases_per_edge): Likewise.
(expand_case): Likewise.
* tree-cfg.h (group_case_labels_stmt): Likewise.
* tree-cfg.c (make_gimple_switch_edges): Likewise.
(find_taken_edge_switch_expr) Likewise.
(find_case_label_for_value) Likewise.
(get_cases_for_edge): Likewise.
(group_case_labels_stmt): Likewise.
(verify_gimple_switch): Likewise.
* tree-eh.c (verify_norecord_switch_expr): Likewise.
* tree-eh.c (lower_eh_constructs_2): Likewise.
* tree-loop-distribution.c (generate_loops_for_partition): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
(simplify_gimple_switch): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
(collect_switch_conv_info): Likewise.
(build_constructors): Likewise.
(array_value_type): Likewise.
(build_one_array): Likewise.
(build_arrays): Likewise.
(gen_inbound_check): Likewise.
* tree-vrp.c (find_switch_asserts): Likewise.
(find_case_label_range): Likewise.
(find_case_label_ranges): Likewise.
(vrp_visit_switch_stmt): Likewise.
(simplify_switch_using_ranges): Likewise.

* tree-vrp.c (switch_update): Strengthen field "stmt" from being
merely a gimple to being a gimple_switch.

* cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
gimple_switch in regions where the stmt code has been tested as
GIMPLE_SWITCH.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-cfg.c (make_edges): Likewise.
(end_recording_case_labels): Likewise.
(cleanup_dead_labels): Likewise.
(cleanup_dead_labels): Likewise.
(group_case_labels): Likewise.
(find_taken_edge): Likewise.
(find_case_label_for_value): Likewise.
(verify_gimple_stmt): Likewise.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vrp.c  (find_assert_locations_1): Likewise.
(vrp_visit_stmt): Likewise.
(simplify_stmt_using_ranges): Likewise.

* ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
Introduce local "lastg" as a generic gimple, so that local "last"
can be of type gimple_switch once lastg's code has been verified.

* omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
the GIMPLE_SWITCH case.

* tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
argument, since the caller (find_taken_edge) has checked that
last_stmt is a switch.
So, generally I like it.  It looks pretty much like what I'd expect from 
this kind of work.


So it sounds like Richi really prefers the explicit casting rather than 
member functions.  It seems like a minor issue to me, so let's go with 
explicit casting.


OK for the trunk with that change.  Per Richi's request, please hold off 
until 4.9.1 goes out the door (~2 months?)


Jeff
ps.  If/when your work exposes a problem with the existing code base, 
please point it out.  This is just for my own curiosity than anything.






Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-23 Thread Jeff Law

On 04/22/14 15:38, Richard Henderson wrote:

On 04/22/2014 10:13 AM, David Malcolm wrote:

On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:

--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
partition_t partition,
}
  else if (gimple_code (stmt) == GIMPLE_SWITCH)
{
+ gimple_switch switch_stmt = stmt->as_a_gimple_switch ();


maybe it would make more sense to do
else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())


Thanks.  Yes, or indeed something like:

   else if (gimple_switch switch_stmt = dyn_cast  (stmt))

(modulo the "pointerness" issues mentioned in
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )



I'm not keen on embedding assignments into conditionals like this, much less
embedding variable declarations as well.  I think David's original is perfect.
Likewise, though I am less annoyed by such things than I was in the 
past.  Perhaps that's an artifact of actually liking that kind of style 
for 'for' loops.



Jeff


Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-23 Thread Florian Weimer

On 04/22/2014 10:17 PM, David Malcolm wrote:


or indeed, something like:

  else if (gimple_switch switch_stmt =
  dyn_cast  (stmt))
{


to avoid an 83-character-wide line :)

Hope that's the appropriate way to split such a line; I can never
remember if one is supposed to put the linebreak before or after the =.


It's supposed to come before, so that the equal sign is at the start of 
the line.  Operators are also supposed to be at the start and not the 
end.  At least the operator part is covered in the coding standards:




--
Florian Weimer / Red Hat Product Security Team


Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-22 Thread Richard Henderson
On 04/22/2014 10:13 AM, David Malcolm wrote:
> On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:
>>> --- a/gcc/tree-loop-distribution.c
>>> +++ b/gcc/tree-loop-distribution.c
>>> @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
>>> partition_t partition,
>>> }
>>>   else if (gimple_code (stmt) == GIMPLE_SWITCH)
>>> {
>>> + gimple_switch switch_stmt = stmt->as_a_gimple_switch ();
>>
>> maybe it would make more sense to do
>> else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
> 
> Thanks.  Yes, or indeed something like:
> 
>   else if (gimple_switch switch_stmt = dyn_cast  (stmt))
> 
> (modulo the "pointerness" issues mentioned in 
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )
> 

I'm not keen on embedding assignments into conditionals like this, much less
embedding variable declarations as well.  I think David's original is perfect.


r~


Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-22 Thread David Malcolm
On Tue, 2014-04-22 at 13:13 -0400, David Malcolm wrote:
> On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:
> > > --- a/gcc/tree-loop-distribution.c
> > > +++ b/gcc/tree-loop-distribution.c
> > > @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
> > > partition_t partition,
> > >   }
> > > else if (gimple_code (stmt) == GIMPLE_SWITCH)
> > >   {
> > > +   gimple_switch switch_stmt = stmt->as_a_gimple_switch ();
> > 
> > maybe it would make more sense to do
> > else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
> 
> Thanks.  Yes, or indeed something like:
> 
>   else if (gimple_switch switch_stmt = dyn_cast  (stmt))
> 
> (modulo the "pointerness" issues mentioned in 
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )

or indeed, something like:

  else if (gimple_switch switch_stmt =
  dyn_cast  (stmt))
   {


to avoid an 83-character-wide line :)

Hope that's the appropriate way to split such a line; I can never
remember if one is supposed to put the linebreak before or after the =.



Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-22 Thread David Malcolm
On Mon, 2014-04-21 at 18:45 -0400, Trevor Saunders wrote:
> > --- a/gcc/tree-loop-distribution.c
> > +++ b/gcc/tree-loop-distribution.c
> > @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
> > partition_t partition,
> > }
> >   else if (gimple_code (stmt) == GIMPLE_SWITCH)
> > {
> > + gimple_switch switch_stmt = stmt->as_a_gimple_switch ();
> 
> maybe it would make more sense to do
> else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())

Thanks.  Yes, or indeed something like:

  else if (gimple_switch switch_stmt = dyn_cast  (stmt))

(modulo the "pointerness" issues mentioned in 
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01334.html )



Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-22 Thread Richard Biener
On Tue, Apr 22, 2014 at 12:45 AM, Trevor Saunders  wrote:
>> --- a/gcc/tree-loop-distribution.c
>> +++ b/gcc/tree-loop-distribution.c
>> @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
>> partition_t partition,
>>   }
>> else if (gimple_code (stmt) == GIMPLE_SWITCH)
>>   {
>> +   gimple_switch switch_stmt = stmt->as_a_gimple_switch ();
>
> maybe it would make more sense to do
> else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
> ?

_please_ use is_a<> as_a<> etc. from is-a.h instead of member functions.

Richard.

> Trev
>


Re: [PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-21 Thread Trevor Saunders
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -687,8 +687,9 @@ generate_loops_for_partition (struct loop *loop, 
> partition_t partition,
>   }
> else if (gimple_code (stmt) == GIMPLE_SWITCH)
>   {
> +   gimple_switch switch_stmt = stmt->as_a_gimple_switch ();

maybe it would make more sense to do
else if (gimple_switch switch_stmt = stmt->dyn_cast_gimple_switch ())
?

Trev



signature.asc
Description: Digital signature


[PATCH 02/89] Introduce gimple_switch and use it in various places

2014-04-21 Thread David Malcolm
gcc/
* gimple.h (gimple_statement_switch): New subclass of
gimple_statement_with_ops, adding the invariant that
stmt->code == GIMPLE_SWITCH.
(gimple_statement_base::as_a_gimple_switch): New.
(gimple_statement_base::dyn_cast_gimple_switch): New.
(is_a_helper ::test (gimple)): New.

* coretypes.h (gimple_switch): New typedef
(const_gimple_switch): Likewise.

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

* gimple.c (gimple_build_switch_nlabels): Return a gimple_switch
rather than just a gimple.
(gimple_build_switch): Likewise.
* gimple.h (gimple_build_switch_nlabels): Likewise.
(gimple_build_switch): Likewise.

* gimple.h (gimple_switch_num_labels): Update type-signature to
require a gimple_switch rather than just a gimple.
(gimple_switch_set_num_labels): Likewise.
(gimple_switch_set_index): Likewise.
(gimple_switch_label): Likewise.
(gimple_switch_set_label): Likewise.
(gimple_switch_default_label): Likewise.
(gimple_switch_set_default_label): Likewise.
* expr.h (expand_case): Likewise.
* gimple-pretty-print.c (dump_gimple_call): Likewise.
* stmt.c (compute_cases_per_edge): Likewise.
(expand_case): Likewise.
* tree-cfg.h (group_case_labels_stmt): Likewise.
* tree-cfg.c (make_gimple_switch_edges): Likewise.
(find_taken_edge_switch_expr) Likewise.
(find_case_label_for_value) Likewise.
(get_cases_for_edge): Likewise.
(group_case_labels_stmt): Likewise.
(verify_gimple_switch): Likewise.
* tree-eh.c (verify_norecord_switch_expr): Likewise.
* tree-eh.c (lower_eh_constructs_2): Likewise.
* tree-loop-distribution.c (generate_loops_for_partition): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
(simplify_gimple_switch): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
(collect_switch_conv_info): Likewise.
(build_constructors): Likewise.
(array_value_type): Likewise.
(build_one_array): Likewise.
(build_arrays): Likewise.
(gen_inbound_check): Likewise.
* tree-vrp.c (find_switch_asserts): Likewise.
(find_case_label_range): Likewise.
(find_case_label_ranges): Likewise.
(vrp_visit_switch_stmt): Likewise.
(simplify_switch_using_ranges): Likewise.

* tree-vrp.c (switch_update): Strengthen field "stmt" from being
merely a gimple to being a gimple_switch.

* cfgexpand.c (expand_gimple_stmt_1): Add checked cast to
gimple_switch in regions where the stmt code has been tested as
GIMPLE_SWITCH.
* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
* tree-cfg.c (make_edges): Likewise.
(end_recording_case_labels): Likewise.
(cleanup_dead_labels): Likewise.
(cleanup_dead_labels): Likewise.
(group_case_labels): Likewise.
(find_taken_edge): Likewise.
(find_case_label_for_value): Likewise.
(verify_gimple_stmt): Likewise.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
* tree-inline.c (estimate_num_insns): Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vrp.c  (find_assert_locations_1): Likewise.
(vrp_visit_stmt): Likewise.
(simplify_stmt_using_ranges): Likewise.

* ipa-inline-analysis.c (set_switch_stmt_execution_predicate):
Introduce local "lastg" as a generic gimple, so that local "last"
can be of type gimple_switch once lastg's code has been verified.

* omp-low.c (diagnose_sb_2): Introduce switch_stmt local to handle
the GIMPLE_SWITCH case.

* tree-cfg.c (find_taken_edge_switch_expr): Add gimple_switch
argument, since the caller (find_taken_edge) has checked that
last_stmt is a switch.

Conflicts:
gcc/coretypes.h
gcc/tree-cfg.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-uncprop.c
gcc/tree-vrp.c
---
 gcc/cfgexpand.c  |  2 +-
 gcc/coretypes.h  |  8 +
 gcc/expr.h   |  2 +-
 gcc/gdbhooks.py  |  7 -
 gcc/gimple-pretty-print.c|  5 ++--
 gcc/gimple.c | 11 +++
 gcc/gimple.h | 71 ++--
 gcc/ipa-inline-analysis.c|  7 +++--
 gcc/omp-low.c|  5 ++--
 gcc/stmt.c   |  4 +--
 gcc/tree-cfg.c   | 57 ++-
 gcc/tree-c