Commit Graph

167700 Commits

Author SHA1 Message Date
Richard Biener 6d1a7fd450 re PR middle-end/89779 (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in tree_nop_conversion_p, at tree.c:12798)
2019-03-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/89779
	* tree.c (tree_nop_conversion): Consolidate and fix defensive
	checks with respect to released SSA names now having error_mark_node
	type.
	* fold-const.c (operand_equal_p): Likewise.

	* gcc.dg/torture/pr89779.c: New testcase.

From-SVN: r269838
2019-03-21 14:27:32 +00:00
Jonathan Wakely e2186cd88e In C++17 <math.h> should not put special functions in global namespace
IS 29124 8.2 [sf.mathh] says that <math.h> should add the names of the
special functions to the global namespace.  However, C++17 Annex D
[depr.c.headers] excludes those functions explicitly, so they should not
be placed in the global namespace unconditionally for C++17.

Only add them to the global namespace when IS 29124 is explicitly
requested via the __STDCPP_WANT_MATH_SPEC_FUNCS__ macro.

	* include/c_compatibility/math.h [!__STDCPP_WANT_MATH_SPEC_FUNCS__]
	(assoc_laguerre, assoc_laguerref, assoc_laguerrel, assoc_legendre)
	(assoc_legendref, assoc_legendrel, beta, betaf, betal, comp_ellint_1)
	(comp_ellint_1f, comp_ellint_1l, comp_ellint_2, comp_ellint_2f)
	(comp_ellint_2l, comp_ellint_3, comp_ellint_3f, comp_ellint_3l)
	(cyl_bessel_i, cyl_bessel_if, cyl_bessel_il, cyl_bessel_j)
	(cyl_bessel_jf, cyl_bessel_jl, cyl_bessel_k, cyl_bessel_kf)
	(cyl_bessel_kl, cyl_neumann, cyl_neumannf, cyl_neumannl, ellint_1)
	(ellint_1f, ellint_1l, ellint_2, ellint_2f, ellint_2l, ellint_3)
	(ellint_3f, ellint_3l, expint, expintf, expintl, hermite, hermitef)
	(hermitel, laguerre, laguerref, laguerrel, legendre, legendref)
	(legendrel, riemann_zeta, riemann_zetaf, riemann_zetal, sph_bessel)
	(sph_besself, sph_bessell, sph_legendre, sph_legendref, sph_legendrel)
	(sph_neumann, sph_neumannf, sph_neumannl): Only add using-declarations
	when the special functions IS is enabled, not for C++17.
	* testsuite/26_numerics/headers/cmath/functions_global_c++17.cc:
	Replace with ...
	* testsuite/26_numerics/headers/cmath/functions_global.cc: New test,
	without checks for special functions in C++17.
	* testsuite/26_numerics/headers/cmath/special_functions_global.cc:
	New test.

From-SVN: r269837
2019-03-21 14:03:56 +00:00
Jonathan Wakely 42d9f14bab PR libstdc++/88066 Use <> for includes not ""
These headers were missed in the previous commit for this bug.

There are also several "" includes in the profile mode headers, but
because they're deprecated I'm not fixing them.

	* include/backward/hash_map: Use <> for includes not "".
	* include/backward/hash_set: Likewise.
	* include/backward/strstream: Likewise.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.

From-SVN: r269835
2019-03-21 12:07:10 +00:00
Paolo Carlini 6f5df5fdf8 re PR c++/78645 (ICE on invalid code (Segmentation fault, cxx_eval_call_expression))
2019-03-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/78645
	* g++.dg/cpp0x/constexpr-ice20.C: New.

From-SVN: r269834
2019-03-21 12:05:32 +00:00
Paolo Carlini c6ecc13a07 re PR c++/89571 (ICE in nothrow_spec_p, at cp/except.c:1238)
/cp
2019-03-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/89571
	* method.c (after_nsdmi_defaulted_late_checks): Avoid passing
	error_mark_node to comp_except_specs.

/testsuite
2019-03-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/89571
	* g++.dg/cpp0x/noexcept37.C: New.

From-SVN: r269832
2019-03-21 01:03:30 +00:00
GCC Administrator 2aecb44b40 Daily bump.
From-SVN: r269831
2019-03-21 00:16:12 +00:00
Iain Buclaw 9dddefefdf d: Fix ICE force_type_die, at dwarf2out.c using nested types
In functions whose return type is instantiated from a nested template,
make sure that all members of the instance are emitted before finishing
the outer function, otherwise they will be removed during the
prune_unused_types pass.

gcc/d/ChangeLog:

2019-03-21  Iain Buclaw  <ibuclaw@gdcproject.org>

	PR d/89017
	* d-codegen.cc (d_decl_context): Skip over template instances when
	finding the context.
	* decl.cc (DeclVisitor::visit(TemplateDeclaration)): New override.
	(build_type_decl): Include parameters in name of template types.

gcc/testsuite/ChangeLog:

2019-03-21  Iain Buclaw  <ibuclaw@gdcproject.org>

	PR d/89017
	* gdc.dg/pr89017.d: New test.

From-SVN: r269828
2019-03-20 23:52:48 +00:00
Janus Weil 5d2df818b7 re PR fortran/71861 ([F03] ICE in write_symbol(): bad module symbol)
fix PR 71861

2019-03-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71861
	* symbol.c (check_conflict): ABSTRACT attribute conflicts with
	INTRINSIC attribute.

2019-03-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/71861
	* gfortran.dg/interface_abstract_5.f90: New test case.

From-SVN: r269827
2019-03-20 22:32:23 +01:00
Jason Merrill 292a8bbb27 PR c++/87480 - decltype of member access in default template arg
The issue here is that declval<T>().d is considered instantiation-dependent
within a template, as the access to 'd' might depend on the particular
specialization.  But when we're deducing template arguments for a call, we
know that the call and the arguments are non-dependent, so we can do the
substitution as though we aren't in a template.  Which strictly speaking we
aren't, since the default argument is considered a separate definition.

	* pt.c (type_unification_real): Accept a dependent result in
	template context.

From-SVN: r269826
2019-03-20 16:31:40 -04:00
Andreas Krebbel 3ad7fed1cc S/390: Fix PR89775. Stackpointer save/restore instructions removed
Even if a global register is being clobbered in a function we usually
do not save and restore it. However, we still have to do this if it is
a special register. Most of the places in the backend handle this
correctly but not the prologue/epilogue optimization.

gcc/ChangeLog:

2019-03-20  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/89775
	* config/s390/s390.c (global_not_special_regno_p): Move to make it
	available to ...
	(s390_optimize_register_info): Use global_not_special_regno_p to
	check for global regs.

2019-03-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/89775
	* gcc.target/s390/pr89775-1.c: New test.
	* gcc.target/s390/pr89775-2.c: New test.

From-SVN: r269823
2019-03-20 15:28:38 +00:00
Jakub Jelinek a5b821e448 re PR target/89752 (ICE in emit_move_insn, at expr.c:3723)
PR target/89752
	* lra-constraints.c (process_alt_operands) <reg>: For BLKmode, don't
	update this_alternative nor this_alternative_set.

	* g++.target/aarch64/aarch64.exp: New file.
	* g++.target/aarch64/pr89752.C: New test.

From-SVN: r269819
2019-03-20 12:26:42 +01:00
GCC Administrator 7f129d6f16 Daily bump.
From-SVN: r269817
2019-03-20 00:16:16 +00:00
Martin Sebor bec1da64ae PR tree-optimization/89688 - -Wstringop-overflow confused by const 2D array of char
gcc/c/ChangeLog:

	PR tree-optimization/89688
	* c-decl.c (finish_decl): Call braced_lists_to_string for more
	kinds of initializers.

gcc/c-family/ChangeLog:

	PR tree-optimization/89688
	* c-common.c (braced_list_to_string): Make static.
	(braced_lists_to_strings): Define new function.
	* c-common.h (braced_list_to_string): Remove.
	(braced_lists_to_strings): Declare.

gcc/cp/ChangeLog:

	PR tree-optimization/89688
	* typeck2.c (store_init_value): Call braced_lists_to_string for more
	kinds of initializers.

gcc/testsuite/ChangeLog:

	PR tree-optimization/89688
	* gcc.dg/strlenopt-61.c: New test.
	* g++.dg/warn/Wstringop-overflow-2.C: New test.

From-SVN: r269814
2019-03-19 16:43:10 -06:00
Jim Wilson 026216a753 RISC-V: Fix %lo overflow with BLKmode references.
gcc/
	PR target/89411
	* config/riscv/riscv.c (riscv_valid_lo_sum_p): New arg x.  New locals
	align, size, offset.  Use them to handle a BLKmode reference.  Update
	comment.
	(riscv_classify_address): Pass info->offset to riscv_valid_lo_sum_p.

	gcc/testsuite/
	PR target/89411
	* gcc.target/riscv/losum-overflow.c: New test.

From-SVN: r269813
2019-03-19 15:33:34 -07:00
Jakub Jelinek 2a23a1c39f re PR rtl-optimization/89768 (ICE in compare_and_jump_seq at loop-unroll.c:838)
PR rtl-optimization/89768
	* loop-unroll.c (unroll_loop_constant_iterations): Use gen_int_mode
	instead of GEN_INT.
	(unroll_loop_runtime_iterations): Likewise.

From-SVN: r269812
2019-03-19 20:04:14 +01:00
Ian Lance Taylor ea5ac5a69b compiler,runtime: pass old slice's ptr/len/cap by value to growslice
In the C calling convention, on AMD64, and probably a number of
    other architectures, a 3-word struct argument is passed on stack.
    This is less efficient than passing in three registers. Further,
    this may affect the code generation in other part of the program,
    even if the function is not actually called.
    
    Slices are common in Go and append is a common slice operation,
    which calls growslice in the growing path. To improve the code
    generation, pass the slice header's three fields as separate
    values, instead of a struct, to growslice.
    
    The drawback is that this makes the runtime implementation
    slightly diverges from the gc runtime.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168277

From-SVN: r269811
2019-03-19 18:42:43 +00:00
Martin Sebor e074803086 PR tree-optimization/89644 - false-positive -Warray-bounds on strncpy with unterminated array
gcc/ChangeLog:
	* tree-ssa-strlen.c (handle_builtin_stxncpy): Use full_string_p
	rather than endptr as an indicator of nul-termination.

From-SVN: r269809
2019-03-19 12:35:42 -06:00
Martin Sebor e3ba46bd52 PR tree-optimization/89644 - False-positive -Warray-bounds diagnostic on strncpy
gcc/ChangeLog:

	PR tree-optimization/89644
	* tree-ssa-strlen.c (handle_builtin_stxncpy): Consider unterminated
	arrays in determining sequence sizes in strncpy and stpncpy.

gcc/testsuite/ChangeLog:

	PR tree-optimization/89644
	* gcc.dg/Wstringop-truncation-8.c: New test.

From-SVN: r269807
2019-03-19 11:45:34 -06:00
Martin Liska 2214085aff Fix set of even probabilities (PR middle-end/89737).
2019-03-19  Martin Liska  <mliska@suse.cz>

	PR middle-end/89737
	* predict.c (combine_predictions_for_bb): Empty likely_edges and
	unlikely_edges if there's an edge that belongs to both these sets.
2019-03-19  Martin Liska  <mliska@suse.cz>

	PR middle-end/89737
	* gcc.dg/pr89737.c: New test.

From-SVN: r269804
2019-03-19 17:08:28 +00:00
Segher Boessenkool e8926ce09f rs6000: Unaligned stfiwx on older CPUs (PR89746)
The "classic" PowerPCs (6xx/7xx) are not STRICT_ALIGNMENT, but their
floating point units are.  This is not normally a problem, the ABIs
make everything FP aligned.  The RTL patterns converting FP to integer
however get a potentially unaligned destination, and we do not want to
do an stfiwx on that on such older CPUs.

This fixes it.  It does not change anything for TARGET_MFCRF targets
(POWER4 and later).  It also won't change anything for strict-alignment
targets, or CPUs without hardware FP of course, or CPUs that do not
implement stfiwx (older 4xx/5xx/8xx).

It does not change the corresponding fixuns* pattern, because that can
not be enabled on any CPU that cannot handle unaligned FP well.


	PR target/89746
	* config/rs6000/rs6000.md (fix_trunc<mode>si2_stfiwx): If we have a
	non-TARGET_MFCRF target, and the dest is memory but not 32-bit aligned,
	go via a stack temporary.

From-SVN: r269802
2019-03-19 17:58:42 +01:00
Jakub Jelinek bb48c402f4 re PR target/89378 ([MIPS] FAIL: gcc.dg/vect/pr88598-3.c -mmsa (internal compiler error))
PR target/89378
	* config/mips/mips.c (mips_expand_vec_cond_expr): Use gen_lowpart
	instead of gen_rtx_SUBREG.
	* config/mips/mips-msa.md (vec_extract<mode><unitmode>): Likewise.

From-SVN: r269801
2019-03-19 17:10:59 +01:00
Richard Biener 22fdf6af14 re PR debug/88389 (-flto -g -gsplit-dwarf is broken)
2019-03-19  Richard Biener  <rguenther@suse.de>

	PR debug/88389
	* opts.c (finish_options): Disable -gsplit-dwarf when doing LTO.

From-SVN: r269800
2019-03-19 14:57:18 +00:00
Jan Hubicka 2ca6d1813e re PR lto/87089 (tree check: expected class 'type', have 'declaration' (namespace_decl) in type_with_linkage_p, at ipa-utils.h)
PR lto/87809
	PR lto/89335
	* tree.c (free_lang_data_in_decl): Do not free context of C++
	destrutors.

	* g++.dg/lto/pr87089_0.C: New testcase.
	* g++.dg/lto/pr87089_1.C: New testcase.
	* g++.dg/lto/pr89335_0.C: New testcase.

From-SVN: r269799
2019-03-19 14:53:43 +00:00
Ian Lance Taylor 9195aa172b libgo: fix build on AIX
Since aix/ppc64 has been added to GC toolchain, a mix between new and
    old files were created in gcc toolchain.
    This commit corrects this merge for aix/ppc64 and aix/ppc.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167658

From-SVN: r269797
2019-03-19 14:00:59 +00:00
Kelvin Nilsen 3b595ecaed re PR target/89736 (New test pr87532-mc.c fails on compiler not defaulting to VSX)
gcc/testsuite/ChangeLog:

2019-03-19  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89736
	* gcc.target/powerpc/pr87532-mc.c: Modify dejagnu directives to
	restrict this test to vsx targets.

From-SVN: r269796
2019-03-19 13:44:03 +00:00
Jakub Jelinek 1504f0b4b1 re PR target/89506 (ICE: in decompose, at rtl.h:2266 with -Og -g)
PR target/89506
	* config/arm/arm.md (cmpsi2_addneg): Swap the alternatives and use
	subs for the first alternative except when operands[3] is 1.

From-SVN: r269795
2019-03-19 11:05:10 +01:00
Jonathan Wakely cad3fc8c59 Update libstdc++ API Evolution documentation
* doc/xml/manual/allocator.xml: Link to table documenting evolution
	of extension allocators.
	* doc/xml/manual/evolution.xml: Use angle brackets for header names.
	Document new headers in 7.2, 8.1 and 9.1 releases.
	* doc/xml/manual/using.xml: Adjust link target for new_allocator.
	* doc/html/*: Regenerate.

From-SVN: r269794
2019-03-19 09:38:41 +00:00
Jakub Jelinek edff2a0574 re PR target/89752 (ICE in emit_move_insn, at expr.c:3723)
PR target/89752
	* gimplify.c (gimplify_asm_expr): For output argument with
	TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise
	diagnose error.

	* g++.dg/ext/asm15.C: Check for particular diagnostic wording.
	* g++.dg/ext/asm16.C: Likewise.
	* g++.dg/ext/asm17.C: New test.

From-SVN: r269793
2019-03-19 09:11:25 +01:00
Eric Botcazou 4f683506df re PR rtl-optimization/89753 (ICE in unroll_loop_constant_iterations, at loop-unroll.c:498)
PR rtl-optimization/89753
	* loop-unroll.c (decide_unroll_constant_iterations): Make guard for
	explicit unrolling factor even more robust.

From-SVN: r269791
2019-03-19 08:06:48 +00:00
Jakub Jelinek ce2c025c24 re PR target/89726 (Incorrect inlined version of 'ceil' for 32bit)
PR target/89726
	* config/i386/i386.c (ix86_expand_floorceildf_32): In ceil
	compensation use x2 += 1 instead of x2 -= -1 and when honoring
	signed zeros, do another copysign after the compensation.

	* gcc.target/i386/fpprec-1.c (x): Add 6 new constants.
	(expect_round, expect_rint, expect_floor, expect_ceil, expect_trunc):
	Add expected results for them.

From-SVN: r269790
2019-03-19 08:25:59 +01:00
Jakub Jelinek 855cd9b166 re PR c/89734 (const qualifier on return type not erased inside __typeof__)
PR c/89734
	* c-decl.c (grokdeclarator): Call c_build_qualified_type on function
	return type even if quals_used is 0.  Formatting fixes.

	* gcc.dg/pr89734.c: New test.

From-SVN: r269789
2019-03-19 07:55:31 +01:00
GCC Administrator 7babd3e4f1 Daily bump.
From-SVN: r269788
2019-03-19 00:16:11 +00:00
Martin Sebor c46c9745aa PR tree-optimization/89720 - Spurious -Warray-bounds warning on a range with max < min
gcc/ChangeLog:

	PR tree-optimization/89720
	* tree-vrp.c (vrp_prop::check_mem_ref): Treat range with max < min
	more conservatively, the same as anti-range.

gcc/testsuite/ChangeLog:

	PR tree-optimization/89720
	* gcc.dg/Warray-bounds-42.c: New test.

From-SVN: r269785
2019-03-18 17:48:50 -06:00
Johannes Pfau eea4e2ff0a mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.
From-SVN: r269784
2019-03-18 22:36:56 +00:00
Joseph Myers 3d8ce9bab1 * sv.po: Update.
From-SVN: r269783
2019-03-18 21:36:44 +00:00
H.J. Lu 0bf09c3721 Add a test for PR c++/89630
PR c++/89630
	* g++.target/i386/pr89630.C: New test.

From-SVN: r269781
2019-03-18 14:22:30 -07:00
Ian Lance Taylor a8b58d84bf libgo: update to Go 1.12.1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167749

From-SVN: r269780
2019-03-18 20:27:59 +00:00
Kito Cheng 891cd9e3b9 RISC-V: Fix testsuite regression caused by quotes around options.
2019-03-18  Kito Cheng  <kito.cheng@gmail.com>
	* gcc.target/riscv/arch-1.c: Add quotes around march in dg-error.

From-SVN: r269779
2019-03-18 12:45:20 -07:00
Jason Merrill 7834e5a0e1 PR c++/89630 - ICE with dependent using-decl as template arg.
Even though these two using-declarations have the same effect, they are not
the same declaration, and we don't need to work to treat them as the same
like we do for typedefs.  If we did need to, we would need to handle them
specially in iterative_hash_template_arg as well as here.

	* tree.c (cp_tree_equal): Always return false for USING_DECL.

From-SVN: r269777
2019-03-18 15:37:00 -04:00
Jason Merrill d849cfaeea PR c++/89761 - ICE with sizeof... in pack expansion.
In this testcase we get confused when looking at the sizeof... because the
argument pack for 'args' has been wrapped in an ARGUMENT_PACK_SELECT as part
of expanding the fold-expression.  We handle this situation a bit lower down
in tsubst_pack_expansion, but that doesn't help the call to
argument_pack_element_is_expansion_p, which happens earlier.

	* pt.c (argument_pack_element_is_expansion_p): Handle
	ARGUMENT_PACK_SELECT.

From-SVN: r269776
2019-03-18 15:35:12 -04:00
Jason Merrill 6e3587dbbc PR c++/89640 - GNU attributes on lambda.
My patch for PR 60503 to fix C++11 attribute parsing on lambdas accidentally
removed support for GNU attributes.

	* parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.

From-SVN: r269775
2019-03-18 15:34:47 -04:00
Segher Boessenkool 5a1d5d6a8e rs6000: Fix altivec-7.c testcase
It currently wants to see lvx insns on AIX, and no lvx insns on Linux.
What is really wanted is lvx insns when no VSX, and lxv* insns if VSX.
This fixes it.


	* gcc.target/powerpc/altivec-7.c: Look for lxv* if generating VSX
	instructions, and lvx if not.

From-SVN: r269772
2019-03-18 18:46:18 +01:00
Segher Boessenkool 0a6d5a9e3e rs6000: Use pointers in bswap testcases
Currently these bswap testcases use global variables, which causes
problems with -m32: the memory access is a D-form access, and when
combine tries to combine that with the bswap it tries a D-form store
with byte reverse.  That instruction does not exist, and since combine
started with only two insns here it will not try splitting this.

This should be improved, but it is not what this test is testing, and
the "load" case already uses a pointer, so let's do that for the store
case as well.


	* gcc.target/powerpc/bswap16.c: Use a pointer instead of a global for
	the "store" test as well.
	* gcc.target/powerpc/bswap32.c: Ditto.

From-SVN: r269771
2019-03-18 18:44:56 +01:00
Segher Boessenkool b2ebe97358 rs6000: Fix pr18096-1.c test
For the big stack frame in the test GCC used to say

pr18096-1.c:7:6: error: total size of local objects too large

but now it says

pr18096-1.c:7:6: error: total size of local objects 2147483647 exceeds maximum 2147483392

Let's just allow both in the test.


gcc/testsuite/
	* gcc.target/powerpc/pr18096-1.c: Allow an error message that says
	"exceeds" instead of just one that talks about "too large".

From-SVN: r269770
2019-03-18 18:43:34 +01:00
Thomas Koenig 3051b25e66 re PR fortran/68009 (prototype for gfortran_runtime_error with inline matmul)
2019-03-18  Thomas Koenig  <tkoeng@gcc.gnu.org>

	PR fortran/68009
	* iresolve.c: Include trans.h.
	(gfc_resolve_fe_runtine_error): Set backend_decl on
	resolved_sym.

From-SVN: r269769
2019-03-18 17:35:54 +00:00
Jason Merrill b6e45a40cd PR c++/89682 - wrong access error in default argument.
Here we were pushing into the right access context, but we were called from
a deferred checking context, so didn't end up doing the checks until after
we left the access context.

	* pt.c (tsubst_default_argument): Don't defer access checks.

From-SVN: r269766
2019-03-18 11:58:24 -04:00
Richard Biener ca6d4a08c1 re PR tree-optimization/88945 (ICE in fold_convert_loc in FRE when using -fdump-tree-fre-details)
2019-03-18  Richard Biener  <rguenther@suse.de>

	PR middle-end/88945
	* tree-ssanames.c (release_ssa_name_fn): For released SSA names
	use a TREE_TYPE of error_mark_node to avoid ICEs when dumping
	basic-blocks that are removed.  Remove restoring SSA_NAME_VAR.
	* tree-outof-ssa.c (eliminate_useless_phis): Remove redundant checking.

From-SVN: r269765
2019-03-18 13:59:11 +00:00
Andrew Stubbs f9cacebbde Implement circular print buffer.
2019-03-18  Andrew Stubbs  <ams@codesourcery.com>

	gcc/
	* config/gcn/gcn-run.c (struct output): Make next_output unsigned.
	Extend queue to 1024 entries.
	Add "consumed" field.
	(gomp_print_output): Remove print_index parameter.
	Add final parameter.
	Change limit to unsigned.
	Use consumed field to implement circular buffer.
	Detect interrupted print in final pass.
	Flush output at the end.
	(run): Update gomp_print_output usage.
	(main): Initialize kernargs->output_data.consumed.

From-SVN: r269764
2019-03-18 13:13:27 +00:00
Richard Sandiford c57546fe94 Fix a case in which the vector cost model was ignored
This patch fixes a case in which we vectorised something with a
fully-predicated loop even after the cost model had rejected it.
E.g. the loop in the testcase has the costs:

  Vector inside of loop cost: 27
  Vector prologue cost: 0
  Vector epilogue cost: 0
  Scalar iteration cost: 7
  Scalar outside cost: 6
  Vector outside cost: 0
  prologue iterations: 0
  epilogue iterations: 0

and we can see that the loop executes at most three times, but we
decided to vectorise it anyway.

(The costs here are equal for three iterations, but the same thing
happens even when the vector code is strictly more expensive.)

The problem is the handling of "/VF" in:

  /* Calculate number of iterations required to make the vector version
     profitable, relative to the loop bodies only.  The following condition
     must hold true:
     SIC * niters + SOC > VIC * ((niters-PL_ITERS-EP_ITERS)/VF) + VOC
     where
     SIC = scalar iteration cost, VIC = vector iteration cost,
     VOC = vector outside cost, VF = vectorization factor,
     PL_ITERS = prologue iterations, EP_ITERS= epilogue iterations
     SOC = scalar outside cost for run time cost model check.  */

We treat the "/VF" as truncating, but for fully-predicated loops, it's
closer to a ceil division, since fractional iterations are handled by a
full iteration with some predicate bits set to false.

The easiest fix seemed to be to calculate the minimum number of vector
iterations first, then use that to calculate the minimum number of scalar
iterations.

Calculating the minimum number of vector iterations might make sense for
unpredicated loops too, since calculating the scalar niters directly
doesn't take into account the fact that the VIC multiple has to be an
integer.  But the handling of PL_ITERS and EP_ITERS for unpredicated
loops is a bit hand-wavy anyway, so maybe vagueness here cancels out
vagueness there?

Either way, changing this for unpredicated loops would be much too
invasive for stage 4, so the patch keeps it specific to fully-predicated
loops (i.e. SVE) for now.  There's no functional change for other targets.

2019-03-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-loop.c (vect_estimate_min_profitable_iters): Fix the
	calculation of the minimum number of scalar iterations for
	fully-predicated loops.

gcc/testsuite/
	* gcc.target/aarch64/sve/cost_model_1.c: New test.

From-SVN: r269763
2019-03-18 12:25:32 +00:00
Martin Jambor cfce6e055d Add forgotten requeing in propagate_subaccesses_across_link
2019-03-18  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/89546
	* tree-sra.c (propagate_subaccesses_across_link): Requeue new_acc if
	any propagation to its children took place.

	testsuite/
	* gcc.dg/tree-ssa/pr89546.c: New test.

From-SVN: r269761
2019-03-18 12:28:01 +01:00