Commit Graph

163752 Commits

Author SHA1 Message Date
Martin Liska
bb79aba479 Improve switch code emission for a balanced tree (PR tree-optimization/86847).
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86847
	* tree-switch-conversion.c (switch_decision_tree::dump_case_nodes):
        Dump also subtree probability.
	(switch_decision_tree::do_jump_if_equal): New function.
	(switch_decision_tree::emit_case_nodes): Handle special
        situations in balanced tree that can be emitted much simpler.
        Fix calculation of probabilities that happen in tree expansion.
	* tree-switch-conversion.h (struct cluster): Add
        is_single_value_p.
	(struct simple_cluster): Likewise.
	(struct case_tree_node): Add new function has_child.
	(do_jump_if_equal): New.
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86847
	* gcc.dg/tree-ssa/switch-3.c: New test.
	* gcc.dg/tree-ssa/vrp105.c: Remove.

From-SVN: r263879
2018-08-27 12:21:11 +00:00
Martin Liska
377afcd5be Fix probability for bit-tests.
2018-08-27  Martin Liska  <mliska@suse.cz>

	* tree-switch-conversion.c (bit_test_cluster::find_bit_tests):
        Add new argument to bit_test_cluster constructor.
	(bit_test_cluster::emit): Set bits really number of values
        handlel by a test.
	(bit_test_cluster::hoist_edge_and_branch_if_true): Add
        probability argument.
	* tree-switch-conversion.h (struct bit_test_cluster):
        Add m_handles_entire_switch.
2018-08-27  Martin Liska  <mliska@suse.cz>

	* gcc.dg/tree-ssa/switch-2.c: New test.

From-SVN: r263878
2018-08-27 12:18:24 +00:00
Martin Liska
dbdfaaba50 Fix probabilities for jump table (PR tree-optimization/86702).
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86702
	* tree-switch-conversion.c (jump_table_cluster::emit):
        Make probabilities even for values in jump table
        according to number of cases handled.
	(switch_decision_tree::compute_cases_per_edge): Pass
        argument to reset_out_edges_aux function.
	(switch_decision_tree::analyze_switch_statement): Likewise.
	* tree-switch-conversion.h (switch_decision_tree::reset_out_edges_aux):
        Make it static.

From-SVN: r263877
2018-08-27 12:17:54 +00:00
Martin Liska
61ff5d6f4e Add new gswitch related functions into tree-cfg.c.
2018-08-27  Martin Liska  <mliska@suse.cz>

	* cfgexpand.c (expand_asm_stmt): Use label_to_block and pass
        cfun argument explicitly.
	* gimple-pretty-print.c (dump_gimple_switch): Likewise.
	* hsa-gen.c (gen_hsa_insns_for_switch_stmt): Use new
        function gimple_switch_default_bb.
	(convert_switch_statements):
	(expand_builtins):
	* ipa-fnsummary.c (set_switch_stmt_execution_predicate):
	* stmt.c (label_to_block_fn): Use label_to_block and pass
        cfun argument explicitly and use gimple_switch_label_bb.
	(expand_case): Likewise.
	* tree-cfg.c (lower_phi_internal_fn): Use label_to_block and pass
        cfun argument explicitly. Likewise.
	(make_edges_bb): Likewise.
	(make_cond_expr_edges): Likewise.
	(get_cases_for_edge): Likewise.
	(make_gimple_switch_edges): Likewise.
	(label_to_block_fn): Likewise.
	(label_to_block): Likewise.
	(make_goto_expr_edges): Likewise.
	(make_gimple_asm_edges): Likewise.
	(main_block_label): Likewise.
	(group_case_labels_stmt): Likewise.
	(find_taken_edge_computed_goto): Likewise.
	(find_taken_edge_switch_expr): Likewise.
	(gimple_verify_flow_info): Likewise.
	(gimple_redirect_edge_and_branch): Likewise.
	(gimple_switch_label_bb): New function.
	(gimple_switch_default_bb): Likewise.
	(gimple_switch_edge): Likewise.
	(gimple_switch_default_edge): Likewise.
	* tree-cfg.h (label_to_block_fn): Remove and replace ...
	(label_to_block): ... with this.
	(gimple_switch_label_bb): New.
	(gimple_switch_default_bb): Likewise.
	(gimple_switch_edge): Likewise.
	(gimple_switch_default_edge): Likewise.
	* tree-cfgcleanup.c (convert_single_case_switch): Use
        new gimple functions and pass new argument to label_to_block.
	(cleanup_control_flow_bb):
	* tree-eh.c (make_eh_dispatch_edges): Use label_to_block and pass
        cfun argument explicitly.
	(make_eh_edges): Likewise.
	(redirect_eh_dispatch_edge): Likewise.
	(lower_resx): Likewise.
	(lower_eh_dispatch): Likewise.
	(maybe_remove_unreachable_handlers): Likewise.
	(unsplit_eh): Likewise.
	(cleanup_empty_eh): Likewise.
	(verify_eh_edges): Likewise.
	(verify_eh_dispatch_edge): Likewise.
	* tree-ssa-dom.c (record_edge_info): Likewise.
	* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
	* tree-ssa-threadedge.c (thread_around_empty_blocks): Likewise.
	(thread_through_normal_block): Likewise.
	* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
	* tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
	* tree-switch-conversion.c (switch_conversion::collect): Use new
        gimple functions.
	(switch_conversion::check_final_bb): Likewise.
	(switch_conversion::gather_default_values): Pass new argument
        to label_to_block.
	(switch_conversion::build_constructors): Likewise.
	(switch_decision_tree::compute_cases_per_edge): Use new
        gimple_switch_edge function.
	(switch_decision_tree::analyze_switch_statement): Pass new argument
        to label_to_block.
	(switch_decision_tree::try_switch_expansion): Use
        gimple_switch_default_edge.
	* tree-vrp.c (find_switch_asserts): Pass new argument
        to label_to_block.
	* vr-values.c (vr_values::vrp_visit_switch_stmt): Likewise.
	(vr_values::simplify_switch_using_ranges): Likewise.

From-SVN: r263876
2018-08-27 12:17:19 +00:00
Richard Biener
78ea9abc20 cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
2018-08-27  Richard Biener  <rguenther@suse.de>

	* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
	* cfganal.c (rev_post_order_and_mark_dfs_back_seme): New function.

	* tree-ssa-sccvn.h (struct vn_pval): New structure.
	(struct vn_nary_op_s): Add unwind_to member.  Add
	predicated_values flag and put result into a union together
	with a linked list of vn_pval.
	(struct vn_ssa_aux): Add name member to make maintaining
	a map of SSA name to vn_ssa_aux possible.  Remove no longer
	needed info, dfsnum, low, visited, on_sccstack, use_processed
	and range_info_anti_range_p members.
	(run_scc_vn, vn_eliminate, free_scc_vn, vn_valueize): Remove.
	(do_rpo_vn, run_rpo_vn, eliminate_with_rpo_vn, free_rpo_vn):
	New functions.
	(vn_valueize): New global.
	(vn_context_bb): Likewise.
	(VN_INFO_RANGE_INFO, VN_INFO_ANTI_RANGE_P, VN_INFO_RANGE_TYPE,
	VN_INFO_PTR_INFO): Remove.
	* tree-ssa-sccvn.c: ... (rewrite)
	(pass_fre::execute): For -O2+ initialize loops and run
	RPO VN in optimistic mode (iterating).  For -O1 and -Og
	run RPO VN in non-optimistic mode.
	* params.def (PARAM_SCCVN_MAX_SCC_SIZE): Remove.
	(PARAM_RPO_VN_MAX_LOOP_DEPTH): Add.
	* doc/invoke.texi (sccvn-max-scc-size): Remove.
	(rpo-vn-max-loop-depth): Document.
	* tree-ssa-alias.c (walk_non_aliased_vuses): Stop walking
	when valuezing the VUSE signals we walked out of the region.
	* tree-ssa-pre.c (phi_translate_1): Ignore predicated values.
	(phi_translate): Set VN context block to use for availability
	lookup.
	(compute_avail): Likewise.
	(pre_valueize): New function.
	(pass_pre::execute): Adjust to the RPO VN API.

	* tree-ssa-loop-ivcanon.c: Include tree-ssa-sccvn.h.
	(propagate_constants_for_unrolling): Remove.
	(tree_unroll_loops_completely): Perform value-numbering
	on the unrolled bodies loop parent.

	* g++.dg/torture/20180705-1.C: New testcase.
	* gcc.dg/tree-ssa/ssa-fre-67.c: Likewise.
	* gcc.dg/tree-ssa/ssa-ccp-14.c: Scan FRE dump.
	* gcc.dg/tree-ssa/ssa-fre-46.c: Use -O2.
	* gcc.dg/tree-ssa/vrp92.c: Disable FRE.
	* gcc.dg/pr83666.c: Drop --param=sccvn-max-scc-size option.
	* gcc.dg/pr85195.c: Likewise.
	* gcc.dg/pr85467.c: Likewise.
	* gcc.dg/torture/pr81790.c: Likewise.

	* gfortran.dg/reassoc_4.f: Change max-completely-peeled-insns
	param to current default.

From-SVN: r263875
2018-08-27 10:55:53 +00:00
Richard Biener
8d2d69eba4 tree-ssa-pre.c (compute_antic): Re-use inverted postorder for partial antic compute.
2018-08-27  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c (compute_antic): Re-use inverted postorder
	for partial antic compute.

From-SVN: r263874
2018-08-27 10:50:45 +00:00
Jakub Jelinek
e7289cb45d re PR rtl-optimization/87065 (combine causes ICE in trunc_int_for_mode)
PR rtl-optimization/87065
	* combine.c (simplify_if_then_else): Formatting fix.
	(if_then_else_cond): Guard MULT optimization with SCALAR_INT_MODE_P
	check.
	(known_cond): Don't return const_true_rtx for vector modes.  Use
	CONST0_RTX instead of const0_rtx.  Formatting fixes.

	* gcc.target/i386/pr87065.c: New test.

From-SVN: r263872
2018-08-27 10:41:22 +02:00
Martin Liska
7a583153ec Do not read gcda files multiple times (PR gcov-profile/87069).
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR gcov-profile/87069
	* gcov.c (process_file): Record files already processed
        and warn about a file being processed multiple times.

From-SVN: r263871
2018-08-27 08:01:54 +00:00
Martin Liska
266c2b5488 Print default options selection for -march,-mcpu and -mtune for aarch64 (PR driver/83193).
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR driver/83193
	* config/aarch64/aarch64.c (aarch64_override_options_internal):
        Set default values for x_aarch64_*_string strings.
	* config/aarch64/aarch64.opt: Remove --{march,mcpu,mtune}==
        prefix.  For -mabi do not print '=ABI' in help and use
        <option_value> format for -msve-vector-bits and -moverride
        options.

From-SVN: r263870
2018-08-27 08:01:14 +00:00
Jeff Law
507c82f6da frame-header-opt.c: Include "backend.h" rather than "cfg.h"
* config/mips/frame-header-opt.c: Include "backend.h" rather than
	"cfg.h"

From-SVN: r263869
2018-08-26 20:54:32 -06:00
GCC Administrator
291872b404 Daily bump.
From-SVN: r263867
2018-08-27 00:17:00 +00:00
Marek Polacek
b5be6d0c16 PR c++/87029, Implement -Wredundant-move.
* c.opt (Wredundant-move): New option.

	* typeck.c (treat_lvalue_as_rvalue_p): New function.
	(maybe_warn_pessimizing_move): Call convert_from_reference.
	Warn about redundant moves.

	* doc/invoke.texi: Document -Wredundant-move.

	* g++.dg/cpp0x/Wredundant-move1.C: New test.
	* g++.dg/cpp0x/Wredundant-move2.C: New test.
	* g++.dg/cpp0x/Wredundant-move3.C: New test.
	* g++.dg/cpp0x/Wredundant-move4.C: New test.

From-SVN: r263863
2018-08-26 16:45:51 +00:00
Marek Polacek
0940fe5955 re PR c++/87080 (ice in cp_get_fndecl_from_callee, at cp/cvt.c:965)
PR c++/87080
	* typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.

	* g++.dg/cpp0x/Wpessimizing-move5.C: New test.

From-SVN: r263862
2018-08-26 16:31:27 +00:00
GCC Administrator
376384e4c4 Daily bump.
From-SVN: r263860
2018-08-26 00:16:54 +00:00
Thomas Koenig
4f4fabd733 re PR fortran/86704 (Segmentation fault when using matmul in combination with transpose)
2018-08-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/86704
	* m4/matmul_internal.m4: Correct calculation of needed buffer size
	for arrays of shape (1,n).
	* generated/matmul_c10.c: Regenerated
	* generated/matmul_c16.c: Regenerated
	* generated/matmul_c4.c: Regenerated
	* generated/matmul_c8.c: Regenerated
	* generated/matmul_i1.c: Regenerated
	* generated/matmul_i16.c: Regenerated
	* generated/matmul_i2.c: Regenerated
	* generated/matmul_i4.c: Regenerated
	* generated/matmul_i8.c: Regenerated
	* generated/matmul_r10.c: Regenerated
	* generated/matmul_r16.c: Regenerated
	* generated/matmul_r4.c: Regenerated
	* generated/matmul_r8.c: Regenerated
	* generated/matmulavx128_c10.c: Regenerated
	* generated/matmulavx128_c16.c: Regenerated
	* generated/matmulavx128_c4.c: Regenerated
	* generated/matmulavx128_c8.c: Regenerated
	* generated/matmulavx128_i1.c: Regenerated
	* generated/matmulavx128_i16.c: Regenerated
	* generated/matmulavx128_i2.c: Regenerated
	* generated/matmulavx128_i4.c: Regenerated
	* generated/matmulavx128_i8.c: Regenerated
	* generated/matmulavx128_r10.c: Regenerated
	* generated/matmulavx128_r16.c: Regenerated
	* generated/matmulavx128_r4.c: Regenerated
	* generated/matmulavx128_r8.c: Regenerated

2018-08-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/86704
	* gfortran.dg/matmul_19.f90: New test.

From-SVN: r263856
2018-08-25 21:31:30 +00:00
Martin Sebor
75e96bc80c re PR tree-optimization/87059 (internal compiler error: in set_value_range, at tree-vrp.c:289)
PR tree-optimization/87059
	* builtins.c (expand_builtin_strncmp): Convert MIN_EXPR operand
	to the same type as the other.
	* fold-const.c (fold_binary_loc): Assert expectation.

From-SVN: r263855
2018-08-25 13:12:36 -06:00
Janus Weil
3d6fc627f6 re PR fortran/86545 (ICE in transfer_expr on invalid WRITE statement)
fix PR 86545

2018-08-25  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/86545
	* resolve.c (resolve_transfer): Correctly determine typespec for
	generic function calls, in order to throw a proper error.

2018-08-25  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/86545
	* gfortran.dg/generic_35.f90: New test case.

From-SVN: r263854
2018-08-25 17:41:34 +02:00
Iain Sandoe
efa57feec8 Code clean-up on darwin.c
* config/darwin.c (machopic_legitimize_pic_address): Clean up
	extraneous parentheses, dead code section and formatting.

From-SVN: r263851
2018-08-25 09:11:47 +00:00
Iain Sandoe
ee959ecbde Don't force visibility to hidden for Darwin > 8.
PR libstdc++/70694
	* configure.host (OPT_LDFLAGS): Don't append
	-fvisibility-inlines-hidden for newer Darwin.

From-SVN: r263850
2018-08-25 09:02:28 +00:00
GCC Administrator
19b0eb255c Daily bump.
From-SVN: r263849
2018-08-25 00:16:53 +00:00
H.J. Lu
cf806c7dc3 Set start_location to 0 if we ran out of line map space
With profiledbootstrap and --with-build-config=bootstrap-lto, linemap_add
may create a macro map when we run out of line map space.  This patch
changes start_location to UNKNOWN_LOCATION (0) in this case.

Tested with profiledbootstrap and --with-build-config=bootstrap-lto on
Linux/x86-64.

	PR bootstrap/86872
	* line-map.c (pure_location_p): Return true if linemap_lookup
	returns NULL.
	(linemap_add): Set start_location to 0 if we run out of line map
	space.

From-SVN: r263845
2018-08-24 16:37:53 -07:00
David Malcolm
acf6214eac diagnostics: tweaks to line-spans vs line numbering (PR 87091)
This patch tweaks how line numbers are printed for a diagnostic
containing multiple line spans.

With this patch, rather than printing span headers:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1:
  ++ |+#include <vector>
  74 | #endif
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22:
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                      ^~~

we now print:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
  +++ |+#include <vector>
   74 | #endif
  ....
   87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |                      ^~~

and for sufficiently close lines, rather than print a gap:

  + |+#include <stdio.h>
  1 | test (int ch)
  ..
  3 |  putchar (ch);
    |  ^~~~~~~

we print the line itself:

  + |+#include <stdio.h>
  1 | test (int ch)
  2 | {
  3 |  putchar (ch);
    |  ^~~~~~~

gcc/ChangeLog:
	PR 87091
	* diagnostic-show-locus.c (layout::layout): Ensure the margin is
	wide enough for jumps in the line-numbering to be visible.
	(layout::print_gap_in_line_numbering): New member function.
	(layout::calculate_line_spans): When using line numbering, merge
	line spans that are only 1 line apart.
	(diagnostic_show_locus): When printing line numbers, show gaps in
	line numbering directly, rather than printing headers.
	(selftest::test_diagnostic_show_locus_fixit_lines): Add test of
	line-numbering with multiple line spans.
	(selftest::test_fixit_insert_containing_newline_2): Add test of
	line-numbering, in which the spans are close enough to be merged.

gcc/testsuite/ChangeLog:
	PR 87091
	* gcc.dg/missing-header-fixit-3.c: Update for changes to how
	line spans are printed with -fdiagnostics-show-line-numbers.

From-SVN: r263843
2018-08-24 21:17:48 +00:00
Aldy Hernandez
e5a3f08fb8 gimple-ssa-evrp-analyze.c (set_ssa_range_info): Pass value_range to range_includes_zero_p.
* gimple-ssa-evrp-analyze.c (set_ssa_range_info): Pass value_range
	to range_includes_zero_p.  Do not special case VR_ANTI_RANGE.
	* tree-vrp.c (range_is_nonnull): Remove.
	(range_includes_zero_p): Accept value_range instead of min/max.
	(extract_range_from_binary_expr_1): Do not early bail on
	POINTER_PLUS_EXPR.
	Use range_includes_zero_p instead of range_is_nonnull.
	(extract_range_from_unary_expr): Use range_includes_zero_p instead
	of range_is_nonnull.
	(vrp_meet_1): Pass value_range to range_includes_zero_p.  Do not
	special case VR_ANTI_RANGE.
	(vrp_finalize): Same.
	* tree-vrp.h (range_includes_zero_p): Pass value_range as argument
	instead of min/max.
	(range_is_nonnull): Remove.
	* vr-values.c (vrp_stmt_computes_nonzero): Use
	range_includes_zero_p instead of range_is_nonnull.
	(extract_range_basic): Pass value_range to range_includes_zero_p
	instead of range_is_nonnull.

From-SVN: r263842
2018-08-24 18:37:51 +00:00
Marc Glisse
6eac0600c4 new(nothrow) is malloc-like
2018-08-24  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/86822
	* libsupc++/new (operator new(size_t, nothrow_t), operator
	new[](size_t, nothrow_t), operator new(size_t, align_val_t, nothrow_t),
	operator new[](size_t, align_val_t, nothrow_t)): Add malloc attribute.

From-SVN: r263841
2018-08-24 18:24:42 +00:00
Ian Lance Taylor
1d29bb0408 runtime: remove the dummy arg of getcallersp
This is a port of https://golang.org/cl/109596 to the gofrontend, in
    preparation for updating libgo to 1.11.
    
    Original CL description:
    
        getcallersp is intrinsified, and so the dummy arg is no longer
        needed. Remove it, as well as a few dummy args that are solely
        to feed getcallersp.
    
    Reviewed-on: https://go-review.googlesource.com/131116

From-SVN: r263840
2018-08-24 18:15:04 +00:00
Jonathan Wakely
9ca2ac699a Forward declare debug containers so std::pmr aliases work
Prior to this change, including a <debug/xxx> header when _GLIBCXX_DEBUG
is also defined would fail to compile in C++17 or later. The <debug/xxx>
header would include the standard <xxx> header which defined
std::pmr::xxx as an alias for std::xxx. But in Debug Mode std::xxx
refers to std::__debug::xxx which has not been defined yet (because it
is in <debug/xxx> after the inclusion of <xxx>).

This adds declarations of the debug containers before including the
non-Debug Mode <xxx> header, so that the std::pmr::xxx aliases work.

	* include/debug/deque (std::__debug::deque): Declare.
	* include/debug/forward_list (std::__debug::forward_list): Declare.
	* include/debug/list (std::__debug::list): Declare.
	* include/debug/map (std::__debug::map): Declare.
	* include/debug/set (std::__debug::set): Declare.
	* include/debug/unordered_map (std::__debug::unordered_map): Declare.
	* include/debug/unordered_set (std::__debug::unordered_set): Declare.
	* include/debug/vector (std::__debug::vector): Declare.
	* testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/list/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/map/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multimap/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multiset/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/set/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
	Adjust dg-error lineno.
	* testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: New
	test.

From-SVN: r263839
2018-08-24 18:43:18 +01:00
Thomas Koenig
3413d16882 re PR fortran/86837 (Optimization breaks an unformatted read with implicit loop)
2018-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/86837
	* frontend-passes.c (var_in_expr_callback): New function.
	(var_in_expr): New function.
	(traverse_io_block): Use var_in_expr instead of
	gfc_check_dependency for checking if the variable depends on the
	previous interators.

2018-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/86837
	* gfortran.dg/implied_do_io_6.f90: New test.

From-SVN: r263838
2018-08-24 17:26:57 +00:00
H.J. Lu
01aa374826 Add a testcase for PR middle-end/87092
PR middle-end/87092
	* gcc.dg/pr87092.c: New test.

From-SVN: r263837
2018-08-24 09:58:27 -07:00
Marek Polacek
13ff3e166d re PR c++/67012 (decltype(auto) with trailing return type)
PR c++/67012
	PR c++/86942
	* decl.c (grokdeclarator): Disallow functions with trailing return
        type with decltype(auto) as its type.  Also check the function if
        it's inner declarator doesn't exist

	* g++.dg/cpp0x/auto52.C: New test.
	* g++.dg/cpp1y/auto-fn52.C: New test.
	* g++.dg/cpp1y/auto-fn53.C: New test.
	* g++.dg/cpp1y/auto-fn54.C: New test.

From-SVN: r263836
2018-08-24 15:48:43 +00:00
Uros Bizjak
eafa30efd0 emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
* emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
	* emit-rtl.h (rtl_data): Remove return_bnd.
	* explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
	* function.c (diddle_return_value): Do not handle crtl->return_bnd.
	* genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
	(POINTER_BOUNDS_MODE): Remove definition.
	(make_pointer_bounds_mode): Remove.
	(get_mode_class): Do not handle MODE_POINTER_BOUNDS.
	* machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
	(scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
	* mode-classes.def: Do not define MODE_POINTER_BOUNDS.
	* stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
	* tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
	* varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.

	* config/i386/i386-modes.def (BND32, BND64): Remove.
	* config/i386/i386.c (dbx_register_map): Remove bound registers.
	(dbx64_register_map): Ditto.
	(svr4_dbx_register_map): Ditto.
	(indirect_thunk_bnd_needed): Remove.
	(indirect_thunks_bnd_used): Ditto.
	(indirect_return_bnd_needed): Ditto.
	(indirect_return_via_cx_bnd): Ditto.
	(enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
	(indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
	(output_indirect_thunk): Ditto.  Remove need_prefix argument.
	(output_indirect_thunk_function): Remove handling of
	indirect_return_bnd_needed, indirect_return_via_cx_bnd,
	indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
	(ix86_save_reg): Remove handling of crtl->return_bnd.
	(ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
	(ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
	and UNSPEC_BNDLX_ADDR.
	(ix86_output_indirect_branch_via_reg): Remove handling of
	indirect_thunk_prefix_bnd.
	(ix86_output_indirect_branch_via_push): Ditto.
	(ix86_output_function_return): Ditto.
	(ix86_output_indirect_function_return): Ditto.
	(avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
	* config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
	(CALL_USED_REGISTERS): Ditto.
	(REG_ALLOC_ORDER): Update for removal of bound registers.
	(HI_REGISTER_NAMES): Ditto.
	* config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
	(UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
	(UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
	(BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
	(FIRST_PSEUDO_REG): Update.
	(BND): Remove mode iterator.
	* config/i386/predicates.md (bnd_mem_operator): Remove.

From-SVN: r263835
2018-08-24 16:42:32 +02:00
Richard Sandiford
f5cd4f8ceb Define vect_perm for variable-length SVE
Variable-length SVE now supports enough permutes to define vect_perm.

The change to vect_perm_supported is currently a no-op because the
function is only called with a count of 3.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
	* lib/target-supports.exp (vect_perm_supported): Only return
	false for variable-length vectors if the permute size is not
	a power of 2.
	(check_effective_target_vect_perm)
	(check_effective_target_vect_perm_byte)
	(check_effective_target_vect_perm_short): Remove check for
	variable-length vectors.
	* gcc.dg/vect/slp-23.c: Add an XFAIL for variable-length SVE.
	* gcc.dg/vect/slp-perm-10.c: Likewise.
	* gcc.dg/vect/slp-perm-9.c: Add an XFAIL for variable-length vectors.

From-SVN: r263834
2018-08-24 13:06:56 +00:00
Richard Sandiford
8c2f568c9a Avoid is_constant calls in vectorizable_bswap
The "new" VEC_PERM_EXPR handling makes it easy to support bswap
for variable-length vectors.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-stmts.c (vectorizable_bswap): Handle variable-length
	vectors.

gcc/testsuite/
	* gcc.target/aarch64/sve/bswap_1.c: New test.
	* gcc.target/aarch64/sve/bswap_2.c: Likewise.
	* gcc.target/aarch64/sve/bswap_3.c: Likewise.

From-SVN: r263833
2018-08-24 13:06:09 +00:00
Richard Sandiford
ab7e60cec1 Handle SLP permutations for variable-length vectors
The SLP code currently punts for all variable-length permutes.
This patch makes it handle the easy case of N->N permutes in which
the number of vector lanes is a multiple of N.  Every permute then
uses the same mask, and that mask repeats (with a stride) every
N elements.

The patch uses the same path for constant-length vectors,
since it should be slightly cheaper in terms of compile time.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-slp.c (vect_transform_slp_perm_load): Separate out
	the case in which the permute needs only a single element and
	repeats for every vector of the result.  Extend that case to
	handle variable-length vectors.
	* tree-vect-stmts.c (vectorizable_load): Update accordingly.

gcc/testsuite/
	* gcc.target/aarch64/sve/slp_perm_1.c: New test.
	* gcc.target/aarch64/sve/slp_perm_2.c: Likewise.
	* gcc.target/aarch64/sve/slp_perm_3.c: Likewise.
	* gcc.target/aarch64/sve/slp_perm_4.c: Likewise.
	* gcc.target/aarch64/sve/slp_perm_5.c: Likewise.
	* gcc.target/aarch64/sve/slp_perm_6.c: Likewise.
	* gcc.target/aarch64/sve/slp_perm_7.c: Likewise.

From-SVN: r263832
2018-08-24 13:05:36 +00:00
H.J. Lu
1ade64c9d8 DWARF: Call set_indirect_string on DW_MACINFO_start_file
Since -gsplit-dwarf -g3 will output filename as indirect string, call
set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/

	PR debug/79342
	* dwarf2out.c (save_macinfo_strings): Call set_indirect_string
	on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/testsuite/

	PR debug/79342
	* gcc.dg/pr79342.: New test.

From-SVN: r263831
2018-08-24 04:28:40 -07:00
Richard Biener
e144a2b306 cfg.h (struct control_flow_graph): Add edge_flags_allocated and bb_flags_allocated members.
2018-08-24  Richard Biener  <rguenther@suse.de>

	* cfg.h (struct control_flow_graph): Add edge_flags_allocated and
	bb_flags_allocated members.
	(auto_flag): New RAII class for allocating flags.
	(auto_edge_flag): New RAII class for allocating edge flags.
	(auto_bb_flag): New RAII class for allocating bb flags.
	* cfgloop.c (verify_loop_structure): Allocate temporary edge
	flag dynamically.
	* cfganal.c (dfs_enumerate_from): Remove use of visited sbitmap
	in favor of temporarily allocated BB flag.
	* hsa-brig.c: Re-order includes.
	* hsa-dump.c: Likewise.
	* hsa-regalloc.c: Likewise.
	* print-rtl.c: Likewise.
	* profile-count.c: Likewise.

From-SVN: r263830
2018-08-24 11:17:16 +00:00
Segher Boessenkool
6a84c265a3 rs6000: Check that the base of a TOCREL is the TOC (PR86989)
There currently is nothing that prevents replacing the TOC_REGISTER in
a TOCREL unspec with something else, like a pseudo, or a memory ref.
This of course does not work.  Fix that.

Tested on powerpc64-linux {-m32,-m64}; committing.


Segher


2018-08-24  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/86989
	* config/rs6000/rs6000.c (toc_relative_expr_p): Check that the base is
	the TOC register.

---
 gcc/config/rs6000/rs6000.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a967912..ed33912 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7932,7 +7932,9 @@ toc_relative_expr_p (const_rtx op, bool strict, const_rtx *tocrel_base_ret,
     *tocrel_offset_ret = tocrel_offset;
 
   return (GET_CODE (tocrel_base) == UNSPEC
-	  && XINT (tocrel_base, 1) == UNSPEC_TOCREL);
+	  && XINT (tocrel_base, 1) == UNSPEC_TOCREL
+	  && REG_P (XVECEXP (tocrel_base, 0, 1))
+	  && REGNO (XVECEXP (tocrel_base, 0, 1)) == TOC_REGISTER);
 }
 
 /* Return true if X is a constant pool address, and also for cmodel=medium
-- 
1.8.3.1

From-SVN: r263829
2018-08-24 12:49:27 +02:00
Aldy Hernandez
19b293bfa7 PR 87073/bootstrap
PR 87073/bootstrap
	* wide-int-range.cc (wide_int_range_div): Do not ignore result
	from wide_int_range_multiplicative_op.

From-SVN: r263828
2018-08-24 08:06:06 +00:00
GCC Administrator
17a4648c66 Daily bump.
From-SVN: r263827
2018-08-24 00:16:48 +00:00
Martin Sebor
6906ea8b51 PR tree-optimization/87072 - false warning: array subscript is above array bounds
gcc/testsuite/ChangeLog:
	* gcc.dg/Warray-bounds-35.c: New test.

From-SVN: r263822
2018-08-23 13:39:18 -06:00
David Edelsohn
464c1bd834 * async.h (ASYNC_IO): Revert _AIX test.
From-SVN: r263821
2018-08-23 15:33:45 -04:00
Jonathan Wakely
763ef11bff Fix failure when -fno-rtti test is run in C++17 or later
* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Only define when RTTI is enabled.

From-SVN: r263820
2018-08-23 20:27:54 +01:00
Prathamesh Kulkarni
429ca5b480 tree-vect-data-refs.c (vect_grouped_store_supported): Fix typo "permutaion".
2018-08-23  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* tree-vect-data-refs.c (vect_grouped_store_supported): Fix typo
	"permutaion".

From-SVN: r263819
2018-08-23 18:22:10 +00:00
Giuliano Belinassi
35574a7b41 Fix typo 'exapnded' to 'expanded'
2018-08-23  Giuliano Belinassi  <giuliano.belinassi@usp.br>

gcc/
	* genmatch.c (parser::parse_operation): Fix typo 'exapnded'
	to 'expanded'.

gcc/ada/
	* exp_unst.ads: Fix typo 'exapnded' to 'expanded'.

From-SVN: r263818
2018-08-23 17:01:09 +00:00
Alexander Monakov
47a5f7dda5 scev: dump final value replacement expressions
* tree-scalar-evolution.c (final_value_replacement_loop): Dump
	full GENERIC expression used for replacement.

From-SVN: r263817
2018-08-23 19:01:12 +03:00
Jonathan Wakely
568d5ee44d Define debug mode function for C++98
This function is declared unconditionally but was only defined for C++11
and later, leading to linker errors when the testsuite was run with
-std=gnu++98 -D_GLIBCXX_DEBUG added to the flags.

	* include/debug/vector (__niter_base): Define for C++98.

From-SVN: r263816
2018-08-23 16:23:31 +01:00
Jonathan Wakely
c07870270a Fix C++98 tests to not use C++11 features.
* testsuite/25_algorithms/partial_sort_copy/debug/irreflexive_neg.cc:
	Fix C++98 test to not use C++11 features.
	* testsuite/25_algorithms/fill_n/2.cc: Likewise.

From-SVN: r263815
2018-08-23 16:10:45 +01:00
Jonathan Wakely
6de2ce26bc Fix comments in testsuite script
* scripts/check_compile: Fix comments.

From-SVN: r263814
2018-08-23 16:10:35 +01:00
Aldy Hernandez
6285219422 tree-vrp.c (abs_extent_range): Remove.
* tree-vrp.c (abs_extent_range): Remove.
	(extract_range_into_wide_ints): Pass wide ints by reference.
	(extract_range_from_binary_expr_1): Rewrite the *DIV_EXPR code.
	Pass wide ints by reference in all calls to
	extract_range_into_wide_ints.
	* wide-int-range.cc (wide_int_range_div): New.
	* wide-int-range.h (wide_int_range_div): New.
	(wide_int_range_includes_zero_p): New.
	(wide_int_range_zero_p): New.

From-SVN: r263813
2018-08-23 13:25:36 +00:00
Matthew Malcomson
488461d862 [AARCH64] use "arch_enabled" attribute for aarch64.
arm.md has some attributes "arch" and "arch_enabled" to aid enabling
and disabling insn alternatives based on the architecture being
targeted.  This patch introduces a similar attribute in the aarch64
backend.  The new attribute will be used to enable a new alternative
for the atomic_store insn in a future patch, but is an atomic change
in itself.

The new attribute has values "any", "fp", "fp16", "simd", and "sve".
These attribute values have been taken from the pre-existing
attributes "fp", "fp16", "simd", and "sve".

The standalone "fp" attribute has been reintroduced in terms of the
"arch" attribute as it's needed for the xgene1.md scheduling file --
the use in this file can't be changed to check for `(eq_attr "arch"
"fp")` as the file is reused by the arm.md machine description whose
'arch' attribute doesn't have an 'fp' value.

2018-08-23  Matthew Malcomson  <matthew.malcomson@arm.com>

	* config/aarch64/aarch64.md (arches): New enum.
	(arch): New enum attr.
	(arch_enabled): New attr.
	(enabled): Now uses arch_enabled only.
	(simd, sve, fp16): Removed attribute.
	(fp): Attr now defined in terms of 'arch'.
	(*mov<mode>_aarch64, *movsi_aarch64, *movdi_aarch64, *movti_aarch64,
	*movhf_aarch64, <optab><fcvt_target><GPF:mode>2,
	<FCVT_F2FIXED:fcvt_fixed_insn><GPF:mode>3,
	<FCVT_FIXED2F:fcvt_fixed_insn><GPI:mode>3): Merge 'fp' and 'simd'
	attributes into 'arch'.
	(*movsf_aarch64, *movdf_aarch64, *movtf_aarch64, *add<mode>3_aarch64,
	subdi3, neg<mode>2, <optab><mode>3, one_cmpl<mode>2,
	*<NLOGICAL:optab>_one_cmpl<mode>3, *xor_one_cmpl<mode>3,
	*aarch64_ashl_sisd_or_int_<mode>3, *aarch64_lshr_sisd_or_int_<mode>3,
	*aarch64_ashr_sisd_or_int_<mode>3, *aarch64_sisd_ushl): Convert use of
	'simd' attribute into 'arch'.
	(load_pair_sw_<SX:mode><SX2:mode>, load_pair_dw_<DX:mode><DX2:mode>,
	store_pair_sw_<SX:mode><SX2:mode>, store_pair_dw_<DX:mode><DX2:mode>):
	Convert use of 'fp' attribute to 'arch'.
	* config/aarch64/aarch64-simd.md (move_lo_quad_internal_<mode>,
	move_lo_quad_internal_<mode>): (different modes) Merge 'fp' and 'simd'
	into 'arch'.
	(move_lo_quad_internal_be_<mode>, move_lo_quad_internal_be_<mode>):
	(different modes) Merge 'fp' and 'simd' into 'arch'.
	(*aarch64_combinez<mode>, *aarch64_combinez_be<mode>): Merge 'fp' and
	'simd' into 'arch'.

From-SVN: r263811
2018-08-23 12:43:17 +00:00
Segher Boessenkool
84ea73e1bb Fix recent bug in canonicalize_comparison (PR87026)
The new code testing which way a comparison is best expressed creates
a pseudoregister (by hand) and creates some insns with that.  Such
insns will no longer recog() when pseudo-registers are no longer
aloowed (after reload).  But we have an ifcvt pass after reload (ce3).

This patch simply returns if we cannot create pseudos.


	PR rtl-optimization/87026
	* expmed.c (canonicalize_comparison): If we can no longer create
	pseudoregisters, don't.

From-SVN: r263810
2018-08-23 14:40:14 +02:00