From e54e649814724487558a7404ba1e6cc240e99002 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 26 Mar 2014 17:14:45 -0400
Subject: [PATCH 31/88] Use more concrete types for various gimple statements

gcc/
	* cgraphunit.c (thunk_adjust): Strengthen local "stmt" from gimple
	to gimple_assign.

	* gimple-ssa-isolate-paths.c
	(insert_trap_and_remove_trailing_statements): Strengthen local
	"new_stmt" from gimple to gimple_call.

	* gimple-ssa-strength-reduction.c (replace_mult_candidate):
	Strengthen local "copy_stmt" from gimple to gimple_assign.
	(create_add_on_incoming_edge): Likewise, for "new_stmt".
	(insert_initializers): Likewise, for "init_stmt".
	(introduce_cast_before_cand): Likewise, for "cast_stmt".
	(replace_one_candidate): Likewise, for "copy_stmt" and
	"cast_stmt".

	* gimplify.c (build_stack_save_restore): Require gimple_calls
	rather than plain gimples.
	(gimplify_bind_expr): Strengthen locals "stack_save" and
	"stack_restore" from gimple to gimple_call.  Strengthen "gs"
	to gimple_try.
	(gimplify_switch_expr): Strengthen local "gimple_switch" from
	gimple to gimple_switch, and "new_default" to gimple_label.
	(gimplify_cond_expr): Strengthen local "gimple_cond" from gimple
	to gimple_cond.
	(gimplify_init_constructor): Strengthen local "init" from gimple
	to gimple_assign.
	(gimplify_cleanup_point_expr): Strengthen local "gtry" from gimple
	to gimple_try.
	(gimple_push_cleanup): Strengthen locals "ffalse" and "ftrue" from
	gimple to gimple_assign.

	* tree-eh.c (do_goto_redirection): Strengthen local to gimple_goto.
	(emit_post_landing_pad): Strengthen local to gimple_label.

	* tree-outof-ssa.c (insert_backedge_copies): Strengthen local
	"stmt" from gimple to gimple_assign.

	* tree-parloops.c (take_address_of): Likewise.

	* tree-predcom.c (replace_ref_with): Likewise, for "new_stmt".
	(initialize_root_vars_lm): Likewise, for "init_stmt".
	(reassociate_to_the_same_stmt): Likewise, for "new_stmt" and "tmp_stmt".

	* tree-profile.c (gimple_gen_edge_profiler): Likewise, for "stmt1",
	"stmt2", "stmt3".
	(gimple_gen_ic_profiler): Likewise.
	(gimple_gen_ic_func_profiler): Strengthen local "stmt1" from
	gimple to gimple_call, and "stmt2" to gimple_assign.

	* tree-scalar-evolution.c (scev_const_prop): Strengthen local
	"ass" from gimple to gimple_assign.

	* tree-sra.c (build_ref_for_offset): Likewise for "stmt".
	(generate_subtree_copies): Likewise; also strengthen "ds" to
	gimple_debug.
	(init_subtree_with_zero): Likewise.
	(sra_modify_expr): Likewise.
	(load_assign_lhs_subreplacements): Likewise.
	(sra_modify_assign): Strengthen "ds" to gimple_debug.
	(sra_ipa_reset_debug_stmts): Likewise for "def_temp".

	* tree-ssa-ccp.c (insert_clobber_before_stack_restore):
	Strengthen local "clobber_stmt" from gimple to gimple_assign.

	* tree-ssa-dce.c (remove_dead_stmt): Strengthen "note" to
	gimple_debug.

	* tree-ssa-dom.c (record_equivalences_from_stmt): Strengthen
	local "new_stmt" from gimple to gimple_assign.
	(optimize_stmt): Likewise.

	* tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise for
	4 declarations of "newop".
	(simplify_rotate): Likewise for "g".

	* tree-ssa-loop-im.c (rewrite_reciprocal): Likewise for 3 locals.
	(rewrite_bittest): Likewise for "stmt" and "stmt2".
	(move_computations_dom_walker::before_dom_children): Likewise for
	"new_stmt".
	(execute_sm): Likewise for "load" and "store".

	* tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts):
	Strengthen local "stmt" from gimple to gimple_call.
	(unloop_loops): Likewise.

	* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Strengthen
	local "ass" from gimple to gimple_assign.
	(remove_unused_ivs): Strengthen "def_temp" to gimple_debug.

	* tree-ssa-loop-manip.c (rewrite_phi_with_iv): Strengthen local "stmt"
	from gimple to gimple_assign.

	* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Strengthen local
	"prefetch" from gimple to gimple_call.

	* tree-ssa-math-opts.c (insert_reciprocals): Strengthen local
	"new_stmt" from gimple to gimple_assign.
	(powi_as_mults_1): Likewise for "mult_stmt".
	(powi_as_mults): Likewise for "div_stmt".
	(build_and_insert_binop): Likewise for "stmt".
	(build_and_insert_cast): Likewise.
	(pass_cse_sincos::execute): Likewise for "stmt" and various decls
	of "new_stmt".
	(convert_mult_to_fma): Likewise for "fma_stmt".

	* tree-ssa-phiopt.c (conditional_replacement): Likewise for "new_stmt".
	(abs_replacement): Likewise.

	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise for "tmp".

	* tree-ssa-pre.c (create_expression_by_pieces): Likewise for "newstmt".
	(eliminate_insert): Likewise for "tem".

	* tree-ssa-propagate.c (update_gimple_call): Strengthen locals
	"new_stmt" and "stmt" from gimple to gimple_call.
	(update_call_from_tree): Likewise for "new_stmt".

	* tree-ssa-reassoc.c (build_and_add_sum): Likewise for "sum".
	(update_ops): Likewise for "g".
	(maybe_optimize_range_tests): Likewise.
	(rewrite_expr_tree_parallel): Require a gimple_assign rather than
	a plain gimple.
	(reassociate_bb): Add a checked cast to gimple_assign.

	* tree-ssa.c (insert_debug_temp_for_var_def): Strengthen local
	"def_temp" from gimple to gimple_debug.

	* tree-switch-conversion.c (emit_case_bit_tests): Strengthen local
	"shift_stmt" from gimple to gimple_assign.

	* tree-tailcall.c (adjust_return_value_with_ops): Likewise for
	"stmt".
	(update_accumulator_with_ops): Likewise.

	* tree-vect-data-refs.c (bump_vector_ptr): Likewise for
	"incr_stmt".

	* tree-vect-stmts.c (vectorizable_condition): Likewise for
	"new_stmt".

	* tree-vrp.c (build_assert_expr_for): Likewise for "assertion".
	(simplify_truth_ops_using_ranges): Likewise for "newop".
	(simplify_float_conversion_using_ranges): Likewise for "conv".

	* ubsan.c (instrument_mem_ref): Strengthen local "g" from gimple
	to gimple_call.

	* value-prof.c (gimple_divmod_fixed_value): Require a
	gimple_assign rather than a plain gimple; strengthen types of locals.
	(gimple_mod_pow2): Likewise.
	(gimple_mod_subtract): Likewise.
	(gimple_divmod_fixed_value_transform): Strengthen local
	"stmt" from gimple to gimple_assign.
	(gimple_mod_pow2_value_transform): Likewise.
	(gimple_mod_subtract_transform): Likewise.
	(gimple_ic): Strengthen types of locals.
---
 gcc/cgraphunit.c                    |  2 +-
 gcc/gimple-ssa-isolate-paths.c      |  2 +-
 gcc/gimple-ssa-strength-reduction.c | 17 +++++++------
 gcc/gimplify.c                      | 22 ++++++++---------
 gcc/tree-eh.c                       |  4 +--
 gcc/tree-outof-ssa.c                |  3 ++-
 gcc/tree-parloops.c                 |  2 +-
 gcc/tree-predcom.c                  |  6 ++---
 gcc/tree-profile.c                  |  7 +++---
 gcc/tree-scalar-evolution.c         |  2 +-
 gcc/tree-sra.c                      | 35 ++++++++++++++------------
 gcc/tree-ssa-ccp.c                  |  3 ++-
 gcc/tree-ssa-dce.c                  |  2 +-
 gcc/tree-ssa-dom.c                  |  4 +--
 gcc/tree-ssa-forwprop.c             | 10 ++++----
 gcc/tree-ssa-loop-im.c              | 17 +++++++------
 gcc/tree-ssa-loop-ivcanon.c         |  4 +--
 gcc/tree-ssa-loop-ivopts.c          |  5 ++--
 gcc/tree-ssa-loop-manip.c           |  2 +-
 gcc/tree-ssa-loop-prefetch.c        |  2 +-
 gcc/tree-ssa-math-opts.c            | 23 +++++++++--------
 gcc/tree-ssa-phiopt.c               |  6 +++--
 gcc/tree-ssa-phiprop.c              |  2 +-
 gcc/tree-ssa-pre.c                  |  9 ++++---
 gcc/tree-ssa-propagate.c            |  4 +--
 gcc/tree-ssa-reassoc.c              | 14 ++++++-----
 gcc/tree-ssa.c                      |  2 +-
 gcc/tree-switch-conversion.c        |  2 +-
 gcc/tree-tailcall.c                 |  4 +--
 gcc/tree-vect-data-refs.c           |  2 +-
 gcc/tree-vect-stmts.c               |  2 +-
 gcc/tree-vrp.c                      |  7 +++---
 gcc/ubsan.c                         |  2 +-
 gcc/value-prof.c                    | 49 +++++++++++++++++++++----------------
 34 files changed, 153 insertions(+), 126 deletions(-)

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 98d34be..b274162 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1319,7 +1319,7 @@ thunk_adjust (gimple_stmt_iterator * bsi,
 	      tree ptr, bool this_adjusting,
 	      HOST_WIDE_INT fixed_offset, tree virtual_offset)
 {
-  gimple stmt;
+  gimple_assign stmt;
   tree ret;
 
   if (this_adjusting
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 8016db4..528b3eb 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -96,7 +96,7 @@ insert_trap_and_remove_trailing_statements (gimple_stmt_iterator *si_p, tree op)
       update_stmt (stmt);
     }
 
-  gimple new_stmt
+  gimple_call new_stmt
     = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);
   gimple_seq seq = NULL;
   gimple_seq_add_stmt (&seq, new_stmt);
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 6bf54d6..2358bda 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -2052,7 +2052,7 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump)
       if (bump == 0)
 	{
 	  tree lhs = gimple_assign_lhs (c->cand_stmt);
-	  gimple copy_stmt = gimple_build_assign (lhs, basis_name);
+	  gimple_assign copy_stmt = gimple_build_assign (lhs, basis_name);
 	  gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
 	  gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
 	  gsi_replace (&gsi, copy_stmt, false);
@@ -2151,7 +2151,7 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
   basic_block insert_bb;
   gimple_stmt_iterator gsi;
   tree lhs, basis_type;
-  gimple new_stmt;
+  gimple_assign new_stmt;
 
   /* If the add candidate along this incoming edge has the same
      index as C's hidden basis, the hidden basis represents this
@@ -3108,7 +3108,7 @@ insert_initializers (slsr_cand_t c)
     {
       basic_block bb;
       slsr_cand_t where = NULL;
-      gimple init_stmt;
+      gimple_assign init_stmt;
       tree stride_type, new_name, incr_tree;
       widest_int incr = incr_vec[i].incr;
 
@@ -3246,7 +3246,7 @@ static tree
 introduce_cast_before_cand (slsr_cand_t c, tree to_type, tree from_expr)
 {
   tree cast_lhs;
-  gimple cast_stmt;
+  gimple_assign cast_stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
 
   cast_lhs = make_temp_ssa_name (to_type, NULL, "slsr");
@@ -3408,7 +3408,7 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
       
       if (types_compatible_p (lhs_type, basis_type))
 	{
-	  gimple copy_stmt = gimple_build_assign (lhs, basis_name);
+	  gimple_assign copy_stmt = gimple_build_assign (lhs, basis_name);
 	  gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
 	  gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
 	  gsi_replace (&gsi, copy_stmt, false);
@@ -3420,9 +3420,10 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
       else
 	{
 	  gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
-	  gimple cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, lhs,
-							   basis_name,
-							   NULL_TREE);
+	  gimple_assign cast_stmt =
+	    gimple_build_assign_with_ops (NOP_EXPR, lhs,
+					  basis_name,
+					  NULL_TREE);
 	  gimple_set_location (cast_stmt, gimple_location (c->cand_stmt));
 	  gsi_replace (&gsi, cast_stmt, false);
 	  c->cand_stmt = cast_stmt;
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e233da8..26cc2d0 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1022,7 +1022,7 @@ voidify_wrapper_expr (tree wrapper, tree temp)
    a temporary through which they communicate.  */
 
 static void
-build_stack_save_restore (gimple *save, gimple *restore)
+build_stack_save_restore (gimple_call *save, gimple_call *restore)
 {
   tree tmp_var;
 
@@ -1045,7 +1045,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
   tree t;
   gimple_bind gimple_bind;
   gimple_seq body, cleanup;
-  gimple stack_save;
+  gimple_call stack_save;
   location_t start_locus = 0, end_locus = 0;
 
   tree temp = voidify_wrapper_expr (bind_expr, NULL);
@@ -1116,7 +1116,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
   stack_save = NULL;
   if (gimplify_ctxp->save_stack)
     {
-      gimple stack_restore;
+      gimple_call stack_restore;
 
       /* Save stack on entry and restore it on exit.  Add a try_finally
 	 block to achieve this.  */
@@ -1153,7 +1153,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
 
   if (cleanup)
     {
-      gimple gs;
+      gimple_try gs;
       gimple_seq new_body;
 
       new_body = NULL;
@@ -1484,7 +1484,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
       vec<tree> labels;
       vec<tree> saved_labels;
       tree default_case = NULL_TREE;
-      gimple gimple_switch;
+      gimple_switch gimple_switch;
 
       /* If someone can be bothered to fill in the labels, they can
 	 be bothered to null out the body too.  */
@@ -1504,7 +1504,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
 
       if (!default_case)
 	{
-	  gimple new_default;
+	  gimple_label new_default;
 
 	  default_case
 	    = build_case_label (NULL_TREE, NULL_TREE,
@@ -2957,7 +2957,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
   enum gimplify_status ret;
   tree label_true, label_false, label_cont;
   bool have_then_clause_p, have_else_clause_p;
-  gimple gimple_cond;
+  gimple_cond gimple_cond;
   enum tree_code pred_code;
   gimple_seq seq = NULL;
 
@@ -4059,7 +4059,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 	{
 	  tree lhs = TREE_OPERAND (*expr_p, 0);
 	  tree rhs = TREE_OPERAND (*expr_p, 1);
-	  gimple init = gimple_build_assign (lhs, rhs);
+	  gimple_assign init = gimple_build_assign (lhs, rhs);
 	  gimplify_seq_add_stmt (pre_p, init);
 	  *expr_p = NULL;
 	}
@@ -5208,7 +5208,7 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p)
 	    }
 	  else
 	    {
-	      gimple_statement_try *gtry;
+	      gimple_try gtry;
 	      gimple_seq seq;
 	      enum gimple_try_flags kind;
 
@@ -5280,8 +5280,8 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p)
 	   val
       */
       tree flag = create_tmp_var (boolean_type_node, "cleanup");
-      gimple ffalse = gimple_build_assign (flag, boolean_false_node);
-      gimple ftrue = gimple_build_assign (flag, boolean_true_node);
+      gimple_assign ffalse = gimple_build_assign (flag, boolean_false_node);
+      gimple_assign ftrue = gimple_build_assign (flag, boolean_true_node);
 
       cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL);
       gimplify_stmt (&cleanup, &cleanup_stmts);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index e45f234..a593cc7 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -769,7 +769,7 @@ static void
 do_goto_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod,
 		     struct leh_tf_state *tf)
 {
-  gimple x;
+  gimple_goto x;
 
   gcc_assert (q->is_label);
 
@@ -789,7 +789,7 @@ static void
 emit_post_landing_pad (gimple_seq *seq, eh_region region)
 {
   eh_landing_pad lp = region->landing_pads;
-  gimple x;
+  gimple_label x;
 
   if (lp == NULL)
     lp = gen_eh_landing_pad (region);
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 59236c4..432c2b2 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -1130,7 +1130,8 @@ insert_backedge_copies (void)
 		      || trivially_conflicts_p (bb, result, arg)))
 		{
 		  tree name;
-		  gimple stmt, last = NULL;
+		  gimple_assign stmt;
+		  gimple last = NULL;
 		  gimple_stmt_iterator gsi2;
 
 		  gsi2 = gsi_last_bb (gimple_phi_arg_edge (phi, i)->src);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 341b749..f38848c 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -490,7 +490,7 @@ take_address_of (tree obj, tree type, edge entry,
 {
   int uid;
   tree *var_p, name, addr;
-  gimple stmt;
+  gimple_assign stmt;
   gimple_seq stmts;
 
   /* Since the address of OBJ is invariant, the trees may be shared.
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index dfda10e..14d20e9 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1293,7 +1293,7 @@ static void
 replace_ref_with (gimple stmt, tree new_tree, bool set, bool in_lhs)
 {
   tree val;
-  gimple new_stmt;
+  gimple_assign new_stmt;
   gimple_stmt_iterator bsi, psi;
 
   if (gimple_code (stmt) == GIMPLE_PHI)
@@ -1562,7 +1562,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
     }
   else
     {
-      gimple init_stmt = gimple_build_assign (var, init);
+      gimple_assign init_stmt = gimple_build_assign (var, init);
       gsi_insert_on_edge_immediate (entry, init_stmt);
     }
 }
@@ -2129,7 +2129,7 @@ static gimple
 reassociate_to_the_same_stmt (tree name1, tree name2)
 {
   gimple stmt1, stmt2, root1, root2, s1, s2;
-  gimple new_stmt, tmp_stmt;
+  gimple_assign new_stmt, tmp_stmt;
   tree new_name, tmp_name, var, r1, r2;
   unsigned dist1, dist2;
   enum tree_code code;
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index d8f5031..5583322 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -294,7 +294,7 @@ void
 gimple_gen_edge_profiler (int edgeno, edge e)
 {
   tree ref, one, gcov_type_tmp_var;
-  gimple stmt1, stmt2, stmt3;
+  gimple_assign stmt1, stmt2, stmt3;
 
   ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
   one = build_int_cst (gcov_type_node, 1);
@@ -402,7 +402,7 @@ void
 gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   tree tmp1;
-  gimple stmt1, stmt2, stmt3;
+  gimple_assign stmt1, stmt2, stmt3;
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
   tree ref_ptr = tree_coverage_counter_addr (tag, base);
@@ -444,7 +444,8 @@ gimple_gen_ic_func_profiler (void)
 {
   struct cgraph_node * c_node = cgraph_node::get (current_function_decl);
   gimple_stmt_iterator gsi;
-  gimple stmt1, stmt2;
+  gimple_call stmt1;
+  gimple_assign stmt2;
   tree tree_uid, cur_func, void0;
 
   if (c_node->only_called_directly_p ())
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index cff820f..bb67cc7 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -3345,7 +3345,7 @@ scev_const_prop (void)
   basic_block bb;
   tree name, type, ev;
   gimple_phi phi;
-  gimple ass;
+  gimple_assign ass;
   struct loop *loop, *ex_loop;
   bitmap ssa_names_to_remove = NULL;
   unsigned i;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 67c4247..3cdd100 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1531,7 +1531,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
      offset such as array[var_index].  */
   if (!base)
     {
-      gimple stmt;
+      gimple_assign stmt;
       tree tmp, addr;
 
       gcc_checking_assert (gsi);
@@ -2613,7 +2613,7 @@ generate_subtree_copies (struct access *access, tree agg,
 	      || access->offset + access->size > start_offset))
 	{
 	  tree expr, repl = get_access_replacement (access);
-	  gimple stmt;
+	  gimple_assign stmt;
 
 	  expr = build_ref_for_model (loc, agg, access->offset - top_offset,
 				      access, gsi, insert_after);
@@ -2651,7 +2651,7 @@ generate_subtree_copies (struct access *access, tree agg,
 	       && (chunk_size == 0
 		   || access->offset + access->size > start_offset))
 	{
-	  gimple ds;
+	  gimple_debug ds;
 	  tree drhs = build_debug_ref_for_model (loc, agg,
 						 access->offset - top_offset,
 						 access);
@@ -2687,7 +2687,7 @@ init_subtree_with_zero (struct access *access, gimple_stmt_iterator *gsi,
 
   if (access->grp_to_be_replaced)
     {
-      gimple stmt;
+      gimple_assign stmt;
 
       stmt = gimple_build_assign (get_access_replacement (access),
 				  build_zero_cst (access->type));
@@ -2700,9 +2700,10 @@ init_subtree_with_zero (struct access *access, gimple_stmt_iterator *gsi,
     }
   else if (access->grp_to_be_debug_replaced)
     {
-      gimple ds = gimple_build_debug_bind (get_access_replacement (access),
-					   build_zero_cst (access->type),
-					   gsi_stmt (*gsi));
+      gimple_debug ds =
+	gimple_build_debug_bind (get_access_replacement (access),
+				 build_zero_cst (access->type),
+				 gsi_stmt (*gsi));
       if (insert_after)
 	gsi_insert_after (gsi, ds, GSI_NEW_STMT);
       else
@@ -2796,7 +2797,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
 
 	  if (write)
 	    {
-	      gimple stmt;
+	      gimple_assign stmt;
 
 	      if (access->grp_partial_lhs)
 		ref = force_gimple_operand_gsi (gsi, ref, true, NULL_TREE,
@@ -2807,7 +2808,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
 	    }
 	  else
 	    {
-	      gimple stmt;
+	      gimple_assign stmt;
 
 	      if (access->grp_partial_lhs)
 		repl = force_gimple_operand_gsi (gsi, repl, true, NULL_TREE,
@@ -2823,9 +2824,10 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write)
     }
   else if (write && access->grp_to_be_debug_replaced)
     {
-      gimple ds = gimple_build_debug_bind (get_access_replacement (access),
-					   NULL_TREE,
-					   gsi_stmt (*gsi));
+      gimple_debug ds =
+	gimple_build_debug_bind (get_access_replacement (access),
+				 NULL_TREE,
+				 gsi_stmt (*gsi));
       gsi_insert_after (gsi, ds, GSI_NEW_STMT);
     }
 
@@ -2925,7 +2927,7 @@ load_assign_lhs_subreplacements (struct access *lacc,
       if (lacc->grp_to_be_replaced)
 	{
 	  struct access *racc;
-	  gimple stmt;
+	  gimple_assign stmt;
 	  tree rhs;
 
 	  racc = find_access_in_subtree (sad->top_racc, offset, lacc->size);
@@ -2975,7 +2977,7 @@ load_assign_lhs_subreplacements (struct access *lacc,
 
 	  if (lacc && lacc->grp_to_be_debug_replaced)
 	    {
-	      gimple ds;
+	      gimple_debug ds;
 	      tree drhs;
 	      struct access *racc = find_access_in_subtree (sad->top_racc,
 							    offset,
@@ -3217,7 +3219,7 @@ sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi)
 	    drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR,
 				    TREE_TYPE (dlhs), drhs);
 	}
-      gimple ds = gimple_build_debug_bind (dlhs, drhs, stmt);
+      gimple_debug ds = gimple_build_debug_bind (dlhs, drhs, stmt);
       gsi_insert_before (gsi, ds, GSI_SAME_STMT);
     }
 
@@ -4730,7 +4732,8 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments)
     {
       struct ipa_parm_adjustment *adj;
       imm_use_iterator ui;
-      gimple stmt, def_temp;
+      gimple stmt;
+      gimple_debug def_temp;
       tree name, vexpr, copy = NULL_TREE;
       use_operand_p use_p;
 
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 19f2c32..6650d3c 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1903,7 +1903,8 @@ static void
 insert_clobber_before_stack_restore (tree saved_val, tree var,
 				     gimple_htab **visited)
 {
-  gimple stmt, clobber_stmt;
+  gimple stmt;
+  gimple_assign clobber_stmt;
   tree clobber;
   imm_use_iterator iter;
   gimple_stmt_iterator i;
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8e8cd57..5a10d18 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1125,7 +1125,7 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
 	  && !DECL_HAS_VALUE_EXPR_P (lhs))
 	{
 	  tree rhs = gimple_assign_rhs1 (stmt);
-	  gimple note
+	  gimple_debug note
 	    = gimple_build_debug_bind (lhs, unshare_expr (rhs), stmt);
 	  gsi_insert_after (i, note, GSI_SAME_STMT);
 	}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 81be88a..26240eb 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2193,7 +2193,7 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
       && !is_gimple_reg (lhs))
     {
       tree rhs = gimple_assign_rhs1 (stmt);
-      gimple new_stmt;
+      gimple_assign new_stmt;
 
       /* Build a new statement with the RHS and LHS exchanged.  */
       if (TREE_CODE (rhs) == SSA_NAME)
@@ -2409,7 +2409,7 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
 	  tree lhs = gimple_assign_lhs (stmt);
 	  tree rhs = gimple_assign_rhs1 (stmt);
 	  tree cached_lhs;
-	  gimple new_stmt;
+	  gimple_assign new_stmt;
 	  if (TREE_CODE (rhs) == SSA_NAME)
 	    {
 	      tree tem = SSA_NAME_VALUE (rhs);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 5d17f7b..3e2ec49 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1959,7 +1959,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
       && INTEGRAL_TYPE_P (TREE_TYPE (def1_arg1))
       && int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
     {
-      gimple newop;
+      gimple_assign newop;
       tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
       newop =
         gimple_build_assign_with_ops (code, tem, def1_arg1,
@@ -1982,7 +1982,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
       && types_compatible_p (TREE_TYPE (def1_arg1), TREE_TYPE (def2_arg1))
       && hoist_conversion_for_bitop_p (TREE_TYPE (arg1), TREE_TYPE (def1_arg1)))
     {
-      gimple newop;
+      gimple_assign newop;
       tree tem = make_ssa_name (TREE_TYPE (def1_arg1), NULL);
       newop = gimple_build_assign_with_ops (code, tem, def1_arg1, def2_arg1);
       gimple_set_location (newop, gimple_location (stmt));
@@ -2024,7 +2024,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
 	}
       else
 	{
-	  gimple newop;
+	  gimple_assign newop;
 	  tree tem;
 	  tem = make_ssa_name (TREE_TYPE (arg2), NULL);
 	  newop = gimple_build_assign_with_ops (code, tem, a, c);
@@ -2048,7 +2048,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi)
       tree cst = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg2),
 			      arg2, def1_arg2);
       tree tem;
-      gimple newop;
+      gimple_assign newop;
       if (integer_zerop (cst))
 	{
 	  gimple_assign_set_rhs1 (stmt, def1_arg1);
@@ -2256,7 +2256,7 @@ simplify_rotate (gimple_stmt_iterator *gsi)
   tree lhs;
   int i;
   bool swapped_p = false;
-  gimple g;
+  gimple_assign g;
 
   arg[0] = gimple_assign_rhs1 (stmt);
   arg[1] = gimple_assign_rhs2 (stmt);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 339e221..92b4c7c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -875,12 +875,12 @@ nonpure_call_p (gimple stmt)
 static gimple
 rewrite_reciprocal (gimple_stmt_iterator *bsi)
 {
-  gimple stmt, stmt1, stmt2;
+  gimple_assign stmt, stmt1, stmt2;
   tree name, lhs, type;
   tree real_one;
   gimple_stmt_iterator gsi;
 
-  stmt = gsi_stmt (*bsi);
+  stmt = as_a <gimple_assign> (gsi_stmt (*bsi));
   lhs = gimple_assign_lhs (stmt);
   type = TREE_TYPE (lhs);
 
@@ -910,11 +910,14 @@ rewrite_reciprocal (gimple_stmt_iterator *bsi)
 static gimple
 rewrite_bittest (gimple_stmt_iterator *bsi)
 {
-  gimple stmt, use_stmt, stmt1, stmt2;
+  gimple_assign stmt;
+  gimple stmt1;
+  gimple_assign stmt2;
+  gimple use_stmt;
   tree lhs, name, t, a, b;
   use_operand_p use;
 
-  stmt = gsi_stmt (*bsi);
+  stmt = as_a <gimple_assign> (gsi_stmt (*bsi));
   lhs = gimple_assign_lhs (stmt);
 
   /* Verify that the single use of lhs is a comparison against zero.  */
@@ -1167,7 +1170,7 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
 
   for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); )
     {
-      gimple new_stmt;
+      gimple_assign new_stmt;
       stmt = gsi_stmt (bsi);
 
       lim_data = get_lim_data (stmt);
@@ -1939,7 +1942,7 @@ execute_sm (struct loop *loop, vec<edge> exits, mem_ref_p ref)
 {
   tree tmp_var, store_flag = NULL_TREE;
   unsigned i;
-  gimple load;
+  gimple_assign load;
   struct fmt_data fmt_data;
   edge ex;
   struct lim_aux_data *lim_data;
@@ -1996,7 +1999,7 @@ execute_sm (struct loop *loop, vec<edge> exits, mem_ref_p ref)
   FOR_EACH_VEC_ELT (exits, i, ex)
     if (!multi_threaded_model_p)
       {
-	gimple store;
+	gimple_assign store;
 	store = gimple_build_assign (unshare_expr (ref->mem.ref), tmp_var);
 	gsi_insert_on_edge (ex, store);
       }
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 0a5ca59..00cbf8f 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -494,7 +494,7 @@ remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
 	  && wi::ltu_p (elt->bound, npeeled))
 	{
 	  gimple_stmt_iterator gsi = gsi_for_stmt (elt->stmt);
-	  gimple stmt = gimple_build_call
+	  gimple_call stmt = gimple_build_call
 	      (builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
 
 	  gimple_set_location (stmt, gimple_location (elt->stmt));
@@ -613,7 +613,7 @@ unloop_loops (bitmap loop_closed_ssa_invalidated,
       edge latch_edge = loop_latch_edge (loop);
       int flags = latch_edge->flags;
       location_t locus = latch_edge->goto_locus;
-      gimple stmt;
+      gimple_call stmt;
       gimple_stmt_iterator gsi;
 
       remove_exits_and_undefined_stmts (loop, n_unroll);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 0e33774..57b63dc 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6228,7 +6228,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
 {
   tree comp;
   tree op, tgt;
-  gimple ass;
+  gimple_assign ass;
   gimple_stmt_iterator bsi;
 
   /* An important special case -- if we are asked to express value of
@@ -6645,7 +6645,8 @@ remove_unused_ivs (struct ivopts_data *data)
 		    DECL_MODE (vexpr) = DECL_MODE (SSA_NAME_VAR (def));
 		  else
 		    DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (vexpr));
-		  gimple def_temp = gimple_build_debug_bind (vexpr, comp, NULL);
+		  gimple_debug def_temp =
+		    gimple_build_debug_bind (vexpr, comp, NULL);
 		  gimple_stmt_iterator gsi;
 
 		  if (gimple_code (SSA_NAME_DEF_STMT (def)) == GIMPLE_PHI)
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index edc913d..b73a9a5 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1253,7 +1253,7 @@ rewrite_phi_with_iv (loop_p loop,
 		     tree main_iv)
 {
   affine_iv iv;
-  gimple stmt;
+  gimple_assign stmt;
   gimple_phi phi = psi->phi ();
   tree atype, mtype, val, res = PHI_RESULT (phi);
 
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index a8127d5..bf3d56d 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -1127,7 +1127,7 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
 {
   HOST_WIDE_INT delta;
   tree addr, addr_base, write_p, local, forward;
-  gimple prefetch;
+  gimple_call prefetch;
   gimple_stmt_iterator bsi;
   unsigned n_prefetches, ap;
   bool nontemporal = ref->reuse_distance >= L2_CACHE_SIZE_BYTES;
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 3495a76..1010ff0 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -356,7 +356,7 @@ insert_reciprocals (gimple_stmt_iterator *def_gsi, struct occurrence *occ,
 		    tree def, tree recip_def, int threshold)
 {
   tree type;
-  gimple new_stmt;
+  gimple_assign new_stmt;
   gimple_stmt_iterator gsi;
   struct occurrence *occ_child;
 
@@ -972,7 +972,7 @@ powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
 {
   tree op0, op1, ssa_target;
   unsigned HOST_WIDE_INT digit;
-  gimple mult_stmt;
+  gimple_assign mult_stmt;
 
   if (n < POWI_TABLE_SIZE && cache[n])
     return cache[n];
@@ -1012,7 +1012,7 @@ powi_as_mults (gimple_stmt_iterator *gsi, location_t loc,
 	       tree arg0, HOST_WIDE_INT n)
 {
   tree cache[POWI_TABLE_SIZE], result, type = TREE_TYPE (arg0);
-  gimple div_stmt;
+  gimple_assign div_stmt;
   tree target;
 
   if (n == 0)
@@ -1088,7 +1088,7 @@ build_and_insert_binop (gimple_stmt_iterator *gsi, location_t loc,
 			tree arg0, tree arg1)
 {
   tree result = make_temp_ssa_name (TREE_TYPE (arg0), NULL, name);
-  gimple stmt = gimple_build_assign_with_ops (code, result, arg0, arg1);
+  gimple_assign stmt = gimple_build_assign_with_ops (code, result, arg0, arg1);
   gimple_set_location (stmt, loc);
   gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
   return result;
@@ -1118,7 +1118,8 @@ build_and_insert_cast (gimple_stmt_iterator *gsi, location_t loc,
 		       tree type, tree val)
 {
   tree result = make_ssa_name (type, NULL);
-  gimple stmt = gimple_build_assign_with_ops (NOP_EXPR, result, val, NULL_TREE);
+  gimple_assign stmt =
+    gimple_build_assign_with_ops (NOP_EXPR, result, val, NULL_TREE);
   gimple_set_location (stmt, loc);
   gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
   return result;
@@ -1495,7 +1496,8 @@ pass_cse_sincos::execute (function *fun)
 		  if (result)
 		    {
 		      tree lhs = gimple_get_lhs (stmt);
-		      gimple new_stmt = gimple_build_assign (lhs, result);
+		      gimple_assign new_stmt =
+			gimple_build_assign (lhs, result);
 		      gimple_set_location (new_stmt, loc);
 		      unlink_stmt_vdef (stmt);
 		      gsi_replace (&gsi, new_stmt, true);
@@ -1513,7 +1515,7 @@ pass_cse_sincos::execute (function *fun)
 		  if (real_minus_onep (arg0))
 		    {
                       tree t0, t1, cond, one, minus_one;
-		      gimple stmt;
+		      gimple_assign stmt;
 
 		      t0 = TREE_TYPE (arg0);
 		      t1 = TREE_TYPE (arg1);
@@ -1547,7 +1549,7 @@ pass_cse_sincos::execute (function *fun)
 		  if (result)
 		    {
 		      tree lhs = gimple_get_lhs (stmt);
-		      gimple new_stmt = gimple_build_assign (lhs, result);
+		      gimple_assign new_stmt = gimple_build_assign (lhs, result);
 		      gimple_set_location (new_stmt, loc);
 		      unlink_stmt_vdef (stmt);
 		      gsi_replace (&gsi, new_stmt, true);
@@ -1565,7 +1567,7 @@ pass_cse_sincos::execute (function *fun)
 		  if (result)
 		    {
 		      tree lhs = gimple_get_lhs (stmt);
-		      gimple new_stmt = gimple_build_assign (lhs, result);
+		      gimple_assign new_stmt = gimple_build_assign (lhs, result);
 		      gimple_set_location (new_stmt, loc);
 		      unlink_stmt_vdef (stmt);
 		      gsi_replace (&gsi, new_stmt, true);
@@ -2928,7 +2930,8 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
 {
   tree mul_result = gimple_get_lhs (mul_stmt);
   tree type = TREE_TYPE (mul_result);
-  gimple use_stmt, neguse_stmt, fma_stmt;
+  gimple use_stmt, neguse_stmt;
+  gimple_assign fma_stmt;
   use_operand_p use_p;
   imm_use_iterator imm_iter;
 
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index a767aac..dfeefbe 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -437,7 +437,8 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
 			 tree arg0, tree arg1)
 {
   tree result;
-  gimple stmt, new_stmt;
+  gimple stmt;
+  gimple_assign new_stmt;
   tree cond;
   gimple_stmt_iterator gsi;
   edge true_edge, false_edge;
@@ -1158,7 +1159,8 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
 		 gimple phi, tree arg0, tree arg1)
 {
   tree result;
-  gimple new_stmt, cond;
+  gimple_assign new_stmt;
+  gimple cond;
   gimple_stmt_iterator gsi;
   edge true_edge, false_edge;
   gimple assign;
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index a3e53c2..b36de9c 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -166,7 +166,7 @@ phiprop_insert_phi (basic_block bb, gimple_phi phi, gimple use_stmt,
   FOR_EACH_EDGE (e, ei, bb->preds)
     {
       tree old_arg, new_var;
-      gimple tmp;
+      gimple_assign tmp;
       source_location locus;
 
       old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 327faa6..cf955b8 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2784,7 +2784,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
   gimple_stmt_iterator gsi;
   tree exprtype = type ? type : get_expr_type (expr);
   pre_expr nameexpr;
-  gimple newstmt;
+  gimple_assign newstmt;
 
   switch (expr->kind)
     {
@@ -3912,9 +3912,10 @@ eliminate_insert (gimple_stmt_iterator *gsi, tree val)
     return NULL_TREE;
 
   tree res = make_temp_ssa_name (TREE_TYPE (val), NULL, "pretmp");
-  gimple tem = gimple_build_assign (res,
-				    fold_build1 (TREE_CODE (expr),
-						 TREE_TYPE (expr), leader));
+  gimple_assign tem =
+    gimple_build_assign (res,
+			 fold_build1 (TREE_CODE (expr),
+				      TREE_TYPE (expr), leader));
   gsi_insert_before (gsi, tem, GSI_SAME_STMT);
   VN_INFO_GET (res)->valnum = val;
 
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 6ed41bd..20f7554 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -739,7 +739,7 @@ bool
 update_gimple_call (gimple_stmt_iterator *si_p, tree fn, int nargs, ...)
 {
   va_list ap;
-  gimple new_stmt, stmt = gsi_stmt (*si_p);
+  gimple_call new_stmt, stmt = as_a <gimple_call> (gsi_stmt (*si_p));
 
   gcc_assert (is_gimple_call (stmt));
   va_start (ap, nargs);
@@ -773,7 +773,7 @@ update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
       unsigned i;
       unsigned nargs = call_expr_nargs (expr);
       vec<tree> args = vNULL;
-      gimple new_stmt;
+      gimple_call new_stmt;
 
       if (nargs > 0)
         {
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 524dc53..5b951d7 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1318,7 +1318,7 @@ build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode)
   gimple op1def = NULL, op2def = NULL;
   gimple_stmt_iterator gsi;
   tree op;
-  gimple sum;
+  gimple_assign sum;
 
   /* Create the addition statement.  */
   op = make_ssa_name (type, NULL);
@@ -2706,8 +2706,9 @@ update_ops (tree var, enum tree_code code, vec<operand_entry_t> ops,
     {
       gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
       var = make_ssa_name (TREE_TYPE (var), NULL);
-      gimple g = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt),
-					       var, rhs[2], rhs[3]);
+      gimple_assign g =
+	gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt),
+				      var, rhs[2], rhs[3]);
       gimple_set_uid (g, gimple_uid (stmt));
       gimple_set_visited (g, true);
       gsi_insert_before (&gsi, g, GSI_SAME_STMT);
@@ -3005,7 +3006,7 @@ maybe_optimize_range_tests (gimple stmt)
 		      tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL);
 		      enum tree_code rhs_code
 			= gimple_assign_rhs_code (cast_stmt);
-		      gimple g;
+		      gimple_assign g;
 		      if (is_gimple_min_invariant (new_op))
 			{
 			  new_op = fold_convert (TREE_TYPE (lhs), new_op);
@@ -3392,7 +3393,7 @@ get_reassociation_width (int ops_num, enum tree_code opc,
    parallel.  */
 
 static void
-rewrite_expr_tree_parallel (gimple stmt, int width,
+rewrite_expr_tree_parallel (gimple_assign stmt, int width,
 			    vec<operand_entry_t> ops)
 {
   enum tree_code opcode = gimple_assign_rhs_code (stmt);
@@ -4533,7 +4534,8 @@ reassociate_bb (basic_block bb)
 
 		  if (width > 1
 		      && ops.length () > 3)
-		    rewrite_expr_tree_parallel (stmt, width, ops);
+		    rewrite_expr_tree_parallel (as_a <gimple_assign> (stmt),
+						width, ops);
 		  else
                     {
                       /* When there are three operands left, we want
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 6babaee..a85dff9 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -436,7 +436,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
 	;
       else
 	{
-	  gimple def_temp;
+	  gimple_debug def_temp;
 	  tree vexpr = make_node (DEBUG_EXPR_DECL);
 
 	  def_temp = gimple_build_debug_bind (vexpr,
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 89d4a01..692b0d1 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -318,7 +318,7 @@ emit_case_bit_tests (gimple_switch swtch, tree index_expr,
   unsigned int branch_num = gimple_switch_num_labels (swtch);
 
   gimple_stmt_iterator gsi;
-  gimple shift_stmt;
+  gimple_assign shift_stmt;
 
   tree idx, tmp, csui;
   tree word_type_node = lang_hooks.types.type_for_mode (word_mode, 1);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index ff8236d..bfe5b24 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -643,7 +643,7 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
 
   tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
   tree result = make_temp_ssa_name (ret_type, NULL, label);
-  gimple stmt;
+  gimple_assign stmt;
 
   if (POINTER_TYPE_P (ret_type))
     {
@@ -680,7 +680,7 @@ static tree
 update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
 			     gimple_stmt_iterator gsi)
 {
-  gimple stmt;
+  gimple_assign stmt;
   tree var = copy_ssa_name (acc, NULL);
   if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
     stmt = gimple_build_assign_with_ops (code, var, acc, op1);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 4c3e161..5140992 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4326,7 +4326,7 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi,
   struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   tree update = TYPE_SIZE_UNIT (vectype);
-  gimple incr_stmt;
+  gimple_assign incr_stmt;
   ssa_op_iter iter;
   use_operand_p use_p;
   tree new_dataref_ptr;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index dd3a9b8..1797118 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -6794,7 +6794,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
   /* Handle cond expr.  */
   for (j = 0; j < ncopies; j++)
     {
-      gimple new_stmt = NULL;
+      gimple_assign new_stmt = NULL;
       if (j == 0)
 	{
           if (slp_node)
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 289f0ba..bd4fff6 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4606,7 +4606,7 @@ static gimple
 build_assert_expr_for (tree cond, tree v)
 {
   tree a;
-  gimple assertion;
+  gimple_assign assertion;
 
   gcc_assert (TREE_CODE (v) == SSA_NAME
 	      && COMPARISON_CLASS_P (cond));
@@ -8725,7 +8725,8 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
   else if (need_conversion)
     {
       tree tem = make_ssa_name (TREE_TYPE (op0), NULL);
-      gimple newop = gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
+      gimple_assign newop =
+	gimple_build_assign_with_ops (BIT_XOR_EXPR, tem, op0, op1);
       gsi_insert_before (gsi, newop, GSI_SAME_STMT);
       gimple_assign_set_rhs_with_ops (gsi, NOP_EXPR, tem, NULL_TREE);
     }
@@ -9404,7 +9405,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
   enum machine_mode fltmode = TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt)));
   enum machine_mode mode;
   tree tem;
-  gimple conv;
+  gimple_assign conv;
 
   /* We can only handle constant ranges.  */
   if (vr->type != VR_RANGE
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index dde0418..bc4f501 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -925,7 +925,7 @@ instrument_mem_ref (tree mem, tree base, gimple_stmt_iterator *iter,
     ikind = UBSAN_MEMBER_ACCESS;
   tree kind = build_int_cst (TREE_TYPE (t), ikind);
   tree alignt = build_int_cst (pointer_sized_int_node, align);
-  gimple g = gimple_build_call_internal (IFN_UBSAN_NULL, 3, t, kind, alignt);
+  gimple_call g = gimple_build_call_internal (IFN_UBSAN_NULL, 3, t, kind, alignt);
   gimple_set_location (g, gimple_location (gsi_stmt (*iter)));
   gsi_insert_before (iter, g, GSI_SAME_STMT);
 }
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 0b2ec7f..e5ccf48 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -127,10 +127,11 @@ along with GCC; see the file COPYING3.  If not see
      and gimple_value_profile_transformations table-driven, perhaps...
 */
 
-static tree gimple_divmod_fixed_value (gimple, tree, int, gcov_type, gcov_type);
-static tree gimple_mod_pow2 (gimple, int, gcov_type, gcov_type);
-static tree gimple_mod_subtract (gimple, int, int, int, gcov_type, gcov_type,
-				 gcov_type);
+static tree gimple_divmod_fixed_value (gimple_assign, tree, int, gcov_type,
+				       gcov_type);
+static tree gimple_mod_pow2 (gimple_assign, int, gcov_type, gcov_type);
+static tree gimple_mod_subtract (gimple_assign, int, int, int, gcov_type,
+				 gcov_type, gcov_type);
 static bool gimple_divmod_fixed_value_transform (gimple_stmt_iterator *);
 static bool gimple_mod_pow2_value_transform (gimple_stmt_iterator *);
 static bool gimple_mod_subtract_transform (gimple_stmt_iterator *);
@@ -726,10 +727,11 @@ gimple_value_profile_transformations (void)
    alter the original STMT.  */
 
 static tree
-gimple_divmod_fixed_value (gimple stmt, tree value, int prob, gcov_type count,
-			   gcov_type all)
+gimple_divmod_fixed_value (gimple_assign stmt, tree value, int prob,
+			   gcov_type count, gcov_type all)
 {
-  gimple stmt1, stmt2, stmt3;
+  gimple_assign stmt1, stmt2;
+  gimple_cond stmt3;
   tree tmp0, tmp1, tmp2;
   gimple bb1end, bb2end, bb3end;
   basic_block bb, bb2, bb3, bb4;
@@ -813,10 +815,10 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si)
   gcov_type val, count, all;
   tree result, value, tree_val;
   gcov_type prob;
-  gimple stmt;
+  gimple_assign stmt;
 
-  stmt = gsi_stmt (*si);
-  if (gimple_code (stmt) != GIMPLE_ASSIGN)
+  stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+  if (!stmt)
     return false;
 
   if (!INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))))
@@ -889,9 +891,10 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si)
    within roundoff error).  This generates the result into a temp and returns
    the temp; it does not replace or alter the original STMT.  */
 static tree
-gimple_mod_pow2 (gimple stmt, int prob, gcov_type count, gcov_type all)
+gimple_mod_pow2 (gimple_assign stmt, int prob, gcov_type count, gcov_type all)
 {
-  gimple stmt1, stmt2, stmt3, stmt4;
+  gimple_assign stmt1, stmt2, stmt3;
+  gimple_cond stmt4;
   tree tmp2, tmp3;
   gimple bb1end, bb2end, bb3end;
   basic_block bb, bb2, bb3, bb4;
@@ -975,10 +978,10 @@ gimple_mod_pow2_value_transform (gimple_stmt_iterator *si)
   gcov_type count, wrong_values, all;
   tree lhs_type, result, value;
   gcov_type prob;
-  gimple stmt;
+  gimple_assign stmt;
 
-  stmt = gsi_stmt (*si);
-  if (gimple_code (stmt) != GIMPLE_ASSIGN)
+  stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+  if (!stmt)
     return false;
 
   lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
@@ -1041,10 +1044,12 @@ gimple_mod_pow2_value_transform (gimple_stmt_iterator *si)
 /* FIXME: Generalize the interface to handle NCOUNTS > 1.  */
 
 static tree
-gimple_mod_subtract (gimple stmt, int prob1, int prob2, int ncounts,
+gimple_mod_subtract (gimple_assign stmt, int prob1, int prob2, int ncounts,
 		     gcov_type count1, gcov_type count2, gcov_type all)
 {
-  gimple stmt1, stmt2, stmt3;
+  gimple_assign stmt1;
+  gimple stmt2;
+  gimple_cond stmt3;
   tree tmp1;
   gimple bb1end, bb2end = NULL, bb3end;
   basic_block bb, bb2, bb3, bb4;
@@ -1147,10 +1152,10 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si)
   gcov_type prob1, prob2;
   unsigned int i, steps;
   gcov_type count1, count2;
-  gimple stmt;
+  gimple_assign stmt;
 
-  stmt = gsi_stmt (*si);
-  if (gimple_code (stmt) != GIMPLE_ASSIGN)
+  stmt = dyn_cast <gimple_assign> (gsi_stmt (*si));
+  if (!stmt)
     return false;
 
   lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
@@ -1369,7 +1374,9 @@ gimple
 gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
 	   int prob, gcov_type count, gcov_type all)
 {
-  gimple dcall_stmt, load_stmt, cond_stmt;
+  gimple dcall_stmt;
+  gimple_assign load_stmt;
+  gimple_cond cond_stmt;
   tree tmp0, tmp1, tmp;
   basic_block cond_bb, dcall_bb, icall_bb, join_bb = NULL;
   tree optype = build_pointer_type (void_type_node);
-- 
1.8.5.3

