PR rtl-optimization/87817
* config/i386/i386.md (bmi2_bzhi_<mode>3, *bmi2_bzhi_<mode>3,
*bmi2_bzhi_<mode>3_1, *bmi2_bzhi_<mode>3_1_ccz): Use IF_THEN_ELSE
in the pattern to avoid triggering UB when operands[2] is zero.
(tbm_bextri_<mode>): New expander. Renamed the old define_insn to ...
(*tbm_bextri_<mode>): ... this.
From-SVN: r266340
Factor out new function read_string in dwarf.c.
Bootstrapped and reg-tested on x86_64.
2018-11-21 Tom de Vries <tdevries@suse.de>
* dwarf.c (read_string): Factor out of ...
(read_attribute, read_line_header, read_line_program): ... here.
From-SVN: r266339
Ensure that gcc --help=params lines end with a period by:
- fixing the help message of param HOT_BB_COUNT_FRACTION, and
- adding a test-case.
Build and tested on x86_64.
2018-11-21 Tom de Vries <tdevries@suse.de>
PR driver/79855
* params.def (HOT_BB_COUNT_FRACTION): Terminate help message with
period.
* lib/options.exp (check_for_options_with_filter): New proc.
* gcc.misc-tests/help.exp: Check that --help=params lines end with
period.
From-SVN: r266338
* lang.opt (fdec-include): New option.
* options.c (set_dec_flags): Set also flag_dec_include.
* scanner.c (include_line): Change return type from bool to int.
In fixed form allow spaces in between include keyword letters.
For -fdec-include, allow in fixed form 0 in column 6. With
-fdec-include return -1 if the parsed line is not full include
statement and it could be successfully completed on continuation
lines.
(include_stmt): New function.
(load_file): Adjust include_line caller. If it returns -1, keep
trying include_stmt until it stops returning -1 whenever adding
further line of input.
* gfortran.dg/include_10.f: New test.
* gfortran.dg/include_10.inc: New file.
* gfortran.dg/include_11.f: New test.
* gfortran.dg/include_12.f: New test.
* gfortran.dg/include_13.f90: New test.
* gfortran.dg/gomp/include_1.f: New test.
* gfortran.dg/gomp/include_1.inc: New file.
* gfortran.dg/gomp/include_2.f90: New test.
Co-Authored-By: Mark Eggleston <mark.eggleston@codethink.com>
From-SVN: r266337
The IBM z14 POP adds an optional alignment operand to the vl, vst,
vlm, and vstm instruction (vector loads and stores). Vectors residing
on 8 or 16 byte boundaries might get loaded or stored faster on some
models given the instruction uses the proper hint operand. A wrong
hint will hurt performance though.
The attached testcase align-1 currently fails due to:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88085
gcc/ChangeLog:
2018-11-21 Andreas Krebbel <krebbel@linux.ibm.com>
* configure.ac: Add check for Binutils to determine whether vector
load/store alignments hints are being supported.
* config.in: Regenerate.
* configure: Regenerate.
* config/s390/s390.c (print_operand): Support new output
modifier A.
* config/s390/s390.md ("movti"): Append alignment hint output
using the new output modifier 'A'.
* config/s390/vector.md ("mov<mode>", "*vec_tf_to_v1tf")
("*vec_ti_to_v1ti"): Likewise.
gcc/testsuite/ChangeLog:
2018-11-21 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/vector/align-1.c: New test.
* gcc.target/s390/vector/align-2.c: New test.
From-SVN: r266336
PR go/88060
syscall: always define _AT_FDCWD and IPv6MTUInfo
They aren't defined by old versions of glibc, but are required by the
code in syscall_linux.go.
Reviewed-on: https://go-review.googlesource.com/c/150697
From-SVN: r266333
PR c++/88110
* constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
if get_base_address of ADDR_EXPR operand is not a DECL_P.
* g++.dg/cpp2a/constexpr-virtual13.C: New test.
From-SVN: r266329
PR tree-optimization/87895
* omp-simd-clone.c (ipa_simd_modify_function_body): When removing
or replacing GIMPLE_RETURN, set EDGE_FALLTHRU on the edge to EXIT.
(simd_clone_adjust): Don't set EDGE_FALLTHRU here. In a loop that
redirects edges to EXIT to edges to incr_bb, iterate while EXIT
has any preds and always use EDGE_PRED (, 0).
* gcc.dg/gomp/pr87895-1.c: New test.
* gcc.dg/gomp/pr87895-2.c: New test.
* gcc.dg/gomp/pr87895-3.c: New test.
From-SVN: r266328
PR target/88070
* mode-switching.c (create_pre_exit): After reload, always split the
fallthrough edge to the exit block.
testsuite/ChangeLog:
PR target/88070
* gcc.target/i386/pr88070.c: New test.
From-SVN: r266326
PR lto/87957
* ipa-devirt.c (odr_subtypes_equivalent_p): Report ODR violation
when sybtype already violates ODR.
(get_odr_type): Do not ICE when insert is false and type duplicate
is not registered yet.
(register_odr_type): Be sure to register subtypes first.
From-SVN: r266322
The flogr instruction uses a 64 bit register pair target operand. In
the RTX we model this as a write to a TImode register. Unfortunately
the RTX's being assigned to the two parts of the target operand were
swapped. This is no problem if in the end the flogr instruction will
be emitted since the instruction still does what the clzdi expander
expects. However, a problem arises when the RTX is used to optimize
CLZ for a constant input operand. Even then it matters only if the
expression couldn't be folded on tree level already.
In the testcase this happened thanks to loop unrolling on RTL level.
The iteration variable is used as an argument to the clz
builtin. Due to the loop unrolling it becomes a constant and after
folding the broken RTX leads to a wrong assumption.
gcc/ChangeLog:
2018-11-20 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.md ("clztidi2"): Swap the RTX's written to the
DImode parts of the target operand.
gcc/testsuite/ChangeLog:
2018-11-20 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/flogr-1.c: New test.
From-SVN: r266321
PR ipa/87706
* ipa-fnsummary.c (pass_ipa_fnsummary): Do not remove functions
* ipa.c (possible_inline_candidate_p): Break out from ..
(process_references): ... here ; drop before_inlining_p;
cleanup handling of alises.
(walk_polymorphic_call_targets): Likewise.
(symbol_table::remove_unreachable_nodes): Likewise.
* passes.c (pass_data_ipa_remove_symbols): New structure.
(pass_ipa_remove_symbols): New pass.
(make_pass_ipa_remove_symbols): New function.
* tree-pass.h (make_pass_ipa_remove_symbols): Declare.
* passes.def (pass_ipa_remove_symbols): Schedule after early passes.
From-SVN: r266320
PR ipa/87706
* ipa-fnsummary.c (pass_ipa_fnsummary): Do not remove functions
* ipa.c (possible_inline_candidate_p): Break out from ..
(process_references): ... here ; drop before_inlining_p;
cleanup handling of alises.
(walk_polymorphic_call_targets): Likewise.
(symbol_table::remove_unreachable_nodes): Likewise.
* passes.c (pass_data_ipa_remove_symbols): New structure.
(pass_ipa_remove_symbols): New pass.
(make_pass_ipa_remove_symbols): New functoin.
* passes.def (pass_ipa_remove_symbols): Schedule after early passes.
From-SVN: r266315
2018-11-20 Richard Biener <rguenther@suse.de>
* tree-vect-stmts.c (vectorizable_condition): Do not get
at else_clause vect def for EXTRACT_LAST_REDUCTION. Remove
pointless vect_is_simple_use calls.
From-SVN: r266314
2018-11-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/88074
* tree-ssa-dom.c (pass_dominator::execute): Do not walk
backedges.
* gcc.dg/pr88074.c: New testcase.
From-SVN: r266313
2018-11-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/88069
* tree-ssa-sccvn.c (visit_phi): Do not value-number to unvisited
virtual PHI arguments.
* gcc.dg/pr88069.c: New testcase.
From-SVN: r266308
By the time peephole optimizations run, we've already made up our mind
whether to use base-register or relative addressing for literal pool
entries. LT(G) supports only base-register addressing, and so it is
too late to convert L(G)RL + compare to LT(G). This change should not
make the code worse unless building with e.g. -fno-dce, since comparing
literal pool entries to zero should be optimized away during earlier
passes.
gcc/ChangeLog:
2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/88083
* config/s390/s390.md: Skip LT(G) peephole when literal pool is
involved.
* rtl.h (contains_constant_pool_address_p): New function.
* rtlanal.c (contains_constant_pool_address_p): Likewise.
gcc/testsuite/ChangeLog:
2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/88083
* gcc.target/s390/pr88083.c: New test.
From-SVN: r266306
2018-11-20 Richard Biener <rguenther@suse.de>
PR middle-end/83215
* alias.c (component_uses_parent_alias_set_from): Remove
alias-set zero and TYPE_TYPELESS_STORAGE case both already
handled in other ways.
* g++.dg/tree-ssa/pr83215.C: New testcase.
From-SVN: r266305
gnattools build machinery uses just-build xgcc and xg++ as $(CC) and
$(CXX) in native builds. However, if C and C++ languages are not
enabled, it won't find them. So, enable C and C++ if Ada is enabled.
Most of the time, this is probably no big deal: C is always enabled
anyway, and C++ is already enabled for bootstraps.
We need not enable those for cross builds, however. At first I just
took the logic from gnattools/configure, but found it to be lacking:
it would use the just-built tools even in cross-back settings, whose
tools just built for the host would not run on the build machine. So
I've narrowed down the test to rely on autoconf-detected cross-ness
(build->host only), but also to ensure that host matches build, and
that target matches host.
I've considered sourcing ada/config-lang.in from within
gnattools/configure, and testing lang_requires as set by it, so as to
avoid a duplication of tests that ought to remain in sync, but decided
it would be too fragile, as ada/config-lang.in does not expect srcdir
to refer to gnattools.
for gcc/ada/ChangeLog
PR ada/81878
* gcc-interface/config-lang.in (lang_requires): Set to "c c++"
when gnattools wants it.
for gnattools/ChangeLog
PR ada/81878
* configure.ac (default_gnattools_target): Do not mistake
just-built host tools as native in cross-back toolchains.
* configure: Rebuilt.
From-SVN: r266290
2018-11-19 Sandra Loosemore <sandra@codesourcery.com>
PR driver/50250
gcc/
* doc/invoke.texi (Link Options): Mention shared libraries
in documentation for the -l option. Simplify discussion and
point to the system linker documentation for details.
From-SVN: r266287
* include/ext/throw_allocator.h
(annotate_base::insert(void*, size_t)): Use insert result to check for
double insert attempt.
(annotate_base::insert_construct(void*)): Likewise.
(annotate_base::check_allocated(void*, size_t)): Return found iterator.
(annotate_base::erase(void*, size_t)): Use latter method returned
iterator.
(annotate_base::check_constructed(void*, size_t)): Return found iterator.
(annotate_base::erase_construct(void*)): Use latter method returned
iterator.
From-SVN: r266284
gcc/
PR rtl-optimization/88033
* ira-lives.c (non_conflicting_reg_copy_p): Skip copies from a register
to itself. Use HARD_REGISTER_NUM_P.
gcc/testsuite/
PR rtl-optimization/88033
* gcc.target/i386/pr88033.c: New test.
From-SVN: r266282
This is an alternative to https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00694.html
As richi suggested, this disables unrolling of loops vectorised with variable-length SVE
in the vectoriser itself through the loop->unroll member.
It took me a few tries to get it right, as it needs to be set to '1' to disable unrolling,
the rationale for that mechanism is described in the comment in cfgloop.h.
* tree-vect-loop.c (vect_transform_loop): Disable further unrolling
of the loop if vf is non-constant.
* gcc.target/aarch64/sve/unroll-1.c: New test.
From-SVN: r266281
PR tree-optimization/87025 reports an ICE within
-fsave-optimization-record's optrecord_json_writer.
The issue is that dump_context::begin_scope creates an optinfo
of kind OPTINFO_KIND_SCOPE, but fails to call
dump_context::end_any_optinfo, so the optinfo for the scope remains
pending.
The JSON writer would normally push a JSON array for the "scope" optinfo
when the latter is emitted. However, if a dump_* call happens that
doesn't flush the "scope" optinfo e.g. dump_printf (as opposed to
dump_printf_loc), that dump_ call is added to the pending optinfo, and
optinfo::handle_dump_file_kind changes the pending optinfo's m_kind
(e.g. to OPTINFO_KIND_NOTE). Hence when the pending optinfo is
eventually emitted, it isn't OPTINFO_KIND_SCOPE anymore, and hence
the JSON writer doesn't create and push a JSON array for it, leading
to dump_context's view of scopes getting out-of-sync with that of
the JSON writer's.
Later, dump_context::end_scope unconditionally tries to pop the JSON scope
array, but no JSON scope array was added, leading to an assertion
failure (or crash).
The fix is to call dump_context::end_any_optinfo immediately after
creating the scope optinfo, so that it is emitted immediately, ensuring
that the JSON writer stays in-sync with the dump_context.
gcc/ChangeLog:
PR tree-optimization/87025
* dumpfile.c (dump_context::begin_scope): Call end_any_optinfo
immediately after creating the scope optinfo.
(selftest::test_pr87025): New function.
(selftest::dumpfile_c_tests): Call it.
* optinfo-emit-json.cc (optrecord_json_writer::pop_scope): Assert
that we're not popping the top-level records array.
* optinfo.cc (optinfo::handle_dump_file_kind): Assert that we're
not changing the kind of a "scope" optinfo.
gcc/testsuite/ChangeLog:
PR tree-optimization/87025
* gcc.dg/pr87025.c: New test.
From-SVN: r266280
As work towards fixing PR tree-optimization/87025, this patch
eliminates global state from optinfo-emit-json.cc in favor
of adding an optional m_json_writer field to dump_context,
replacing the m_forcibly_enable_optinfo flag.
This allows for writing selftests for the interaction of the
JSON-building code with the dumpfile.c code.
In particular, the existing selftest that created optinfo
instances now exercise the JSON-building code (although no
JSON is actually written out).
The patch also simplifies the layering by replacing optinfo::emit ()
with dump_context::emit_optinfo, so that dump_context has
responsibility for keeping track of dump destinations.
gcc/ChangeLog:
PR tree-optimization/87025
* dump-context.h: Include "optinfo.h".
(class optrecord_json_writer): New forward decl.
(dump_context::forcibly_enable_optinfo_p): Delete.
(dump_context::optinfo_enabled_p): New member function.
(dump_context::optimization_records_enabled_p): New member
function.
(dump_context::set_json_writer): New member function.
(dump_context::emit_optinfo): New member function.
(dump_context::m_forcibly_enable_optinfo): Delete.
(dump_context::m_json_writer): New member data.
* dumpfile.c (dump_context::set_json_writer): New member function.
(dump_context::finish_any_json_writer): New member function.
(dump_context::end_scope): Replace call to
optimization_records_maybe_pop_dump_scope with call to
m_json_writer->pop_scope.
(dump_context::optinfo_enabled_p): New member function.
(dump_context::end_any_optinfo): Replace call to optinfo::emit with call
to dump_context::emit_optinfo.
(dump_context::emit_optinfo): New member function.
(temp_dump_context::temp_dump_context): Replace
m_forcibly_enable_optinfo with call to set_json_writer.
(temp_dump_context::~temp_dump_context): Clean up any json writer.
* optinfo-emit-json.cc (class optrecord_json_writer): Move to
optinfo-emit-json.h
(the_json_writer): Delete.
(optimization_records_start): Delete.
(optimization_records_finish): Delete.
(optimization_records_enabled_p): Delete, in favor of
dump_context::optimization_records_enabled_p.
(optimization_records_maybe_record_optinfo): Delete.
(optimization_records_maybe_pop_dump_scope): Delete.
* optinfo-emit-json.h: Include "json.h". Delete forward
decl of opt_pass.
(optimization_records_start): Delete.
(optimization_records_finish): Delete.
(optimization_records_enabled_p): Delete.
(optimization_records_maybe_record_optinfo): Delete.
(optimization_records_maybe_pop_dump_scope): Delete.
(class optrecord_json_writer): Move here from
optinfo-emit-json.cc.
* optinfo.cc (optinfo::emit_for_opt_problem): Replace call
to optinfo::emit with call to dump_context::emit_optinfo.
(optinfo::emit): Delete, in favor of dump_context::emit_optinfo.
(optinfo_enabled_p): Delete, in favor of
dump_context::optinfo_enabled_p.
(optinfo_wants_inlining_info_p): Update for conversion o
optimization_records_enabled_p to a member function of
dump_context.
* optinfo.h (optinfo_enabled_p): Delete, in favor of
dump_context::optinfo_enabled_p.
(optinfo::emit): Delete, in favor of dump_context::emit_optinfo.
* toplev.c: Include "dump-context.h".
(compile_file): Replace call to optimization_records_finish with
dump_context::finish_any_json_writer.
(do_compile): Replace call to optimization_records_start with
conditionally creating a optrecord_json_writer for the
dump_context.
From-SVN: r266279
PR libstdc++/87855
Also implement P0602R4 (variant and optional
should propagate copy/move triviality) for std::optional.
* include/std/optional (_Optional_payload): Change
the main constraints to check constructibility in
addition to assignability.
(operator=): Make constexpr.
(_M_reset): Likewise.
(_M_construct): Likewise.
(operator->): Likewise.
* testsuite/20_util/optional/assignment/8.cc: Adjust.
* testsuite/20_util/optional/assignment/9.cc: New.
From-SVN: r266278
2018-11-19 Martin Liska <mliska@suse.cz>
PR lto/88077
* lto-symtab.c (lto_symtab_merge): Transform the
condition before r256989.
2018-11-19 Martin Liska <mliska@suse.cz>
PR lto/88077
* gcc.dg/lto/pr88077_0.c: New test.
* gcc.dg/lto/pr88077_1.c: New test.
From-SVN: r266277
PR tree-optimization/88071
* tree-vect-loop.c (vectorize_fold_left_reduction): Pass true instead
of false as last argument to gsi_remove.
* tree-vect-stmts.c (vect_finish_replace_stmt): Pass true instead of
false as last argument to gsi_replace.
* gcc.dg/pr88071.c: New test.
From-SVN: r266276