Use gassign * rather than gimple in various places

Use gassign * everywhere that a stmt is built from a
gimple_build_assign_* call, to ease making the gimple_assign_
accessors typesafe (and to better document the code).

gcc/ChangeLog.gimple-classes:
	* asan.c (build_shadow_mem_access): Strengthen local "g" from
	gimple to gassign *.
	(maybe_create_ssa_name): Likewise.
	(maybe_cast_to_ptrmode): Likewise.
	(instrument_mem_region_access): Likewise.
	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Likewise
	for local "set_stmt".
	* cgraphunit.c (cgraph_node::expand_thunk): Likewise for locals
	"stmt".
	* gimple-fold.c (gimplify_and_update_call_from_tree): Likewise for
	local "new_stmt".
	(gimple_fold_builtin_memory_op): Likewise for both "new_stmt" and
	for locals "repl".
	(gimple_fold_builtin_memset): Likewise for "store".
	(gimple_fold_builtin_memset): Likewise for "asgn".
	* gimple-match-head.c (maybe_push_res_to_seq): Likewise for
	"new_stmt".
	* gimplify.c (gimplify_bind_expr): Likewise for "clobber_stmt".
	* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_dependence):
	Likewise for "name_stmt".
	* ipa-prop.c (ipa_modify_call_arguments): Likewise. for "tem".
	* ipa-split.c (split_function): Likewise for "cpy".
	* predict.c (pass_strip_predict_hints::execute): Likewise for
	"ass_stmt".
	* trans-mem.c (tm_log_emit_saves): Likewise for "stmt".
	(tm_log_emit_restores): Likewise.
	(build_tm_load): Likewise for "g".
	(build_tm_store): Likewise.
	* tree-call-cdce.c (gen_conditions_for_pow_int_base): Likewise for
	"stmt1".  Strengthen local "stmt2" from gimple to gcond *.
	* tree-cfg.c (make_blocks): Strengthen local "s" from gimple to
	gassign *.
	(handle_abnormal_edges): Likewise for "assignment".
	* tree-emutls.c (lower_emutls_1): Likewise for "x".
	* tree-if-conv.c (ifc_temp_var): Likewise for "stmt".
	(convert_scalar_cond_reduction): Likewise for "new_assign".
	(predicate_scalar_phi): Likewise for "new_stmt".
	* tree-inline.c (remap_ssa_name): Likewise for "init_stmt".
	(copy_bb): Likewise for "new_stmt".
	(setup_one_parameter): Likewise for "init_stmt".
	* tree-loop-distribution.c (generate_memset_builtin): Likewise for
	"cstmt".
	* tree-nested.c (init_tmp_var): Likewise for "stmt".
	(save_tmp_var): Likewise.
	* tree-parloops.c (create_loads_for_reductions): Likewise.
	(create_final_loads_for_reduction): Likewise.
	(create_stores_for_reduction): Likewise.
	(create_loads_and_stores_for_name): Likewise.
	* tree-ssa-dse.c (dse_optimize_stmt): Likewise for "new_stmt".
	* tree-ssa-forwprop.c (associate_pointerplus): Likewise for
	"ostmt".
	* tree-ssa-loop-im.c (sm_set_flag_if_changed::operator): Likewise
	for "stmt".
	* tree-ssa-math-opts.c (execute_cse_sincos_1): Eliminate local
	"stmt", splitting its users into new local gcall * "call_stmt"
	and gassign * "assign_stmt".
	(build_and_insert_ref): Strengthen local "stmt" from gimple to
	gassign *.
	(bswap_replace): Likewise for "load_stmt", "addr_stmt",
	"convert_stmt".
	* tree-ssa-phiopt.c (neg_replacement): Likewise for "new_stmt".
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Likewise for "stmt".
	* tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Likewise
	for "g".
	* tree-ssa-strlen.c (get_string_length): ELiminate local
	"lenstmt", splitting its users into new local gcall * "call_stmt"
	and gassign * "assign_stmt".
	(handle_builtin_memset): Strengthen local "assign" from gimple to
	gassign *.
	* tree-switch-conversion.c (build_one_array): Likewise for "load".
	(build_arrays): Likewise for "stmt".
	* tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise for
	"vec_stmt".
	(vect_permute_store_chain): Likewise for "perm_stmt".
	(vect_permute_load_chain): Likewise.
	(vect_shift_permute_load_chain): Likewise.
	* tree-vect-generic.c (expand_vector_divmod): Likewise for "stmt".
	(vector_element): Likewise for "asgn".
	* tree-vect-loop-manip.c (vect_create_cond_for_align_checks):
	Likewise for "and_stmt".
	(vect_create_cond_for_align_checks): Likewise for "addr_stmt" and
	"or_stmt".
	* tree-vect-loop.c (vect_is_simple_reduction_1): Likewise for
	"negate_stmt".
	(get_initial_def_for_induction): Likewise for "init_stmt" and
	"new_stmt".
	(vectorizable_reduction): Likewise for "new_stmt".
	* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Likewise for
	"pattern_stmt".
	(vect_recog_sad_pattern): Likewise.
	(vect_recog_widen_mult_pattern): Likewise for "new_stmt",
	"pattern_stmt".
	(vect_recog_widen_sum_pattern): Likewise for "pattern_stmt".
	(vect_recog_over_widening_pattern): Likewise.
	(vect_recog_widen_shift_pattern): Likewise.
	* tree-vect-slp.c (vect_get_constant_vectors): Likewise for
	"init_stmt".
	(vect_create_mask_and_perm): Likewise for "perm_stmt".
	(vect_schedule_slp_instance): Likewise for "new_stmt".
	* tree-vect-stmts.c (read_vector_array): Likewise.
	(write_vector_array): Likewise.
	(vect_init_vector): Likewise for "init_stmt".
	(vectorizable_call): Likewise.
	* tree-vrp.c (simplify_internal_call_using_ranges): Likewise for
	"g".
	* tsan.c (instrument_expr): Split local gimple "g" into more
	tightly-scoped locals, two of type gassign *, one of gcall *.
Make replace_call_with_call_and_fold work on a gcall *

gcc/ChangeLog.gimple-classes:
	* gimple-fold.c (replace_call_with_call_and_fold): Strengthen
	param "repl" from gimple to gcall *.
	(gimple_fold_builtin_strcpy): Likewise for local "repl".
	(gimple_fold_builtin_strncpy): Likewise.
	(gimple_fold_builtin_strcat): Likewise.
	(gimple_fold_builtin_strcat): Likewise.
	(gimple_fold_builtin_strcat_chk): Likewise.
	(gimple_fold_builtin_strncat_chk): Likewise.
	(gimple_fold_builtin_fputs): Likewise.
	(gimple_fold_builtin_memory_chk): Likewise.
	(gimple_fold_builtin_stxcpy_chk): Likewise.
	(gimple_fold_builtin_stxncpy_chk): Likewise.
gimple-low.c: Use gcall * in a few places

gcc/ChangeLog.gimple-classes:
	* gimple-low.c (lower_builtin_setjmp): Strengthen local "stmt"
	from gimple to gcall *, via a checked cast.
	(lower_builtin_posix_memalign): Likewise for local "call".
	Strengthen local "cond" from gimple to gcond *.
	Split local gimple "stmt" into new locals "assign_stmt1",
	"call_stmt", and "assign_stmt2", of appropriate types.
Use gcall * in more places

gcc/ChangeLog.gimple-classes:
	* config/i386/i386.c (add_condition_to_bb): Strengthen local
	"call_cond_stmt" from gimple to gcall *.
	* gimple-fold.c (gimple_build): Likewise for local "stmt".
	* gimple-match-head.c (maybe_push_res_to_seq): Likewise for local
	"new_stmt".
	* tree-cfgcleanup.c (fixup_noreturn_call): Likewise for param
	"stmt".
	* tree-ssa-math-opts.c (bswap_replace): Likewise for local "call".
	* tree-ssa-propagate.c (update_call_from_tree): Likewise for local "stmt",
	adding a checked cast.
	* ubsan.c (instrument_si_overflow): Likewise for local "g".
More gcall *

gcc/ChangeLog.gimple-classes:
	* gimple.c (gimple_set_lhs): Add checked casts to gassign * and
	gcall * as appropriate.
	* tree-cfg.c (execute_fixup_cfg): Introduce local "call_stmt"
	via a dyn_cast and use it in place of "stmt" where appropriate
	* tree-cfgcleanup.c (split_bb_on_noreturn_calls): Strengthen
	local "stmt" from gimple to gcall *, replacing an is_gimple_call
	with a dyn_cast.
	* tree-cfgcleanup.h (fixup_noreturn_call): Strengthen param from
	gimple to gcall *.
	* tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace
	is_gimple_call with a dyn_cast, introducing local "call_stmt" and
	using it in place of "stmt" for typesafety.
	* tree-ssa-propagate.c (finish_update_gimple_call): Strengthen
	params "new_stmt" and "stmt" from gimple to gcall *.
Yet more gcall *

gcc/ChangeLog.gimple-classes:
	* tree-ssa-forwprop.c (simplify_builtin_call): Strengthen local
	"stmt2" from gimple to gcall * via a checked cast.  Replace
	is_gimple_call with a dyn_cast, introducing local "call_stmt1",
	and using the latter in place of "stmt1" for typesafety.
	Introduce another local "call_stmt1" for typesafety via a
	checked cast within the if (callee1) block, which is only
	reachable if we have a GIMPLE_CALL.
	* tree-ssa-reassoc.c (attempt_builtin_powi): Strengthen local
	"pow_stmt" from gimple to gcall *.
	* tree-ssa-strlen.c (get_string_length): Likewise for local
	"stmt", via a checked cast.
Add casting variants of various gimple_assign_*_p functions

Use them to provide various gimple_assign_ accessors with
gassign * rather than plain gimple.

gcc/ChangeLog.gimple-classes:
	* gimple.h (is_a_helper <const gassign *>::test): New.
	(gimple_assign_copy_p): Update return type from bool to
	gassign *, returning GS if the predicate holds.
	(gimple_assign_ssa_name_copy_p): Likewise.
	(gimple_assign_single_p): Likewise for new non-const overload.
	(gimple_assign_load_p): Likewise.
	(gimple_assign_cast_p): Introduce local "assign" via dyn_cast,
	using it in place of "s" for typesafety.
	(gimple_clobber_p): Introduce local "assign" via call to
	gimple_assign_single_p, using it in place of "s" for typesafety.

	* asan.c (maybe_instrument_assignment): Strengthen local "s" from
	gimple to gassign * via a checked cast.
	* gimple-walk.c (walk_stmt_load_store_addr_ops): Introduce local
	"assign" via call to gimple_assign_single_p, using it in place of
	"stmt" for typesafety.
	* gimple.c (gimple_assign_copy_p): Update return type from bool to
	gassign *, returning GS if the predicate holds.
	(gimple_assign_ssa_name_copy_p): Likewise.
	* ipa-polymorphic-call.c (extr_type_from_vtbl_ptr_store):
	Likewise, replacing local "stmt".
	* ipa-prop.c (extr_type_from_vtbl_ptr_store): Likewise.
	(load_from_unmodified_param): Likewise.
	(get_ancestor_addr_info): Rename gimple param "assign" to "stmt",
	reintroducing name "assign" as a gassign * via a call to
	gimple_assign_single_p.
	(get_ssa_def_if_simple_copy): Introduce local "assign" via call to
	gimple_assign_single_p, using it in place of "def_stmt" for
	typesafety.
	(determine_locally_known_aggregate_parts): Likewise for "stmt".
	(ipa_get_stmt_member_ptr_load_param): Likewise.
	(ipcp_modif_dom_walker::before_dom_children): Strengthen local
	"stmt" from gimple to gassign * via use of gimple_assign_load_p.
	* tree-if-conv.c (ifcvt_can_use_mask_load_store): Introduce local
	"assign" via call to gimple_assign_single_p, using it in place of
	"stmt" for typesafety.
	(predicate_mem_writes): Strengthen local "stmt" from gimple to
	gassign * via use of gimple_assign_single_p.
	* tree-inline.c (remap_gimple_stmt): Introduce local "assign" via
	call to gimple_assign_copy_p, using it in place of "stmt" for
	typesafety.
	* tree-nrv.c (pass_nrv::execute): Likewise.
	* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Likewise
	via call to gimple_assign_ssa_name_copy_p.
	* tree-ssa-copyrename.c (pass_rename_ssa_copies::execute):
	Likewise.
	* tree-ssa-loop-niter.c (get_val_for): Likewise.
	* tree-vect-stmts.c (exist_non_indexing_operands_for_use_p):
	Likewise via call to gimple_assign_copy_p.
tree-ssa-forwprop.c: Use gassign * in various places

gcc/ChangeLog.gimple-classes:
	* tree-ssa-forwprop.c (get_prop_source_stmt): Strengthen return
	type and local "def_stmt" from gimple to gassign *, using a
	dyn_cast in place of an is_gimple_assign.
	(can_propagate_from): Strengthen param from gimple to gassign *.
	(forward_propagate_into_comparison_1): Likewise for locals named
	"def_stmt".
	(forward_propagate_into_cond): Likewise.
	(simplify_bitwise_binary_1): Introduce local "assign", using it in
	place of "def" for typesafety.
	(associate_plusminus): Strengthen local "stmt" from gimple to
	gassign *.  Likewise for locals "def_stmt", using dyn_casts in
	place of is_gimple_assign calls.  Likewise for local "def_stmt2".
	(associate_pointerplus): Likewise.
	(simplify_bitfield_ref): Strengthen local "def_stmt" from gimple
	to gassign *.
	(simplify_permutation): Likewise, also for local "def_stmt2".
	(simplify_vector_constructor): Likewise.
	(pass_forwprop::execute): Strengthen local "stmt" from gimple to
	gassign *, using a dyn_cast in place of an is_gimple_assign.
auto-profile.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* auto-profile.c (afdo_propagate_circuit): Replace a check for
	GIMPLE_ASSIGN within the while loop with a dyn_cast, introducing
	a local "def_assign", using it in place of "stmt" for typesafety.
	This involves replacing the series of while conditions in the head
	of the while into a list of conditionals within its body that
	break out of the loop, thus requiring the conditions to be
	negated.
gimplify-me.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* gimplify-me.c (gimple_regimplify_operands): Replace a couple of
	is_gimple_assign calls with dyn_cast, introducing locals
	"assign_stmt" and using them in place of "stmt" for typesafety.
gimple-ssa-isolate-paths.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* gimple-ssa-isolate-paths.c
	(insert_trap_and_remove_trailing_statements): Replace a call to
	is_gimple_assign with a dyn_cast, introducing a local
	"assign_stmt", and using it in place of "stmt" for typesafety.
gimple-fold.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* gimple-fold.c (fold_gimple_assign): Strengthen local "stmt" from
	gimple to gassign * via a checked cast.
	(gsi_replace_with_seq_vops): Add a checked cast within region
	guarded by gimple_assign_single_p.
	(get_maxval_strlen): Within case GIMPLE_ASSIGN, introduce local
	gassign * "def_assign" via a checked cast, and use it in place of
	"def_stmt" for typesafety.
	(replace_stmt_with_simplification): Add a checked cast.
	(fold_stmt_1): In two switch statements, within case
	GIMPLE_ASSIGN, introduce locals gassign * "assign_stmt" via
	checked casts, and use them in place of "stmt" for typesafety.
	(same_bool_comparison_p): Replace "is_gimple_assign" with
	dyn_cast, introducing local "assign_s" and using it in place of
	"s" for typesafety.
	(and_var_with_comparison): Strengthen local "stmt" from gimple to
	gassign * by replacing an is_gimple_assign with a dyn_cast.
	(and_var_with_comparison_1): Strengthen param "stmt" and local "s"
	from gimple to gassign *, replacing is_gimple_assign calls with
	dyn_cast.
	(or_var_with_comparison): Strengthen local "stmt" from gimple to
	gassign * by replacing an is_gimple_assign with a dyn_cast.
	(or_var_with_comparison_1): Strengthen param "stmt" and local "s"
	from gimple to gassign *, replacing is_gimple_assign calls with
	dyn_cast.
	(gimple_fold_stmt_to_constant_1): Within case GIMPLE_ASSIGN,
	introduce local "assign_stmt" and use in place of "stmt" for
	typesafety.
	(gimple_val_nonnegative_real_p): Replace is_gimple_assign with a
	dyn_cast, introducing local "def_assign" and using it in place of
	"def_stmt" for typesafety.
rewrite_to_defined_overflow takes a gassign *

gcc/ChangeLog.gimple-classes:
	* gimple-fold.h (rewrite_to_defined_overflow): Strengthen from
	gimple to gassign *.
	* gimple-fold.c (rewrite_to_defined_overflow): Likewise.
	* tree-scalar-evolution.c (scev_const_prop): Replace
	is_gimple_assign with a dyn_cast, introducing local "assign_stmt"
	and using it in place of "stmt" for typesafety.
	* tree-ssa-loop-im.c
	(move_computations_dom_walker::before_dom_children): Likewise.
gimple-match-head.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* gimple-match-head.c (gimple_simplify): Within
	case GIMPLE_ASSIGN, introduce local "assign_stmt" via a checked
	cast and use it in place of "stmt" for typesafety.
graphite-sese-to-poly.c: Use gasssign

gcc/ChangeLog.gimple-classes:
	* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps): Add
	checked cast.
	(is_reduction_operation_p): Strengthen param from gimple to
	gassign *.
	(follow_ssa_with_commutative_ops): Replace is_gimple_assign with
	a dyn_cast, introducing local "assign_stmt" and using it in place
	of "stmt" for typesafety.
	(detect_commutative_reduction_assign): Strengthen param "stmt" from
	gimple to gassign *.
	(detect_commutative_reduction): Add checked cast.
	(translate_scalar_reduction_to_array_for_stmt): Strengthen param
	"stmt" from gimple to gassign *.
	(close_phi_written_to_memory): Add checked cast.
	(translate_scalar_reduction_to_array): Likewise.
tree-object-size.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* tree-object-size.c (plus_stmt_object_size): Strengthen param
	"stmt" from gimple to gassign *.
	(cond_expr_object_size): Likewise.
	(collect_object_sizes_for): Within case GIMPLE_ASSIGN, introduce
	local gassign * "assign_stmt" and use in place of "stmt" for
	typesafety.
	(check_for_plus_in_loops_1): Likewise.
	(check_for_plus_in_loops): Replace is_gimple_assign with a
	dyn_cast, strengthening local "stmt" from gimple to gassign *.
tree-affine.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* tree-affine.c (aff_combination_expand): Replace is_gimple_assign
	with a dyn_cast, strengthening local "def" from gimple to
	gassign *.
tree-call-cdce.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* tree-call-cdce.c (check_pow): Replace check against
	GIMPLE_ASSIGN with a dyn_cast, strengthening local "base_def" from
	gimple to gassign *.
	(gen_conditions_for_pow_int_base): Add a checked cast.
tree-data-ref.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* tree-data-ref.c (split_constant_offset_1): Replace check against
	GIMPLE_ASSIGN with a dyn_cast, strengthening local "def_stmt" from
	gimple to gassign *.
	(get_references_in_stmt): Likewise, introducing local
	"assign_stmt" and using it in place of "stmt" for typesafety.
tree-if-conv.c: Use gassign

gcc/ChangeLog.gimple-classes:
	* tree-if-conv.c (parse_predicate): Replace is_gimple_assign
	with a dyn_cast, strengthening local "s" from gimple to gassign *.
	(if_convertible_gimple_assign_stmt_p): Strengthen param "stmt"
	from gimple to gassign *.
	(if_convertible_stmt_p): Add a checked cast within
	case GIMPLE_ASSIGN.
	(is_cond_scalar_reduction): Strengthen output param "reduc" from
	gimple * to gassign **.  Replace check against GIMPLE_ASSIGN with
	a dyn_cast, introducing local gassign * "assign_stmt", using it in
	place of "stmt" for typesafety.
	(convert_scalar_cond_reduction): Strengthen param "reduc" from
	gimple to gassign *.
	(predicate_scalar_phi): Likewise for local "reduc".