1. 31 Jul, 2018 40 commits
    • [17/46] Make LOOP_VINFO_REDUCTIONS an auto_vec<stmt_vec_info> · 32c91dfc
      This patch changes LOOP_VINFO_REDUCTIONS from an auto_vec<gimple *>
      to an auto_vec<stmt_vec_info>.  It also changes the associated
      vect_force_simple_reduction so that it takes and returns stmt_vec_infos
      instead of gimple stmts.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (_loop_vec_info::reductions): Change from an
      	auto_vec<gimple *> to an auto_vec<stmt_vec_info>.
      	(vect_force_simple_reduction): Take and return stmt_vec_infos rather
      	than gimple stmts.
      	* tree-parloops.c (valid_reduction_p): Take a stmt_vec_info instead
      	of a gimple stmt.
      	(gather_scalar_reductions): Update after above interface changes.
      	* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise.
      	(vect_is_simple_reduction): Take and return stmt_vec_infos rather
      	than gimple stmts.
      	(vect_force_simple_reduction): Likewise.
      	* tree-vect-patterns.c (vect_pattern_recog_1): Update use of
      	LOOP_VINFO_REDUCTIONS.
      	* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
      
      From-SVN: r263132
      Richard Sandiford committed
    • [16/46] Make STMT_VINFO_REDUC_DEF a stmt_vec_info · 542ad08c
      This patch changes STMT_VINFO_REDUC_DEF from a gimple stmt to a
      stmt_vec_info.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (_stmt_vec_info::reduc_def): Change from
      	a gimple stmt to a stmt_vec_info.
      	* tree-vect-loop.c (vect_active_double_reduction_p)
      	(vect_force_simple_reduction, vectorizable_reduction): Update
      	accordingly.
      
      From-SVN: r263131
      Richard Sandiford committed
    • [15/46] Make SLP_TREE_VEC_STMTS a vec<stmt_vec_info> · 16edaeb8
      This patch changes SLP_TREE_VEC_STMTS from a vec<gimple *> to a
      vec<stmt_vec_info>.  This involved making the same change to the
      phis vector in vectorizable_reduction, since SLP_TREE_VEC_STMTS is
      spliced into it here:
      
        phis.splice (SLP_TREE_VEC_STMTS (slp_node_instance->reduc_phis));
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (_slp_tree::vec_stmts): Change from a
      	vec<gimple *> to a vec<stmt_vec_info>.
      	* tree-vect-loop.c (vect_create_epilog_for_reduction): Change
      	the reduction_phis argument from a vec<gimple *> to a
      	vec<stmt_vec_info>.
      	(vectorizable_reduction): Likewise the phis local variable that
      	is passed to vect_create_epilog_for_reduction.  Update for new type
      	of SLP_TREE_VEC_STMTS.
      	(vectorizable_induction): Update for new type of SLP_TREE_VEC_STMTS.
      	(vectorizable_live_operation): Likewise.
      	* tree-vect-slp.c (vect_get_slp_vect_defs): Likewise.
      	(vect_transform_slp_perm_load, vect_schedule_slp_instance): Likewise.
      
      From-SVN: r263130
      Richard Sandiford committed
    • [14/46] Make STMT_VINFO_VEC_STMT a stmt_vec_info · 1eede195
      This patch changes STMT_VINFO_VEC_STMT from a gimple stmt to a
      stmt_vec_info and makes the vectorizable_* routines pass back
      a stmt_vec_info to vect_transform_stmt.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Change from
      	a gimple stmt to a stmt_vec_info.
      	(vectorizable_condition, vectorizable_live_operation)
      	(vectorizable_reduction, vectorizable_induction): Pass back the
      	vectorized statement as a stmt_vec_info.
      	* tree-vect-data-refs.c (vect_record_grouped_load_vectors): Update
      	use of STMT_VINFO_VEC_STMT.
      	* tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise,
      	accumulating the inner phis that feed the STMT_VINFO_VEC_STMT
      	as stmt_vec_infos rather than gimple stmts.
      	(vectorize_fold_left_reduction): Change vec_stmt from a gimple stmt
      	to a stmt_vec_info.
      	(vectorizable_live_operation): Likewise.
      	(vectorizable_reduction, vectorizable_induction): Likewise,
      	updating use of STMT_VINFO_VEC_STMT.
      	* tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Update use
      	of STMT_VINFO_VEC_STMT.
      	(vect_build_gather_load_calls, vectorizable_bswap, vectorizable_call)
      	(vectorizable_simd_clone_call, vectorizable_conversion)
      	(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
      	(vectorizable_store, vectorizable_load, vectorizable_condition)
      	(vectorizable_comparison, can_vectorize_live_stmts): Change vec_stmt
      	from a gimple stmt to a stmt_vec_info.
      	(vect_transform_stmt): Update use of STMT_VINFO_VEC_STMT.  Pass a
      	pointer to a stmt_vec_info to the vectorizable_* routines.
      
      From-SVN: r263129
      Richard Sandiford committed
    • [13/46] Make STMT_VINFO_RELATED_STMT a stmt_vec_info · 10681ce8
      This patch changes STMT_VINFO_RELATED_STMT from a gimple stmt to a
      stmt_vec_info.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (_stmt_vec_info::related_stmt): Change from
      	a gimple stmt to a stmt_vec_info.
      	(is_pattern_stmt_p): Update accordingly.
      	* tree-vect-data-refs.c (vect_preserves_scalar_order_p): Likewise.
      	(vect_record_grouped_load_vectors): Likewise.
      	* tree-vect-loop.c (vect_determine_vf_for_stmt): Likewise.
      	(vect_fixup_reduc_chain, vect_update_vf_for_slp): Likewise.
      	(vect_model_reduction_cost): Likewise.
      	(vect_create_epilog_for_reduction): Likewise.
      	(vectorizable_reduction, vectorizable_induction): Likewise.
      	* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
      	Return the stmt_vec_info for the pattern statement.
      	(vect_set_pattern_stmt): Update use of STMT_VINFO_RELATED_STMT.
      	(vect_split_statement, vect_mark_pattern_stmts): Likewise.
      	* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise.
      	(vect_detect_hybrid_slp, vect_get_slp_defs): Likewise.
      	* tree-vect-stmts.c (vect_mark_relevant): Likewise.
      	(vect_get_vec_def_for_operand_1, vectorizable_call): Likewise.
      	(vectorizable_simd_clone_call, vect_analyze_stmt, new_stmt_vec_info)
      	(free_stmt_vec_info, vect_is_simple_use): Likewise.
      
      From-SVN: r263128
      Richard Sandiford committed
    • [12/46] Make vect_finish_stmt_generation return a stmt_vec_info · e1bd7296
      This patch makes vect_finish_replace_stmt and vect_finish_stmt_generation
      return the stmt_vec_info for the vectorised statement, so that the caller
      doesn't need a separate vinfo_for_stmt to get at it.
      
      This involved changing the structure of the statement-generating loops
      so that they use narrow scopes for the vectorised gimple statements
      and use the existing (wider) scopes for the associated stmt_vec_infos.
      This helps with gimple stmt->stmt_vec_info changes further down the line.
      
      The way we do this generation is another area ripe for clean-up,
      but that's too much of a rabbit-hole for this series.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vect_finish_replace_stmt): Return a stmt_vec_info
      	(vect_finish_stmt_generation): Likewise.
      	* tree-vect-stmts.c (vect_finish_stmt_generation_1): Likewise.
      	(vect_finish_replace_stmt, vect_finish_stmt_generation): Likewise.
      	(vect_build_gather_load_calls): Use the return value of the above
      	functions instead of a separate call to vinfo_for_stmt.  Use narrow
      	scopes for the input gimple stmt and wider scopes for the associated
      	stmt_vec_info.  Use vec_info::lookup_def when setting these
      	stmt_vec_infos from an SSA_NAME definition.
      	(vectorizable_bswap, vectorizable_call, vectorizable_simd_clone_call)
      	(vect_create_vectorized_demotion_stmts, vectorizable_conversion)
      	(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
      	(vectorizable_store, vectorizable_load, vectorizable_condition)
      	(vectorizable_comparison): Likewise.
      	* tree-vect-loop.c (vectorize_fold_left_reduction): Likewise.
      	(vectorizable_reduction): Likewise.
      
      From-SVN: r263127
      Richard Sandiford committed
    • [11/46] Pass back a stmt_vec_info from vect_is_simple_use · fef96d8e
      This patch makes vect_is_simple_use pass back a stmt_vec_info to
      those callers that want it.  Most users only need the stmt_vec_info
      but some need the gimple stmt too.
      
      It's probably high time we added a class to represent "simple operands"
      instead, but I have a separate series that tries to clean up how
      operands are handled (with a view to allowing mixed vector sizes).
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vect_is_simple_use): Add an optional
      	stmt_vec_info * parameter before the optional gimple **.
      	* tree-vect-stmts.c (vect_is_simple_use): Likewise.
      	(process_use, vect_get_vec_def_for_operand_1): Update callers.
      	(vect_get_vec_def_for_operand, vectorizable_shift): Likewise.
      	* tree-vect-loop.c (vectorizable_reduction): Likewise.
      	(vectorizable_live_operation): Likewise.
      	* tree-vect-patterns.c (type_conversion_p): Likewise.
      	(vect_look_through_possible_promotion): Likewise.
      	(vect_recog_rotate_pattern): Likewise.
      	* tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.
      
      From-SVN: r263126
      Richard Sandiford committed
    • [10/46] Temporarily make stmt_vec_info a class · dbe1b846
      This patch turns stmt_vec_info into an unspeakably bad wrapper class
      and adds an implicit conversion to the associated gimple stmt.
      Having this conversion makes the rest of the series easier to write,
      but since the class goes away again at the end of the series, I've
      not bothered adding any comments or tried to make it pretty.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (stmt_vec_info): Temporarily change from
      	a typedef to a wrapper class.
      	(NULL_STMT_VEC_INFO): New macro.
      	(vec_info::stmt_infos): Change to vec<stmt_vec_info>.
      	(stmt_vec_info::operator*): New function.
      	(stmt_vec_info::operator gimple *): Likewise.
      	(set_vinfo_for_stmt): Use NULL_STMT_VEC_INFO.
      	(add_stmt_costs): Likewise.
      	* tree-vect-loop-manip.c (iv_phi_p): Likewise.
      	* tree-vect-loop.c (vect_compute_single_scalar_iteration_cost)
      	(vect_get_known_peeling_cost): Likewise.
      	(vect_estimate_min_profitable_iters): Likewise.
      	* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
      	* tree-vect-slp.c (vect_remove_slp_scalar_calls): Likewise.
      	* tree-vect-stmts.c (vect_build_gather_load_calls): Likewise.
      	(vectorizable_store, free_stmt_vec_infos): Likewise.
      	(new_stmt_vec_info): Change return type of xcalloc to
      	_stmt_vec_info *.
      
      From-SVN: r263125
      Richard Sandiford committed
    • [09/46] Add vec_info::lookup_single_use · 0d0a4e20
      This patch adds a helper function for seeing whether there is a single
      user of an SSA name, and whether that user has a stmt_vec_info.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vec_info::lookup_single_use): Declare.
      	* tree-vectorizer.c (vec_info::lookup_single_use): New function.
      	* tree-vect-loop.c (vectorizable_reduction): Use it instead of
      	a single_imm_use-based sequence.
      	* tree-vect-stmts.c (supportable_widening_operation): Likewise.
      
      From-SVN: r263124
      Richard Sandiford committed
    • [08/46] Add vec_info::lookup_def · c98d0595
      This patch adds a vec_info helper for checking whether an operand is an
      SSA_NAME that is defined in the vectorisable region.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vec_info::lookup_def): Declare.
      	* tree-vectorizer.c (vec_info::lookup_def): New function.
      	* tree-vect-patterns.c (vect_get_internal_def): Use it.
      	(vect_widened_op_tree): Likewise.
      	* tree-vect-stmts.c (vect_is_simple_use): Likewise.
      	* tree-vect-loop.c (vect_analyze_loop_operations): Likewise.
      	(vectorizable_reduction): Likewise.
      	(vect_valid_reduction_input_p): Take a stmt_vec_info instead
      	of a gimple *.
      	(vect_is_slp_reduction): Update calls accordingly.  Use
      	vec_info::lookup_def.
      	(vect_is_simple_reduction): Likewise
      	* tree-vect-slp.c (vect_detect_hybrid_slp_1): Use vec_info::lookup_def.
      
      From-SVN: r263123
      Richard Sandiford committed
    • [07/46] Add vec_info::lookup_stmt · 6585ff8f
      This patch adds a vec_info replacement for vinfo_for_stmt.  The main
      difference is that the new routine can cope with arbitrary statements,
      so there's no need to call vect_stmt_in_region_p first.
      
      The patch only converts calls that are still needed at the end of the
      series.  Later patches get rid of most other calls to vinfo_for_stmt.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vec_info::lookup_stmt): Declare.
      	* tree-vectorizer.c (vec_info::lookup_stmt): New function.
      	* tree-vect-loop.c (vect_determine_vf_for_stmt): Use it instead
      	of vinfo_for_stmt.
      	(vect_determine_vectorization_factor, vect_analyze_scalar_cycles_1)
      	(vect_compute_single_scalar_iteration_cost, vect_analyze_loop_form)
      	(vect_update_vf_for_slp, vect_analyze_loop_operations)
      	(vect_is_slp_reduction, vectorizable_induction)
      	(vect_transform_loop_stmt, vect_transform_loop): Likewise.
      	* tree-vect-patterns.c (vect_init_pattern_stmt):
      	(vect_determine_min_output_precision_1, vect_determine_precisions)
      	(vect_pattern_recog): Likewise.
      	* tree-vect-stmts.c (vect_analyze_stmt, vect_transform_stmt): Likewise.
      	* config/powerpcspe/powerpcspe.c (rs6000_density_test): Likewise.
      	* config/rs6000/rs6000.c (rs6000_density_test): Likewise.
      	* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise.
      	(vect_detect_hybrid_slp_1, vect_detect_hybrid_slp_2)
      	(vect_detect_hybrid_slp): Likewise.  Change the walk_stmt_info
      	info field from a loop to a loop_vec_info.
      
      From-SVN: r263122
      Richard Sandiford committed
    • [06/46] Add vec_info::add_stmt · 4fbeb363
      This patch adds a vec_info function for allocating and setting
      stmt_vec_infos.  It's the start of a long process of removing
      the global stmt_vec_info array.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (stmt_vec_info): Move typedef earlier in file.
      	(vec_info::add_stmt): Declare.
      	* tree-vectorizer.c (vec_info::add_stmt): New function.
      	* tree-vect-data-refs.c (vect_create_data_ref_ptr): Use it.
      	* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Likewise.
      	(vect_create_epilog_for_reduction, vectorizable_reduction): Likewise.
      	(vectorizable_induction): Likewise.
      	* tree-vect-slp.c (_bb_vec_info::_bb_vec_info): Likewise.
      	* tree-vect-stmts.c (vect_finish_stmt_generation_1): Likewise.
      	(vectorizable_simd_clone_call, vectorizable_store): Likewise.
      	(vectorizable_load): Likewise.
      	* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
      	(vect_recog_bool_pattern, vect_recog_mask_conversion_pattern)
      	(vect_recog_gather_scatter_pattern): Likewise.
      	(append_pattern_def_seq): Likewise.  Remove a check that is
      	performed by add_stmt itself.
      
      From-SVN: r263121
      Richard Sandiford committed
    • [05/46] Fix make_ssa_name call in vectorizable_reduction · 79cc8302
      The usual vectoriser dance to create new assignments is:
      
          new_stmt = gimple_build_assign (vec_dest, ...);
          new_temp = make_ssa_name (vec_dest, new_stmt);
          gimple_assign_set_lhs (new_stmt, new_temp);
      
      but one site in vectorizable_reduction used:
      
          new_temp = make_ssa_name (vec_dest, new_stmt);
      
      before creating new_stmt.
      
      This method of creating statements probably needs cleaning up, but
      that's for another day...
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vect-loop.c (vectorizable_reduction): Fix an instance in
      	which make_ssa_name was called with new_stmt before new_stmt
      	had been created.
      
      From-SVN: r263120
      Richard Sandiford committed
    • [04/46] Factor out the test for a valid reduction input · 83a400d0
      vect_is_slp_reduction and vect_is_simple_reduction had two instances
      each of:
      
                    && (is_gimple_assign (def_stmt)
                        || is_gimple_call (def_stmt)
                        || STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
                                 == vect_induction_def
                        || (gimple_code (def_stmt) == GIMPLE_PHI
                            && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
                                        == vect_internal_def
                            && !is_loop_header_bb_p (gimple_bb (def_stmt)))))
      
      This patch splits it out in a subroutine.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vect-loop.c (vect_valid_reduction_input_p): New function,
      	split out from...
      	(vect_is_slp_reduction): ...here...
      	(vect_is_simple_reduction): ...and here.  Remove repetition of tests
      	that are already known to be false.
      
      From-SVN: r263119
      Richard Sandiford committed
    • [03/46] Remove unnecessary update of NUM_SLP_USES · 6e2dd807
      vect_free_slp_tree had:
      
        gimple *stmt;
        FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
          /* After transform some stmts are removed and thus their vinfo is gone.  */
          if (vinfo_for_stmt (stmt))
            {
      	gcc_assert (STMT_VINFO_NUM_SLP_USES (vinfo_for_stmt (stmt)) > 0);
      	STMT_VINFO_NUM_SLP_USES (vinfo_for_stmt (stmt))--;
            }
      
      But after transform this update is redundant even for statements that do
      exist, so it seems better to skip this loop for the final teardown.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vect_free_slp_instance): Add a final_p parameter.
      	* tree-vect-slp.c (vect_free_slp_tree): Likewise.  Don't update
      	STMT_VINFO_NUM_SLP_USES when it's true.
      	(vect_free_slp_instance): Add a final_p parameter and pass it to
      	vect_free_slp_tree.
      	(vect_build_slp_tree_2): Update call to vect_free_slp_instance.
      	(vect_analyze_slp_instance): Likewise.
      	(vect_slp_analyze_operations): Likewise.
      	(vect_slp_analyze_bb_1): Likewise.
      	* tree-vectorizer.c (vec_info): Likewise.
      	* tree-vect-loop.c (vect_transform_loop): Likewise.
      
      From-SVN: r263118
      Richard Sandiford committed
    • [02/46] Remove dead vectorizable_reduction code · ac1359be
      vectorizable_reduction has old code to cope with cases in which the
      given statement belongs to a reduction group but isn't the first statement.
      That can no longer happen, since all statements in the group go into the
      same SLP node, and we only check the first statement in each node.
      
      The point is to remove the only path through vectorizable_reduction
      in which stmt and stmt_info refer to different statements.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vect-loop.c (vectorizable_reduction): Assert that the
      	function is not called for second and subsequent members of
      	a reduction group.
      
      From-SVN: r263117
      Richard Sandiford committed
    • [01/46] Move special cases out of get_initial_def_for_reduction · 0847049d
      This minor clean-up avoids repeating the test for double reductions
      and also moves the vect_get_vec_def_for_operand call to the same
      function as the corresponding vect_get_vec_def_for_stmt_copy.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vect-loop.c (get_initial_def_for_reduction): Move special
      	cases for nested loops from here to ...
      	(vect_create_epilog_for_reduction): ...here.  Only call
      	vect_is_simple_use for inner-loop reductions.
      
      From-SVN: r263116
      Richard Sandiford committed
    • P1008R1 - prohibit aggregates with user-declared constructors · 686dca76
      	P1008R1 - prohibit aggregates with user-declared constructors
      	* class.c (check_bases_and_members): For C++2a set
      	CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
      	type_has_user_provided_or_explicit_constructor.
      
      	* g++.dg/ext/is_aggregate.C: Add tests with deleted or defaulted ctor.
      	* g++.dg/cpp0x/defaulted1.C (main): Ifdef out for C++2a B b = {1};.
      	* g++.dg/cpp0x/deleted2.C: Expect error for C++2a.
      	* g++.dg/cpp2a/aggr1.C: New test.
      	* g++.dg/cpp2a/aggr2.C: New test.
      
      From-SVN: r263115
      Jakub Jelinek committed
    • arm: Testcase for PR86640 · 8810325f
      
      gcc/testsuite/
      	PR target/86640
      	* gcc.target/arm/pr86640.c: New testcase.
      
      From-SVN: r263114
      Segher Boessenkool committed
    • GCOV: add cache for streamed locations. · e2844b13
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR gcov-profile/85338
              PR gcov-profile/85350
              PR gcov-profile/85372
              * profile.c (struct location_triplet): New.
      	(struct location_triplet_hash): Likewise.
      	(output_location): Do not output a BB that
              is already recorded for a line.
      	(branch_prob): Use streamed_locations.
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR gcov-profile/85338
              PR gcov-profile/85350
              PR gcov-profile/85372
      	* gcc.misc-tests/gcov-pr85338.c: New test.
      	* gcc.misc-tests/gcov-pr85350.c: New test.
      	* gcc.misc-tests/gcov-pr85372.c: New test.
      
      From-SVN: r263113
      Martin Liska committed
    • Fix target clones (PR gcov-profile/85370). · 80dde427
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR gcov-profile/85370
      	* coverage.c (coverage_begin_function): Do not mark target
              clones as artificial functions.
      
      From-SVN: r263112
      Martin Liska committed
    • Fix GCOV CFG related issues. · 102fcf94
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR gcov-profile/83813
              PR gcov-profile/84758
              PR gcov-profile/85217
              PR gcov-profile/85332
      	* profile.c (branch_prob): Do not record GOTO expressions
              for GIMPLE statements which locations are already streamed.
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR gcov-profile/83813
              PR gcov-profile/84758
              PR gcov-profile/85217
              PR gcov-profile/85332
      	* gcc.misc-tests/gcov-pr83813.c: New test.
      	* gcc.misc-tests/gcov-pr84758.c: New test.
      	* gcc.misc-tests/gcov-pr85217.c: New test.
      	* gcc.misc-tests/gcov-pr85332.c: New test.
      
      From-SVN: r263111
      Martin Liska committed
    • Fix an UBSAN error in cp/parse.c (PR c++/86653). · 5dbc3940
      2018-07-31  Martin Liska  <mliska@suse.cz>
      
              PR c++/86653
      	* parser.c (cp_parser_condition): Initialize non_constant_p
              to false.
      
      From-SVN: r263110
      Martin Liska committed
    • [Ada] Various code clean-ups from CodePeer messages · ae71d81b
      2018-07-31  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* clean.adb, gnatchop.adb, gnatfind.adb, gnatls.adb,
      	gnatmake.ads, gnatxref.adb, make.adb, make.ads, make_util.ads,
      	sfn_scan.adb, vxaddr2line.adb, xeinfo.adb, xoscons.adb,
      	xr_tabls.adb, xref_lib.adb: Address CodePeer messages.
      
      From-SVN: r263108
      Arnaud Charlet committed
    • [Ada] Fix potential Constraint_Error if Library_Version is too long · 1c0b35aa
      2018-07-31  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* gnatlink.adb: Fix potential Constraint_Error if
      	Library_Version is too long.
      
      From-SVN: r263107
      Arnaud Charlet committed
    • [Ada] Sem_Elab: remove duplicate condition · fa9f3f8c
      2018-07-31  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* sem_elab.adb: Remove duplicate condition detected by CodePeer.
      
      From-SVN: r263106
      Arnaud Charlet committed
    • [Ada] Unnesting: improve support for entries in protected objects · 0d756922
      2018-07-31  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_unst.adb (Subp_Index): In the case of a protected
      	operation, the relevant entry is the generated
      	protected_subprogram_body into which the original body is
      	rewritten. Assorted cleanup and optimizations.
      
      From-SVN: r263105
      Ed Schonberg committed
    • [Ada] Refine generation of range checks to happen in front end · 948071fa
      2018-07-31  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_attr.adb (Expand_Attribute, case Fixed_Value): Set the
      	base type of the result to ensure that proper overflow and range
      	checks are generated.  If the target is a fixed-point tyoe,
      	generate the required overflow and range checks explicitly,
      	rather than relying on Apply_Type_Conversion_Checks, which might
      	simply set the Do_Range_Check flag and rely on the backend to
      	add the check.
      
      From-SVN: r263104
      Ed Schonberg committed
    • [Ada] Secondary stack leak with access-to-subprogram · 51d4bdfb
      This patch modifies call resolution to recognize when the designated type of
      an access-to-subprogram requires secondary stack management, and establish
      the proper transient block.
      
      ------------
      -- Source --
      ------------
      
      --  leak7.adb
      
      procedure Leak7 is
         Max_Iterations : constant := 10_000;
      
         function Func return String is
         begin
            return "Will this leak? Or will it dry?";
         end Func;
      
         type Func_Ptr is access function return String;
      
         procedure Anonymous_Leak (Func : access function return String) is
         begin
            for Iteration in 1 .. Max_Iterations loop
               declare
                  Val : constant String := Func.all;
               begin null; end;
            end loop;
         end Anonymous_Leak;
      
         procedure Named_Leak (Func : Func_Ptr) is
         begin
            for Iteration in 1 .. Max_Iterations loop
               declare
                  Val : constant String := Func.all;
               begin null; end;
            end loop;
         end Named_Leak;
      
      begin
         Anonymous_Leak (Func'Access);
         Named_Leak     (Func'Access);
      end Leak7;
      
      ----------------------------
      -- Compilation and output --
      ----------------------------
      
      $ gnatmake -q leak7.adb
      $ valgrind ./leak7 >& leak7.txt
      $ grep -c "still reachable" leak7.txt
      0
      
      2018-07-31  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* sem_res.adb (Resolve_Call): Establish a transient scope to
      	manage the secondary stack when the designated type of an
      	access-to-subprogram requires it.
      
      From-SVN: r263103
      Hristian Kirtchev committed
    • [Ada] Unnesting: find local subps in nested stmt sequences · 51f2fc7d
      2018-07-31  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada
      
      	* exp_ch7.adb (Check_Unnesting_Elaboration_Code): To find local
      	subprograms in the elaboration code for a package body, recurse
      	through nested statement sequences because a compiler-generated
      	procedure may appear within a condition statement.
      
      From-SVN: r263102
      Ed Schonberg committed
    • [Ada] Spurious error on default parameter in protected operation · 6cdce506
      This patch fixes a spurious compiler error on a call to a protected
      operation whose profile includes a defaulted in-parameter that is a call
      to another protected function of the same object.
      
      2018-07-31  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_ch6.adb (Expand_Protected_Subprogram_Call): Handle
      	properly a protected call that includes a default parameter that
      	is a call to a protected function of the same type.
      
      gcc/testsuite/
      
      	* gnat.dg/prot5.adb, gnat.dg/prot5_pkg.adb,
      	gnat.dg/prot5_pkg.ads: New testcase.
      
      From-SVN: r263101
      Ed Schonberg committed
    • [Ada] GNATmake fails to detect missing body · c992e2e4
      This patch corrects an issue whereby building a multi-unit compilation with
      missing sources resulted in a cryptic "code generation" error instead of the
      appropriate file not found error.
      
      ------------
      -- Source --
      ------------
      
      --  main.adb
      
      with Types;
      procedure Main is
      begin
         null;
      end;
      
      --  types.ads
      
      package Types is
        procedure Force;
      end;
      
      ----------------------------
      -- Compilation and output --
      ----------------------------
      
      & gnatmake -q main.adb
      gnatmake: "types.adb" not found
      
      2018-07-31  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* lib-writ.adb (Write_With_Lines): Modfiy the generation of
      	dependencies within ali files so that source unit bodies are
      	properly listed even if said bodies are missing.  Perform legacy
      	behavior in GNATprove mode.
      	* lib-writ.ads: Modify documentation to reflect current behavior.
      
      From-SVN: r263100
      Justin Squirek committed
    • [Ada] Fix alignment of mutex_t and cond_t type on 32-bit SPARC/Solaris · a6ed513c
      The alignment of the couple of types from System.OS_Interface was wrongly
      set to 4 (32-bit) instead of 8 (64-bit) in 32-bit mode.
      
      2018-07-31  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	*  libgnarl/s-osinte__solaris.ads (upad64_t): New private type.
      	(mutex_t): Use it for 'lock' and 'data' components.
      	(cond_t): Likewise for 'data' and use single 'flags' component.
      
      From-SVN: r263099
      Eric Botcazou committed
    • [Ada] Wrong value after assignment of overlain record objects · a7576e13
      This patch corrects an issue whereby objects of a record type with a
      representation clause which are overlain by address would fail to get
      assigned values properly when one or both of said objects were marked
      volatile.
      
      2018-07-31  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* exp_ch5.adb (Make_Field_Assign): Force temporarily generated
      	objects for assignment of overlaid user objects to be renamings
      	instead of constant declarations.
      
      gcc/testsuite/
      
      	* gnat.dg/addr11.adb: New testcase.
      
      From-SVN: r263098
      Justin Squirek committed
    • [Ada] Spurious error on the placement of aspect Global · 007443a0
      This patch modifies the expansion of stand-alone subprogram bodies that appear
      in the body of a protected type to properly associate aspects and pragmas to
      the newly created spec for the subprogram body. As a result, the annotations
      are properly associated with the initial declaration of the subprogram.
      
      2018-07-31  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch9.adb (Analyze_Pragmas): New routine.
      	(Build_Private_Protected_Declaration): Code clean up. Relocate
      	relevant aspects and pragmas from the stand-alone body to the
      	newly created spec.  Explicitly analyze any pragmas that have
      	been either relocated or produced by the analysis of the
      	aspects.
      	(Move_Pragmas): New routine.
      	* sem_prag.adb (Find_Related_Declaration_Or_Body): Recognize the
      	case where a pragma applies to the internally created spec for a
      	stand-along subprogram body declared in a protected body.
      
      gcc/testsuite/
      
      	* gnat.dg/global.adb, gnat.dg/global.ads: New testcase.
      
      From-SVN: r263097
      Hristian Kirtchev committed
    • [Ada] Compiler failure on an extended_return_statement in a block · 76ed5f08
      When compiling with an assertion-enabled compiler, Assert_Failure can be
      raised when expanded an extended_return_statement whose enclosing scope
      is not a function (such as when it's a block_statement). The simple fix
      is to change the Assert to test Current_Subprogram rather than Current_Scope.
      Three such Assert pragmas are corrected in this way.
      
      2018-07-31  Gary Dismukes  <dismukes@adacore.com>
      
      gcc/ada/
      
      	* exp_ch6.adb (Expand_N_Extended_Return_Statement): Replace
      	calls to Current_Scope in three assertions with calls to
      	Current_Subprogram.
      
      gcc/testsuite/
      
      	* gnat.dg/block_ext_return_assert_failure.adb: New testcase.
      
      From-SVN: r263096
      Gary Dismukes committed
    • [Ada] Spurious warning on iteration over range of 64-bit modular type · c4a2e585
      This patch suppresses a spurious warning on the use of a 64-bit modular type
      in a quantified expression, where the range of iteration will include a bound
      that appears larger than the run-time representation of Universal_Integer'last.
      
      2018-07-31  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_eval.adb (Check_Non_Static_Context): Do not warn on an
      	integer literal greater than the upper bound of
      	Universal_Integer'Last when expansion is disabled, to avoid a
      	spurious warning over ranges involving 64-bit modular types.
      
      gcc/testsuite/
      
      	* gnat.dg/iter3.adb: New testcase.
      
      From-SVN: r263095
      Ed Schonberg committed
    • [Ada] Print the Is_Activation_Record flag · 1e739bf7
      2018-07-31  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* einfo.adb (Write_Entity_Flags): Also print
      	Is_Activation_Record flag.
      
      From-SVN: r263094
      Arnaud Charlet committed
    • [Ada] Replace low-level calls to Ekind with high-level calls to Is_Formal · bb6a856b
      High-level wrappers are easier to read. This change came up while reading
      some code related to GNATprove, but then uniformly applied to the entire
      frontend. For the few remaining membership tests that could be replaced
      by Is_Formal it is not obvious whether the high-level routine makes the
      code better.
      
      2018-07-31  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* exp_aggr.adb, exp_ch4.adb, exp_ch6.adb, lib-xref.adb,
      	repinfo.adb, sem_ch9.adb: Minor replace Ekind membership tests
      	with a wrapper routine.
      
      From-SVN: r263093
      Piotr Trojanek committed
    • [Ada] Deconstruct 'F' as a prefix for an ALI data · e8723e74
      In GNATprove we used to store a variant of cross-reference information in
      the ALI file in lines that started with an 'F' letter. This is no longer
      the case, so the letter can be returned to the pool of unused prefixes.
      
      2018-07-31  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* ali.adb (Known_ALI_Lines): Remove 'F' as a prefix for lines
      	related to the FORMAL analysis done by GNATprove.
      
      From-SVN: r263092
      Piotr Trojanek committed