platform/upstream/gcc.git
5 years ago10.cc: Add dg-require-fileio.
Sandra Loosemore [Fri, 31 Aug 2018 19:09:47 +0000 (15:09 -0400)]
10.cc: Add dg-require-fileio.

2018-08-31  Sandra Loosemore  <sandra@codesourcery.com>

libstdc++-v3/

* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc:
Add dg-require-fileio.
* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc:
Likewise.
* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc:
Likewise.
* testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc:
Likewise.
* testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc:
Likewise.
* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
Likewise.
* testsuite/27_io/basic_filebuf/close/wchar_t/12790-1.cc: Likewise.
* testsuite/27_io/basic_filebuf/close/wchar_t/12790-2.cc: Likewise.
* testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc: Likewise.
* testsuite/27_io/basic_filebuf/close/wchar_t/12790-4.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-1.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-2.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-3.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-4.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-1.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-2.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-4.cc:
Likewise.
* testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc: Likewise.
* testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc:
Likewise.
* testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istream/getline/wchar_t/5.cc: Likewise.
* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise.
* testsuite/27_io/basic_istream/seekg/wchar_t/sstream.cc: Likewise.
* testsuite/27_io/basic_istream/tellg/wchar_t/sstream.cc: Likewise.
* testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc:
Likewise.
* testsuite/27_io/objects/wchar_t/10.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-1.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-2.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-3.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-4.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-5.cc: Likewise.
* testsuite/experimental/string_view/inserters/wchar_t/2.cc:
Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc: Likewise.

From-SVN: r264022

5 years agore PR tree-optimization/87168 (ICE on valid code at -Os and above on x86_64-linux...
Richard Biener [Fri, 31 Aug 2018 16:50:13 +0000 (16:50 +0000)]
re PR tree-optimization/87168 (ICE on valid code at -Os and above on x86_64-linux-gnu: verify_ssa failed)

2018-08-31  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87168
* tree-ssa-sccvn.c (SSA_VAL): Add visited output parameter.
(rpo_elim::eliminate_avail): When OP was not visited it must
be available.

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

From-SVN: r264021

5 years agotree-vrp: add "const" qualifier to various value_range pointers
David Malcolm [Fri, 31 Aug 2018 16:45:47 +0000 (16:45 +0000)]
tree-vrp: add "const" qualifier to various value_range pointers

gcc/ChangeLog:
* tree-vrp.c (copy_value_range): Convert param "from" from
"value_range *" to "const value_range *".
(range_is_null): Likewise for param "vr".
(range_int_cst_p): Likewise.
(range_int_cst_singleton_p): Likewise.
(symbolic_range_p): Likewise.
(value_ranges_intersect_p): Likewise for both params.
(value_range_nonnegative_p): Likewise for param "vr".
(value_range_constant_singleton): Likewise.
(vrp_set_zero_nonzero_bits): Likewise for param "ar".
(extract_range_into_wide_ints): Likewise for param "vr".
(extract_range_from_multiplicative_op): Likewise for params "vr0"
and "vr1".
(vrp_can_optimize_bit_op): Likewise.
(extract_range_from_binary_expr_1): Likewise for params "vr0_" and
"vr1_".
(extract_range_from_unary_expr): Likewise.
(debug_value_range): Likewise for param "vr".
(value_range::dump): Add "const" qualifier.
(vrp_prop::check_array_ref): Convert local "vr" from
"value_range *" to "const value_range *".
(vrp_prop::check_mem_ref): Likewise.
(vrp_prop::visit_stmt): Likewise for local "old_vr".
(vrp_intersect_ranges_1): Likewise for param "vr_1".
(vrp_intersect_ranges): Likewise.
(simplify_stmt_for_jump_threading): Likewise for local "vr".
(vrp_prop::vrp_finalize): Likewise.
* tree-vrp.h (value_range::dump): Add "const" qualifier.
(vrp_intersect_ranges): Add "const" qualifier to params as above.
(extract_range_from_unary_expr): Likewise.
(value_range_constant_singleton): Likewise.
(symbolic_range_p): Likewise.
(copy_value_range): Likewise.
(extract_range_from_binary_expr_1): Likewise.
(range_int_cst_p): Likewise.
(vrp_set_zero_nonzero_bits): Likewise.
(range_int_cst_singleton_p): Likewise.

From-SVN: r264020

5 years ago[AArch64] Implement new intrinsics vabsd_s64 and vnegd_s64.
Vlad Lazar [Fri, 31 Aug 2018 15:00:54 +0000 (15:00 +0000)]
[AArch64] Implement new intrinsics vabsd_s64 and vnegd_s64.

gcc/
2018-08-31  Vlad Lazar  <vlad.lazar@arm.com>

* config/aarch64/arm_neon.h (vabsd_s64): New.
(vnegd_s64): Likewise.

gcc/testsuite/
2018-08-31  Vlad Lazar  <vlad.lazar@arm.com>

* gcc.target/aarch64/scalar_intrinsics.c (test_vnegd_s64): New.
* gcc.target/aarch64/vneg_s.c (RUN_TEST_SCALAR): New.
(test_vnegd_s64): Likewise.
* gcc.target/aarch64/vnegd_64.c: New.
* gcc.target/aarch64/vabsd_64.c: New.
* gcc.tartget/aarch64/vabs_intrinsic_3.c: New

From-SVN: r264019

5 years ago[PR c++/87155] Anonymous namespace and
Nathan Sidwell [Fri, 31 Aug 2018 12:38:00 +0000 (12:38 +0000)]
[PR c++/87155] Anonymous namespace and

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg02031.html
PR c++/87155
PR c++/84707
cp/
* name-lookup.c (name_lookup::search_namespace): Don't look at
inlines when searching for NULL names.
testsuite/
* g++.dg/cpp0x/pr87155.C: New.
* g++.dg/cpp0x/inline-ns10.C: Adjust.

From-SVN: r264016

5 years ago[PATCH] Fix thinko in estimate_local_effects in IPA-CP
Martin Jambor [Fri, 31 Aug 2018 12:14:37 +0000 (14:14 +0200)]
[PATCH] Fix thinko in estimate_local_effects in IPA-CP

2018-08-31  Martin Jambor  <mjambor@suse.cz>

* ipa-cp.c (estimate_local_effects): Replace wrong MAX with MIN.

From-SVN: r264015

5 years agoIPA ICF: make type cache a static field sem_item.
Martin Liska [Fri, 31 Aug 2018 11:37:09 +0000 (13:37 +0200)]
IPA ICF: make type cache a static field sem_item.

2018-08-31  Martin Liska  <mliska@suse.cz>

* ipa-icf.c (sem_item::add_type): Use
sem_item::m_type_hash_cache.
* ipa-icf.h: Move the cache from sem_item_optimizer
to sem_item.

From-SVN: r264014

5 years ago[C++ PATCH] Remove K&R declaration hack.
Nathan Sidwell [Fri, 31 Aug 2018 11:19:33 +0000 (11:19 +0000)]
[C++ PATCH] Remove K&R declaration hack.

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01885.html
gcc/
* doc/extend.texi (Backwards Compatibility): Remove implicit
extern C leeway of () being (...).
gcc/cp/
* decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
of return types and parms.
* parser.c (cp_parser_parameter_declaration_clause): Likewise,
'()' always means '(void)'.

From-SVN: r264013

5 years ago[ipa-inline][obvious] Fix typos in comment
Kyrylo Tkachov [Fri, 31 Aug 2018 10:36:54 +0000 (10:36 +0000)]
[ipa-inline][obvious] Fix typos in comment

* ipa-inline.c (can_inline_edge_by_limits_p): Fix typos in comment.

From-SVN: r264012

5 years agors6000: Make lround<mode>di2 depend on TARGET_FPRND (PR86684)
Segher Boessenkool [Fri, 31 Aug 2018 08:52:13 +0000 (10:52 +0200)]
rs6000: Make lround<mode>di2 depend on TARGET_FPRND (PR86684)

TARGET_FPRND should be on for everything ISA 2.04 and later, and
TARGET_VSX implies ISA 2.06 or later; but it is possible to disable
TARGET_FPRND (separately via -mno-fprnd, but also implicitly)
currently, and then things fall down.  This patch makes things not
fall down.

PR target/86684
PR target/87149
* config/rs6000/rs6000.md (lround<mode>di2): Gate on TARGET_FPRND.

From-SVN: r264011

5 years agore PR middle-end/87138 (wrong code with TI multiplication with -O -march=k8 -fno...
Jakub Jelinek [Fri, 31 Aug 2018 07:49:12 +0000 (09:49 +0200)]
re PR middle-end/87138 (wrong code with TI multiplication with -O -march=k8 -fno-tree-fre -mavx512bw)

PR middle-end/87138
* expmed.c (expand_mult_const): Use immed_wide_int_const instead of
gen_int_mode.  Formatting fixes.

* gcc.target/i386/avx512bw-pr87138.c: New test.

From-SVN: r264009

5 years agore PR fortran/86328 (Runtime segfault reading an allocatable class(*) object in alloc...
Paul Thomas [Fri, 31 Aug 2018 06:51:31 +0000 (06:51 +0000)]
re PR fortran/86328 (Runtime segfault reading an allocatable class(*) object in allocate statements)

2018-08-31  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86328
PR fortran/86760
* trans-array.c (gfc_conv_scalarized_array_ref): Do not fix
info->descriptor but pass it directly to gfc_build_array_ref.
(gfc_conv_array_ref): Likewise for se->expr.
* trans.c (gfc_build_array_ref): If 'decl' is a COMPONENT_REF
obtain the span field directly from it.

2018-08-31  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86328
PR fortran/86760
* gfortran.dg/pr86328.f90 : New test.
in comment 12 of the PR.
* gfortran.dg/pr86760.f90 : New test.

From-SVN: r264008

5 years agoFix PR testsuite/86519 reference.
Rainer Orth [Fri, 31 Aug 2018 06:43:07 +0000 (06:43 +0000)]
Fix PR testsuite/86519 reference.

From-SVN: r264007

5 years agoDaily bump.
GCC Administrator [Fri, 31 Aug 2018 00:16:48 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r264006

5 years agonoexcept30.C: Make dependence on -fdelete-null-pointer-checks explicit.
Sandra Loosemore [Thu, 30 Aug 2018 21:27:44 +0000 (17:27 -0400)]
noexcept30.C: Make dependence on -fdelete-null-pointer-checks explicit.

2018-08-30  Sandra Loosemore  <sandra@codesourcery.com>

gcc/testsuite/
* g++.dg/cpp0x/noexcept30.C: Make dependence on
-fdelete-null-pointer-checks explicit.
* g++.dg/cpp1y/constexpr-82218.C: Likewise.
* g++.dg/expr/pmf-3.C: Likewise.
* g++.dg/ext/attr-returns-nonnull.C: Likewise.
* g++.dg/tree-ssa/lifetime-dse1.C: Likewise.
* g++.dg/tree-ssa/pr61034.C: Likewise.
* gcc.dg/addr_equal-1.c: Likewise.
* gcc.dg/ipa/pr85734.c: Likewise.
* gcc.dg/ipa/propmalloc-1.c: Likewise.
* gcc.dg/ipa/propmalloc-2.c: Likewise.
* gcc.dg/ipa/propmalloc-3.c: Likewise.
* gcc.dg/tree-ssa/pr78154.c: Likewise.
* gcc.dg/tree-ssa/pr83648.c: Likewise.

libstdc++-v3/
* testsuite/experimental/propagate_const/observers/1.cc: Make
dependence on -fdelete-null-pointer-checks explicit.

From-SVN: r264001

5 years agoPR testsuite/87158 - FAIL gcc.c-torture/execute/memchr-1.c on big endian targets
Martin Sebor [Thu, 30 Aug 2018 21:25:10 +0000 (21:25 +0000)]
PR testsuite/87158 - FAIL gcc.c-torture/execute/memchr-1.c on big endian targets

gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/memchr-1.c: Correct big-endian expectations.

From-SVN: r264000

5 years agotarget.def (custom_function_descriptors): Improve documentation.
Sandra Loosemore [Thu, 30 Aug 2018 21:02:37 +0000 (17:02 -0400)]
target.def (custom_function_descriptors): Improve documentation.

2018-08-30  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* target.def (custom_function_descriptors): Improve documentation.
* doc/tm.texi.in (Trampolines): Expand discussion of function
descriptors and move TARGET_CUSTOM_FUNCTION_DESCRIPTORS to the
beginning of the section.
* doc/tm.texi: Regenerated.

From-SVN: r263999

5 years agocfg.h (class auto_edge_flag): Spell out the template-id of the base class in the...
Jose E. Marchesi [Thu, 30 Aug 2018 20:28:31 +0000 (22:28 +0200)]
cfg.h (class auto_edge_flag): Spell out the template-id of the base class in the initializer list.

gcc:

2018-08-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

* cfg.h (class auto_edge_flag): Spell out the template-id of the
base class in the initializer list.  This is a workaround for
building with older GCC.
(class auto_bb_flag): Likewise.

From-SVN: r263997

5 years agoaltivec.md (altivec_eq<mode>): Remove star.
Aaron Sawdey [Thu, 30 Aug 2018 18:17:00 +0000 (18:17 +0000)]
altivec.md (altivec_eq<mode>): Remove star.

2018-08-30  Aaron Sawdey  <acsawdey@linux.ibm.com>

* config/rs6000/altivec.md (altivec_eq<mode>): Remove star.
(altivec_vcmpequ<VI_char>_p): Remove star.
* config/rs6000/rs6000-string.c (do_load_for_compare): Support
vector load modes.
(expand_strncmp_vec_sequence): New function.
(emit_final_str_compare_vec): New function.
(expand_strn_compare): Add support for vector strncmp.
* config/rs6000/rs6000.opt (-mstring-compare-inline-limit): Change
length specification to bytes.
* config/rs6000/vsx.md (vsx_ld_elemrev_v16qi_internal): Remove star.
(vcmpnezb_p): New pattern.
* doc/invoke.texi (RS/6000 and PowerPC Options): Update documentation
for option -mstring-compare-inline-limit.

From-SVN: r263991

5 years agox86: Move AESNI generation to Skylake and Goldmont
Thiago Macieira [Thu, 30 Aug 2018 15:59:41 +0000 (15:59 +0000)]
x86: Move AESNI generation to Skylake and Goldmont

The instruction set first appeared with Westmere, but not all processors
in that and the next few generations have the instructions. According to
Wikipedia[1], the first generation in which all SKUs have AES
instructions are Skylake and Goldmont. I can't find any Skylake,
Kabylake, Kabylake-R or Cannon Lake currently listed at
https://ark.intel.com that says "IntelĀ® AES New Instructions" "No".

[1] https://en.wikipedia.org/wiki/AES_instruction_set

2018-08-30  Thiago Macieira  <thiago.macieira@intel.com>

* config/i386/i386.c (PTA_WESTMERE): Remove PTA_AES.
(PTA_SKYLAKE): Add PTA_AES.
(PTA_GOLDMONT): Likewise.

From-SVN: r263989

5 years agore PR lto/86517 (relocation R_X86_64_32 against `.rodata.str1.1' can not be used...
Jan Hubicka [Thu, 30 Aug 2018 15:50:39 +0000 (17:50 +0200)]
re PR lto/86517 (relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object with LTO)

PR lto/86517
* lto-opts.c (lto_write_options): Always stream PIC/PIE mode.
* lto-wrapper.c (merge_and_complain): Fix merging of PIC/PIE.

From-SVN: r263988

5 years ago[libcpp] fix some line map comments
Nathan Sidwell [Thu, 30 Aug 2018 15:16:21 +0000 (15:16 +0000)]
[libcpp] fix some line map comments

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01978.html
* include/line-map.h (enum lc_reason): Comment each member
separately.
(struct line_maps): Fix reallocator comment.

From-SVN: r263987

5 years agoAvoid undefined shifts in ceil2 operations
Jonathan Wakely [Thu, 30 Aug 2018 15:07:35 +0000 (16:07 +0100)]
Avoid undefined shifts in ceil2 operations

For values where the result cannot be represented the shift width would
be equal to the width of the type, which is undefined. Perform two
well-defined shifts instead of one possible undefined shift.

* include/bits/hashtable_policy.h (__clp2): Fix calculation for LLP64
targets where sizeof(size_t) > sizeof(long). Avoid undefined shifts
of the number of bits in the type.
* include/std/bit (__ceil2): Avoid undefined shifts.
* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Test values with
the most signifiant bit set.

From-SVN: r263986

5 years agolto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow TYPE_STUB_DECL.
Jan Hubicka [Thu, 30 Aug 2018 15:05:38 +0000 (17:05 +0200)]
lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow TYPE_STUB_DECL.

* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow
TYPE_STUB_DECL.
(hash_tree): Do not visit TYPE_STUB_DECL.
* tree-streamer-out.c (write_ts_type_common_tree_pointers): Do not
stream TYPE_STUB_DECL.
* tree-streamer-in.c (lto_input_ts_type_common_tree_pointers): Likewise.
* ipa-utils.h (type_with_linkage_p): Do not rely on TYPE_STUB_DECL
after free_lang_data.
(type_in_anonymous_namespace_p): Likewise.

From-SVN: r263985

5 years agoMove strcmpopt_6.c from gcc.dg to gcc.target/aarch64 and gcc.target/i386.
Qing Zhao [Thu, 30 Aug 2018 14:46:53 +0000 (14:46 +0000)]
Move strcmpopt_6.c from gcc.dg to gcc.target/aarch64 and gcc.target/i386.

From-SVN: r263983

5 years agogimplefe: expose MULT_HIGHPART_EXPR
Alexander Monakov [Thu, 30 Aug 2018 13:47:59 +0000 (16:47 +0300)]
gimplefe: expose MULT_HIGHPART_EXPR

* gimple-parser.c (c_parser_gimple_binary_expression): Accept infix
"__MULT_HIGHPART" for MULT_HIGHPART_EXPR.

From-SVN: r263982

5 years agosreal.h (SREAL_PART_BITS): Change to 31; remove seemingly unnecessary comment that...
Jan Hubicka [Thu, 30 Aug 2018 12:58:42 +0000 (14:58 +0200)]
sreal.h (SREAL_PART_BITS): Change to 31; remove seemingly unnecessary comment that it has to be even number.

* sreal.h (SREAL_PART_BITS): Change to 31; remove seemingly unnecessary
comment that it has to be even number.
(class sreal): Change m_sig type to int32_t.
* sreal.c (sreal::dump, sreal::to_int, opreator+, operator-): Use
int64_t for temporary calculations.
(sreal_verify_basics): Drop one bit from minimum and maximum.

From-SVN: r263981

5 years agore PR tree-optimization/87147 (GCC miscompiles at -O3 on valid code)
Richard Biener [Thu, 30 Aug 2018 12:37:10 +0000 (12:37 +0000)]
re PR tree-optimization/87147 (GCC miscompiles at -O3 on valid code)

2018-08-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87147
* tree-ssa-sccvn.c (SSA_VISITED): New function.
(visit_phi): When the degenerate result is from the backedge and
we didn't visit its definition yet drop to VARYING.
(do_rpo_vn): Properly mark blocks with incoming backedges as executable.

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

From-SVN: r263980

5 years agolto-streamer-out.c (DFS::DFS_write_tree_body): Do not walk DECL_VINDEX.
Jan Hubicka [Thu, 30 Aug 2018 12:36:24 +0000 (14:36 +0200)]
lto-streamer-out.c (DFS::DFS_write_tree_body): Do not walk DECL_VINDEX.

* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not walk
DECL_VINDEX.
(hash_tree): Likewise.

From-SVN: r263979

5 years agotree.c (find_decls_types_r): Walk also TYPE_NEXT_PTR_TO and TYPE_NEXT_REF_TO.
Jan Hubicka [Thu, 30 Aug 2018 12:32:45 +0000 (14:32 +0200)]
tree.c (find_decls_types_r): Walk also TYPE_NEXT_PTR_TO and TYPE_NEXT_REF_TO.

* tree.c (find_decls_types_r): Walk also TYPE_NEXT_PTR_TO
and TYPE_NEXT_REF_TO.

From-SVN: r263978

5 years agoFix undefined references seen with mingw-w64
Jonathan Wakely [Thu, 30 Aug 2018 12:28:53 +0000 (13:28 +0100)]
Fix undefined references seen with mingw-w64

* config/abi/pre/gnu.ver: Add missing exports for mingw.

From-SVN: r263977

5 years agoFix __gnu_cxx::_Pointer_adapter for long long arithmetic
Jonathan Wakely [Thu, 30 Aug 2018 12:24:06 +0000 (13:24 +0100)]
Fix __gnu_cxx::_Pointer_adapter for long long arithmetic

* include/ext/pointer.h (_Pointer_adapter): Define operators for
pointer arithmetic using long long offsets.
* testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using
long long values.

From-SVN: r263976

5 years agoLimit movmem copies to TImode on AArch64
Tamar Christina [Thu, 30 Aug 2018 10:40:07 +0000 (10:40 +0000)]
Limit movmem copies to TImode on AArch64

On AArch64 we have integer modes larger than TImode, and while we can generate
moves for these they're not as efficient.

So instead make sure we limit the maximum we can copy to TImode.  This means
copying a 16 byte struct will issue 1 TImode copy, which will be done using a
single STP as we expect but an CImode sized copy won't issue CImode operations.

I am also moving the residual code inside the if since smallest_mode_for_int may
trap if the mode doesn't exist.  And the only time we know the mode to exist for
sure is when the condition of the if is true.  This also saves repeated calls to
the iterator.

gcc/
2018-08-30  Tamar Christina  <tamar.christina@arm.com>

* config/aarch64/aarch64.c (aarch64_expand_movmem): Set TImode max.

gcc/testsuite/
2018-08-30  Tamar Christina  <tamar.christina@arm.com>

  * gcc.target/aarch64/large_struct_copy_2.c: New.

From-SVN: r263974

5 years agoEnable underflow check in canonicalize_comparison. (PR86995)
Vlad Lazar [Thu, 30 Aug 2018 09:30:49 +0000 (09:30 +0000)]
Enable underflow check in canonicalize_comparison. (PR86995)

gcc/
2018-08-30  Vlad Lazar  <vlad.lazar@arm.com>

PR middle-end/86995
* expmed.c (canonicalize_comparison): Use wi::sub instead of wi::add
if to_add is negative.

From-SVN: r263973

5 years agoDaily bump.
GCC Administrator [Thu, 30 Aug 2018 00:17:02 +0000 (00:17 +0000)]
Daily bump.

From-SVN: r263972

5 years agore PR middle-end/87053 (wrong code with c_strlen)
Bernd Edlinger [Wed, 29 Aug 2018 22:16:09 +0000 (22:16 +0000)]
re PR middle-end/87053 (wrong code with c_strlen)

gcc:
2018-08-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

PR middle-end/87053
* builtins.c (c_strlen): Improve range checks.

testsuite:
2018-08-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

PR middle-end/87053
* gcc.c-torture/execute/pr87053.c: New test.

From-SVN: r263968

5 years agore PR sanitizer/87095 (UndefinedBehaviorSanitizer vptr false positive with virtual...
Jakub Jelinek [Wed, 29 Aug 2018 21:43:18 +0000 (23:43 +0200)]
re PR sanitizer/87095 (UndefinedBehaviorSanitizer vptr false positive with virtual inheritance only with -fno-sanitize-recover)

PR c++/87095
* decl.c (begin_destructor_body): If current_class_type has
virtual bases and the primary base is nearly empty virtual base,
voidify clearing of vptr and make it conditional on in-charge
argument.

* g++.dg/ubsan/vptr-13.C: New test.

From-SVN: r263967

5 years agore PR c++/85265 ([concepts] ICE with missing identifier)
Paolo Carlini [Wed, 29 Aug 2018 20:29:55 +0000 (20:29 +0000)]
re PR c++/85265 ([concepts] ICE with missing identifier)

/cp
2018-08-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/85265
* parser.c (cp_parser_introduction_list): If cp_parser_identifier
returns error_mark_node early exit the loop.
(cp_parser_template_introduction): Improve error-recovery, remove
error call about empty introduction-list.

/testsuite
2018-08-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/85265
* g++.dg/concepts/pr85265.C: New.

From-SVN: r263966

5 years agore PR middle-end/86714 (tree-ssa-forwprop.c confused by too long initializer)
Martin Sebor [Wed, 29 Aug 2018 17:17:08 +0000 (17:17 +0000)]
re PR middle-end/86714 (tree-ssa-forwprop.c confused by too long initializer)

PR tree-optimization/86714
PR tree-optimization/86711
* builtins.c (c_strlen): Add arguments to call to string_constant.
* expr.c (string_constant): Add argument.  Detect missing nul
terminator and outermost declaration it's missing in.
* expr.h (string_constant): Add argument.
* fold-const.c (read_from_constant_string): Add arguments to call to
string_constant.
(c_getstr): Likewise.
* tree-ssa-forwprop.c (simplify_builtin_call): Likewise.
to string_constant.
* tree-ssa-strlen.c (get_stridx): Likewise.

PR tree-optimization/86714
PR tree-optimization/86711
* gcc.c-torture/execute/memchr-1.c: New test.
* gcc.c-torture/execute/pr86714.c: New test.
* gcc.c-torture/execute/widechar-3.c: New test.
* gcc.dg/strlenopt-58.c: New test.

Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r263963

5 years agotree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Do not stream DECL_VINDEX.
Jan Hubicka [Wed, 29 Aug 2018 17:07:35 +0000 (19:07 +0200)]
tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Do not stream DECL_VINDEX.

* tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers):
Do not stream DECL_VINDEX.
* tree-streamer-out.c (write_ts_function_decl_tree_pointers): Likewise.
* tree.c (free_lang_data_in_decl): Clear DECL_VINDEX.
(decl_function_context): Use DECL_VIRTUAL_P rather than DECL_VINDEX.

From-SVN: r263962

5 years agotree-ssa-sccvn.c (vuse_ssa_val): Return NULL for unvisited virtual operands that...
Richard Biener [Wed, 29 Aug 2018 15:02:06 +0000 (15:02 +0000)]
tree-ssa-sccvn.c (vuse_ssa_val): Return NULL for unvisited virtual operands that are not default defs to honor...

2018-08-29  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vuse_ssa_val): Return NULL for unvisited
virtual operands that are not default defs to honor region
boundaries.
(rpo_vn_valueize): Remove ineffective code here.

From-SVN: r263960

5 years agore PR tree-optimization/87132 (Gcc miscompiles at -O2 on valid code)
Richard Biener [Wed, 29 Aug 2018 14:13:20 +0000 (14:13 +0000)]
re PR tree-optimization/87132 (Gcc miscompiles at -O2 on valid code)

2018-08-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87132
* tree-ssa-alias.c (get_continuation_for_phi): Do not translate
when skipping defs reachable over backedges.

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

From-SVN: r263959

5 years agotree-core.h: Document use of deprecated_flag in SSA_NAME.
Richard Biener [Wed, 29 Aug 2018 14:12:25 +0000 (14:12 +0000)]
tree-core.h: Document use of deprecated_flag in SSA_NAME.

2018-08-29  Richard Biener  <rguenther@suse.de>

* tree-core.h: Document use of deprecated_flag in SSA_NAME.
* tree.h (SSA_NAME_POINTS_TO_READONLY_MEMORY): Define.
* tree-into-ssa.c (pass_build_ssa::execute): Initialize
function parameters SSA_NAME_POINTS_TO_READONLY_MEMORY from fnspec.
* tree-ssa-sccvn.c (const_parms, init_const_parms): Remove.
(vn_reference_lookup_3): Remove use of const_parms.
(free_rpo_vn): Do not free const_parms.
(do_rpo_vn): Do not call init_const_parms.
* tree-ssa-alias.c (refs_may_alias_p_1): Honor
SSA_NAME_POINTS_TO_READONLY_MEMORY.
(call_may_clobber_ref_p_1): Likewise.

From-SVN: r263958

5 years agoC++: underline param in print_conversion_rejection (more PR c++/85110)
David Malcolm [Wed, 29 Aug 2018 13:52:22 +0000 (13:52 +0000)]
C++: underline param in print_conversion_rejection (more PR c++/85110)

Consider this bogus code (from g++.dg/diagnostic/param-type-mismatch-2.C):

struct s4 { static int member_1 (int one, const char **two, float three); };

int test_4 (int first, const char *second, float third)
{
  return s4::member_1 (first, second, third);
}

Before this patch, g++ emits:

demo.cc: In function 'int test_4(int, const char*, float)':
demo.cc:5:44: error: no matching function for call to 's4::member_1(int&, const char*&, float&)'
5 |   return s4::member_1 (first, second, third);
  |                                            ^
demo.cc:1:24: note: candidate: 'static int s4::member_1(int, const char**, float)'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                        ^~~~~~~~
demo.cc:1:24: note:   no known conversion for argument 2 from 'const char*' to 'const char**'

With this patch, it highlights the pertinent parameter in the
"no known conversion" note:

demo.cc: In function 'int test_4(int, const char*, float)':
demo.cc:5:44: error: no matching function for call to 's4::member_1(int&, const char*&, float&)'
5 |   return s4::member_1 (first, second, third);
  |                                            ^
demo.cc:1:24: note: candidate: 'static int s4::member_1(int, const char**, float)'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                        ^~~~~~~~
demo.cc:1:56: note:   no known conversion for argument 2 from 'const char*' to 'const char**'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                                           ~~~~~~~~~~~~~^~~

gcc/cp/ChangeLog:
PR c++/85110
* call.c (print_conversion_rejection): Add "fn" param and use it
for "no known conversion" messages to underline the pertinent
param.
(print_z_candidate): Supply "fn" to the new param above.

gcc/testsuite/ChangeLog:
PR c++/85110
* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
output to reflect underlining of pertinent parameter in decl
for "no known conversion" messages.

From-SVN: r263957

5 years agodoc: document -ftree-scev-cprop
Alexander Monakov [Wed, 29 Aug 2018 12:39:12 +0000 (15:39 +0300)]
doc: document -ftree-scev-cprop

PR other/86726
* invoke.texi (Optimization Options): List -ftree-scev-cprop.
(-O): Ditto.
(-ftree-scev-cprop): Document.

From-SVN: r263955

5 years agore PR c++/87122 (ICE in tsubst_decomp_names)
Jakub Jelinek [Wed, 29 Aug 2018 12:27:55 +0000 (14:27 +0200)]
re PR c++/87122 (ICE in tsubst_decomp_names)

PR c++/87122
* pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
processing_template_decl and decl is structured binding decl, call
cp_finish_decomp.

* g++.dg/cpp1z/decomp47.C: New test.

From-SVN: r263953

5 years agosreal.h (normalize, [...]): Add new_sig/new_exp parameters.
Jan Hubicka [Wed, 29 Aug 2018 12:21:28 +0000 (14:21 +0200)]
sreal.h (normalize, [...]): Add new_sig/new_exp parameters.

* sreal.h (normalize, normalize_up, normalize_down): Add new_sig/new_exp
parameters.
(sreal constructor): Update.
* sreal.c (sreal:operator+, sreal:operator-, sreal:operator*,
sreal:operator/): Update.

From-SVN: r263952

5 years agoFix thinko in lto.c (PR bootstrap/87130).
Martin Liska [Wed, 29 Aug 2018 10:48:50 +0000 (12:48 +0200)]
Fix thinko in lto.c (PR bootstrap/87130).

2018-08-29  Martin Liska  <mliska@suse.cz>

PR bootstrap/87130
* lto.c (read_cgraph_and_symbols): Fix thinko, revert
to behavior before r263887.

From-SVN: r263950

5 years agoMAINTAINERS (write after approval): Add myself.
Vlad Lazar [Wed, 29 Aug 2018 10:24:46 +0000 (10:24 +0000)]
MAINTAINERS (write after approval): Add myself.

2018-08-29  Vlad Lazar  <vlad.lazar@arm.com>

* MAINTAINERS (write after approval): Add myself.

From-SVN: r263949

5 years agoPR libstdc++/31413 fix test failure on Debian systems
Jonathan Wakely [Wed, 29 Aug 2018 10:05:55 +0000 (11:05 +0100)]
PR libstdc++/31413 fix test failure on Debian systems

Debian uses a different D_FMT string for the zh_TW.UTF-8 locale, which
caused this test to fail. Try to detect the Debian format and adjust
the input being tested.

PR libstdc++/31413
* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT
string for alternative format.

From-SVN: r263948

5 years agoStrenghten assumption about gswitch statements.
Martin Liska [Wed, 29 Aug 2018 08:35:09 +0000 (10:35 +0200)]
Strenghten assumption about gswitch statements.

2018-08-29  Martin Liska  <mliska@suse.cz>

* tree-switch-conversion.c (switch_conversion::expand):
Strenghten assumption about gswitch statements.

From-SVN: r263947

5 years ago[AARCH64] Use stdint integers in vect_su_add_sub.c
Matthew Malcomson [Wed, 29 Aug 2018 08:22:19 +0000 (08:22 +0000)]
[AARCH64] Use stdint integers in vect_su_add_sub.c

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

* gcc.target/aarch64/simd/vect_su_add_sub.c: Use 32 and 64-bit types
where appropriate.

From-SVN: r263946

5 years agore PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
Richard Biener [Wed, 29 Aug 2018 06:49:06 +0000 (06:49 +0000)]
re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)

2018-08-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
re-value-number released SSA VDEFs.

* gfortran.dg/pr87117.f90: New testcase.

From-SVN: r263945

5 years agore PR tree-optimization/87126 (ICE on valid code at -Os and above on x86_64-linux...
Richard Biener [Wed, 29 Aug 2018 06:47:14 +0000 (06:47 +0000)]
re PR tree-optimization/87126 (ICE on valid code at -Os and above on x86_64-linux-gnu: in vn_reference_insert, at tree-ssa-sccvn.c:2698)

2018-08-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87126
* tree-ssa-sccvn.c (vn_reference_insert): Remove assert.

* gcc.dg/tree-ssa/pr87126.c: New testcase.

From-SVN: r263944

5 years agoRewrite pic.md to improve medany and pic code size.
Jim Wilson [Wed, 29 Aug 2018 02:20:44 +0000 (02:20 +0000)]
Rewrite pic.md to improve medany and pic code size.

gcc/
* config/riscv/pic.md: Rewrite.
* config/riscv/riscv.c (riscv_address_insns): Return cost of 3 for
invalid address.
* config/riscv/riscv.md (ZERO_EXTEND_LOAD): Delete.
(SOFTF, default_load, softload, softstore): New.

From-SVN: r263943

5 years agoremove utf-8 from comment
Jason Merrill [Wed, 29 Aug 2018 01:14:21 +0000 (21:14 -0400)]
remove utf-8 from comment

From-SVN: r263942

5 years agocompiler, runtime: remove hmap field from maptypes
Ian Lance Taylor [Wed, 29 Aug 2018 00:20:25 +0000 (00:20 +0000)]
compiler, runtime: remove hmap field from maptypes

    This is the gofrontend version of https://golang.org/cl/91796.

    This is part of that CL, just the compiler change and required runtime
    changes, in preparation for updating libgo to 1.11.

    Relevant part of original CL description:

        The hmap field in the maptype is only used by the runtime to check the sizes of
        the hmap structure created by the compiler and runtime agree.

        Comments are already present about the hmap structure definitions in the
        compiler and runtime needing to be in sync.

    Reviewed-on: https://go-review.googlesource.com/130976

From-SVN: r263941

5 years agoDaily bump.
GCC Administrator [Wed, 29 Aug 2018 00:16:35 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263940

5 years ago* fold-const.c (fold_binary_loc): Remove recently added assert.
Jeff Law [Tue, 28 Aug 2018 23:09:57 +0000 (17:09 -0600)]
* fold-const.c (fold_binary_loc): Remove recently added assert.

From-SVN: r263936

5 years agogenpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED to OP parmeter...
Joern Rennecke [Tue, 28 Aug 2018 21:54:44 +0000 (21:54 +0000)]
genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED to OP parmeter of generated function.

        * genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED
        to OP parmeter of generated function.

From-SVN: r263934

5 years agore PR middle-end/87009 (Can't find XOR pattern applying De Morgan sequentially)
MCC CS [Tue, 28 Aug 2018 20:23:05 +0000 (20:23 +0000)]
re PR middle-end/87009 (Can't find XOR pattern applying De Morgan sequentially)

PR tree-optimization/87009
* match.pd: Add boolean optimizations.

PR tree-optimization/87009
* gcc.dg/pr87009.c: New test.

From-SVN: r263931

5 years agore PR middle-end/86631 (missing -Walloc-size-larger-than on ILP32 hosts)
Martin Sebor [Tue, 28 Aug 2018 19:58:02 +0000 (13:58 -0600)]
re PR middle-end/86631 (missing -Walloc-size-larger-than on ILP32 hosts)

gcc/testsuite/ChangeLog:

PR middle-end/86631
* g++.dg/Walloca1.C: Adjust.

From-SVN: r263930

5 years agoPR middle-end/86631 - missing -Walloc-size-larger-than on ILP32 hosts
Martin Sebor [Tue, 28 Aug 2018 19:09:38 +0000 (19:09 +0000)]
PR middle-end/86631 - missing -Walloc-size-larger-than on ILP32 hosts

gcc/ChangeLog:

PR middle-end/86631
* calls.c (alloc_max_size): Treat HOST_WIDE_INT special.
* gimple-ssa-warn-alloca.c (adjusted_warn_limit): New function.
(pass_walloca::gate): Use it.
(alloca_call_type): Same.
(pass_walloca::execute): Same.
* stor-layout.c (layout_decl): Treat HOST_WIDE_INT special.

gcc/testsuite/ChangeLog:

PR middle-end/86631
* g++.dg/Walloca1.C: Adjust.

From-SVN: r263928

5 years agoPR libstdc++/87116 fix path::lexically_normal() handling of dot-dot
Jonathan Wakely [Tue, 28 Aug 2018 15:33:53 +0000 (16:33 +0100)]
PR libstdc++/87116 fix path::lexically_normal() handling of dot-dot

Previously the logic that turned "a/b/c/../.." into "a/" failed to
preserve an empty path at the end of the iteration sequence, as required
by the trailing slash. That meant the result didn't meet the class
invariants, and that "a/b/c/d/../../.." would remove four components
instead of the three that "../../.." should remove.

PR libstdc++/87116
* src/filesystem/std-path.cc (path::lexically_normal): When handling
a dot-dot filename, preserve an empty final component in the iteration
sequence.
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use preferred-separator for
root-directory.
* testsuite/27_io/filesystem/path/generation/normal.cc: Add new tests
for more than two adjacent dot-dot filenames.
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Replace slashes with
preferred-separator in expected normalized strings.

From-SVN: r263922

5 years agore PR c++/86546 (ICE on invalid: tree_class_check_failed())
Paolo Carlini [Tue, 28 Aug 2018 15:01:15 +0000 (15:01 +0000)]
re PR c++/86546 (ICE on invalid: tree_class_check_failed())

/cp
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/86546
* decl.c (finish_case_label): If the type is erroneous early
return error_mark_node.

/testsuite
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/86546
* g++.dg/other/switch4.C: New.

From-SVN: r263921

5 years agoFix version check for ATTRIBUTE_GCC_DUMP_PRINTF
David Malcolm [Tue, 28 Aug 2018 14:08:45 +0000 (14:08 +0000)]
Fix version check for ATTRIBUTE_GCC_DUMP_PRINTF

gcc/ChangeLog:
* dumpfile.h (ATTRIBUTE_GCC_DUMP_PRINTF): Change version check on
GCC_VERSION for usage of "__gcc_dump_printf__" format from
>= 3005 to >= 9000.

From-SVN: r263920

5 years agore PR tree-optimization/87124 (ICE have integer_cst in SSA_VAL, at tree-ssa-sccvn...
Richard Biener [Tue, 28 Aug 2018 13:36:49 +0000 (13:36 +0000)]
re PR tree-optimization/87124 (ICE have integer_cst in SSA_VAL, at tree-ssa-sccvn.c:462 while building 541.leela_r from SPEC2017)

2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87124
* tree-ssa-sccvn.c (vn_lookup_simplify_result): Guard against
constants before looking up avail.

* g++.dg/torture/pr87124.C: New testcase.

From-SVN: r263918

5 years agore PR fortran/80477 ([OOP] Polymorphic function result generates memory leak)
Paul Thomas [Tue, 28 Aug 2018 11:35:52 +0000 (11:35 +0000)]
re PR fortran/80477 ([OOP] Polymorphic function result generates memory leak)

2017-08-28  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/80477
* trans-expr.c (gfc_conv_procedure_call): Allocatable class
scalar results being passed to a derived type formal argument
are finalized if possible. Otherwise, rely on existing code for
deallocation. Make the deallocation of allocatable result
components conditional on finalization not taking place. Make
the freeing of data components after finalization conditional
on the data being NULL.
(gfc_trans_arrayfunc_assign): Change the gcc_assert to a
condition to return NULL_TREE.
(gfc_trans_assignment_1): If the assignment is class to class
and the rhs expression must be finalized but the assignment
is not marked as a polymorphic assignment, use the vptr copy
function instead of gfc_trans_scalar_assign.

PR fortran/86481
* trans-expr.c (gfc_conv_expr_reference): Do not add the post
block to the pre block if the expression is to be finalized.
* trans-stmt.c (gfc_trans_allocate): If the expr3 must be
finalized, load the post block into a finalization block and
add it right at the end of the allocation block.

2017-08-28  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/80477
* gfortran.dg/class_result_7.f90: New test.
* gfortran.dg/class_result_8.f90: New test.
* gfortran.dg/class_result_9.f90: New test.

PR fortran/86481
* gfortran.dg/allocate_with_source_25.f90: New test.

From-SVN: r263916

5 years agore PR middle-end/87099 (internal compiler error: segmentation fault)
Jakub Jelinek [Tue, 28 Aug 2018 11:13:04 +0000 (13:13 +0200)]
re PR middle-end/87099 (internal compiler error: segmentation fault)

PR middle-end/87099
* calls.c (maybe_warn_nonstring_arg): Punt early if
warn_stringop_overflow is zero.  Don't call get_range_strlen
on 3rd argument, keep iterating until lenrng[1] is INTEGER_CST.
Swap comparison operands to have constants on rhs.  Only use
lenrng[1] if non-NULL and INTEGER_CST.  Don't uselessly
increment lenrng[0].

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

From-SVN: r263915

5 years agoFix unguarded use of tree_to_shwi in tree-ssa-sccvn.c
Richard Sandiford [Tue, 28 Aug 2018 10:42:42 +0000 (10:42 +0000)]
Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c

Fixes many testsuite failures for SVE.

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

gcc/
* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Fix unguarded
use of tree_to_shwi.  Remove duplicated test for the size being
a whole number of bytes.

From-SVN: r263914

5 years agoAdd target selectors to slp-37.c (PR87078)
Richard Sandiford [Tue, 28 Aug 2018 10:42:30 +0000 (10:42 +0000)]
Add target selectors to slp-37.c (PR87078)

This test was failing for Power 7 due to the lack of hw support
for unaligned accesses.

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

gcc/testsuite/
PR testsuite/87078
* gcc.dg/vect/slp-37.c: Restrict scan tests to vect_hw_misalign.

From-SVN: r263913

5 years agore PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
Richard Biener [Tue, 28 Aug 2018 10:15:54 +0000 (10:15 +0000)]
re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)

2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_cleanup):
Handle removed stmt without LHS (GIMPLE_NOP).

From-SVN: r263912

5 years agore PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
Richard Biener [Tue, 28 Aug 2018 10:14:45 +0000 (10:14 +0000)]
re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)

2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Exclude
void which is is_gimple_reg_type by checking for COMPLETE_TYPE_P.

* gcc.dg/pr87117-1.c: New testcase.

From-SVN: r263911

5 years agore PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
Richard Biener [Tue, 28 Aug 2018 10:13:18 +0000 (10:13 +0000)]
re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)

2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-pre.c (compute_avail): Do not make expressions
with predicated values available.
(get_expr_value_id): Assert we do not run into predicated value
expressions.

* gcc.dg/pr87117-2.c: New testcase.

From-SVN: r263910

5 years agore PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
Richard Biener [Tue, 28 Aug 2018 09:33:16 +0000 (09:33 +0000)]
re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)

2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-operands.c (add_stmt_operand): STRING_CST may
get virtual operands.
(get_expr_operands): Handle STRING_CST like other decls.

* gcc.dg/lvalue-5.c: New testcase.

From-SVN: r263908

5 years agoUpdate documentation of fndecl_built_in_p.
Martin Liska [Tue, 28 Aug 2018 07:23:12 +0000 (09:23 +0200)]
Update documentation of fndecl_built_in_p.

2018-08-28  Martin Liska  <mliska@suse.cz>

* tree.h: Update documentation of fndecl_built_in_p
functions.

From-SVN: r263907

5 years agore PR tree-optimization/87110 ([9 Regresssion] tree check fail in to_wide, at tree...
Jeff Law [Tue, 28 Aug 2018 04:02:11 +0000 (22:02 -0600)]
re PR tree-optimization/87110 ([9 Regresssion] tree check fail in to_wide, at tree.h:5523)

PR tree-optimization/87110
* tree-ssa-dse.c (compute_trims): Handle non-constant
TYPE_SIZE_UNIT.

PR tree-optimization/87110
* gcc.c-torture/compile/pr87110.c: New test.

From-SVN: r263906

5 years agoPR tree-optimization/86914 - wrong code with strlen() of poor-man's flexible array...
Martin Sebor [Tue, 28 Aug 2018 00:25:50 +0000 (00:25 +0000)]
PR tree-optimization/86914 - wrong code with strlen() of poor-man's flexible array member plus offset

gcc/ChangeLog:

PR tree-optimization/86914
* tree-ssa-strlen.c (maybe_set_strlen_range): Avoid MEM_REF.

gcc/testsuite/ChangeLog:

PR tree-optimization/86914
* gcc.dg/strlenopt-57.c: New test.

From-SVN: r263905

5 years agoDaily bump.
GCC Administrator [Tue, 28 Aug 2018 00:16:36 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263904

5 years agoPR tree-optimization/87112 - ICE in fold_binary_loc on strnlen of mixed integer types
Martin Sebor [Tue, 28 Aug 2018 00:10:46 +0000 (00:10 +0000)]
PR tree-optimization/87112 - ICE in fold_binary_loc on strnlen of mixed integer types

gcc/ChangeLog:

PR tree-optimization/87112
* builtins.c (expand_builtin_strnlen): Convert c_strlen result to
the type of the bound argument.

gcc/testsuite/ChangeLog:

PR tree-optimization/87112
* gcc.dg/pr87112.c: New test.

From-SVN: r263900

5 years agoC++: fix-it hint for missing "typename" (PR c++/63392)
David Malcolm [Mon, 27 Aug 2018 23:33:02 +0000 (23:33 +0000)]
C++: fix-it hint for missing "typename" (PR c++/63392)

This patch adds a fix-it hint to missing "typename" errors in the C++
frontend, suggesting the insertion of "typename ".

This addresses part of PR c++/63392; however it does not improve the
error-recovery for such cases.

gcc/cp/ChangeLog:
PR c++/63392
* parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
hint.

gcc/testsuite/ChangeLog:
PR c++/63392
* g++.dg/diagnostic/missing-typename.C: New test.

From-SVN: r263899

5 years agotree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have...
Jeff Law [Mon, 27 Aug 2018 20:31:14 +0000 (14:31 -0600)]
tree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have a TYPE_SIZE_UNIT.

* tree-ssa-dse.c (compute_trims): Handle case where the reference's
type does not have a TYPE_SIZE_UNIT.

* gcc.c-torture/compile/dse.c: New test.

From-SVN: r263896

5 years agore PR c++/86993 (assignment of read-only variable error reported at wrong location)
Jakub Jelinek [Mon, 27 Aug 2018 18:36:23 +0000 (20:36 +0200)]
re PR c++/86993 (assignment of read-only variable error reported at wrong location)

PR c++/86993
* cp-tree.h (cxx_readonly_error): Add location_t argument.
* typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
pass LOC to it.  Formatting fixes.
* typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
(cp_build_modify_expr): Pass loc to cxx_readonly_error.
* semantics.c (finish_asm_stmt): Pass input_location to
cxx_readonly_error.

* g++.dg/diagnostic/pr86993.C: New test.

From-SVN: r263891

5 years agoaarch64-speculation.cc: Replace include of cfg.h with include of backend.h.
Steve Ellcey [Mon, 27 Aug 2018 16:39:44 +0000 (16:39 +0000)]
aarch64-speculation.cc: Replace include of cfg.h with include of backend.h.

2018-08-27  Steve Ellcey  <sellcey@cavium.com>

* config/aarch64/aarch64-speculation.cc: Replace include of cfg.h
with include of backend.h.

From-SVN: r263890

5 years agore PR tree-optimization/86927 (Gcc miscompiles at -O3 on valid code)
Richard Biener [Mon, 27 Aug 2018 14:17:03 +0000 (14:17 +0000)]
re PR tree-optimization/86927 (Gcc miscompiles at -O3 on valid code)

2018-08-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/86927
* tree-vect-loop.c (vect_create_epilog_for_reduction): Properly
use const cond reduction code.

* gcc.dg/vect/pr86927.c: New testcase.

From-SVN: r263888

5 years agomatch.pd: add single-use check for (x & y) ^ y -> ~x & y (PR 85758)
Alexander Monakov [Mon, 27 Aug 2018 14:08:50 +0000 (17:08 +0300)]
match.pd: add single-use check for (x & y) ^ y -> ~x & y (PR 85758)

PR tree-optimization/85758
* match.pd ((X & Y) ^ Y): Add :s qualifier to inner expression.

From-SVN: r263887

5 years agoReplace 8 spaces with a tabular in ChangeLog files.
Martin Liska [Mon, 27 Aug 2018 14:04:23 +0000 (14:04 +0000)]
Replace 8 spaces with a tabular in ChangeLog files.

From-SVN: r263886

5 years agoLess verbose fix-it hints for missing header files (PR 87091)
David Malcolm [Mon, 27 Aug 2018 14:02:05 +0000 (14:02 +0000)]
Less verbose fix-it hints for missing header files (PR 87091)

This patch tweaks maybe_add_include_fixit so that if we're emitting a note
about adding the header file, the note's primary location will be replaced
by that of the fix-it hint, to avoid repeating a location we've already
emitted (or one close to it).

For example, this simplifies:

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

to:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                           ^~~~~~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif

eliminating the repetition of line 87 in the note.

Doing so requires converting show_caret_p to a tri-state, to avoid
meaninglessly printing a caret for the first column in the next line
(and colorizing it):

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif
      | ^

gcc/c-family/ChangeLog:
PR 87091
* c-common.c (c_cpp_error): Update for conversion of show_caret_p
to a tri-state.
(maybe_suggest_missing_token_insertion): Likewise.
(maybe_add_include_fixit): Add param "override_location".  If set,
and source-printing is enabled, then override the rich_location's
primary location with that of the insertion point for the fix-it
hint, marking it with SHOW_LINES_WITHOUT_RANGE.
* c-common.h (extern void maybe_add_include_fixit): Add bool
param.
* c-format.c (selftest::test_type_mismatch_range_labels): Update
for conversion of show_caret_p to a tri-state.
* c-warn.c (warn_for_restrict): Likewise.
* known-headers.cc
(suggest_missing_header::~suggest_missing_header): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.

gcc/c/ChangeLog:
PR 87091
* c-decl.c (implicitly_declare): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.
* c-objc-common.c (c_tree_printer): Update for conversion of
show_caret_p to a tri-state.

gcc/cp/ChangeLog:
PR 87091
* decl.c (grokdeclarator): Update for conversion of show_caret_p
to a tri-state.
* error.c (cp_printer): Likewise.
* name-lookup.c (maybe_suggest_missing_std_header): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.
* parser.c (cp_parser_string_literal): Update for conversion of
show_caret_p to a tri-state.
(cp_parser_elaborated_type_specifier): Likewise.
(set_and_check_decl_spec_loc): Likewise.
* pt.c (listify): Update call to maybe_add_include_fixit to not
override the location, as it is for an error.
* rtti.c (typeid_ok_p): Likewise.

gcc/ChangeLog:
PR 87091
* diagnostic-show-locus.c (class layout_range): Update for
conversion of show_caret_p to a tri-state.
(layout_range::layout_range): Likewise.
(make_range): Likewise.
(layout::maybe_add_location_range): Likewise.
(layout::should_print_annotation_line_p): Don't show annotation
lines for ranges that are SHOW_LINES_WITHOUT_RANGE.
(layout::get_state_at_point): Update for conversion of
show_caret_p to a tri-state.  Bail out early for
SHOW_LINES_WITHOUT_RANGE, so that such ranges don't affect
underlining or source colorization.
(gcc_rich_location::add_location_if_nearby): Update for conversion
of show_caret_p to a tri-state.
(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
(selftest::test_one_liner_fixit_replace_equal_secondary_range):
Likewise.
(selftest::test_one_liner_labels): Likewise.
* gcc-rich-location.c (gcc_rich_location::add_expr): Update for
conversion of show_caret_p to a tri-state.
* pretty-print.c (text_info::set_location): Likewise.
* pretty-print.h (text_info::set_location): Likewise.
* substring-locations.c (format_warning_n_va): Likewise.
* tree-diagnostic.c (default_tree_printer): Likewise.
* tree-pretty-print.c (newline_and_indent): Likewise.

gcc/fortran/ChangeLog:
PR 87091
* error.c (gfc_format_decoder): Update for conversion of
show_caret_p to a tri-state.

gcc/testsuite/ChangeLog:
PR 87091
* gcc.dg/empty.h: New file.
* gcc.dg/fixits-pr84852-1.c: Update for move of fix-it hint to
top of file and removal of redundant second printing of warning
location.
* gcc.dg/fixits-pr84852-2.c: Likewise.
* gcc.dg/missing-header-fixit-3.c: Likewise.
* gcc.dg/missing-header-fixit-4.c: New test.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Update for
conversion of show_caret_p to a tri-state.

libcpp/ChangeLog:
PR 87091
* include/line-map.h (enum range_display_kind): New enum.
(struct location_range): Replace field "m_show_caret_p" with
"m_range_display_kind", converting from bool to the new enum.
(class rich_location): Add example of line insertion fix-it hint.
(rich_location::add_range): Convert param "show_caret_p" from bool
to enum range_display_kind and rename to "range_display_kind",
giving it a default of SHOW_RANGE_WITHOUT_CARET.
(rich_location::set_range): Likewise, albeit without a default.
* line-map.c (rich_location::rich_location): Update for conversion
of show_caret_p to tri-state enum.
(rich_location::add_range): Likewise.
(rich_location::set_range): Likewise.

From-SVN: r263885

5 years agodiagnostics: show an extra line of context in line-insertion fix-it hints (PR 87091)
David Malcolm [Mon, 27 Aug 2018 13:46:32 +0000 (13:46 +0000)]
diagnostics: show an extra line of context in line-insertion fix-it hints (PR 87091)

This patch tweaks how we print line-insertion fix-it hints, so that
the line before the insertion point is also printed, to give the user
more context on the proposed change.

For example, it changes:

  ../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>>;
      |                      ^~~

to:

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

gcc/ChangeLog:
PR 87091
* diagnostic-show-locus.c (get_line_span_for_fixit_hint): Show the
line above for line-insertion fix-it hints.
(selftest::test_fixit_insert_containing_newline): Update the
expected results, and add a test with line-numbering enabled.

gcc/testsuite/ChangeLog:
PR 87091
* g++.dg/pr85523.C: Extend expected output to show line
before line-insertion fix-it hint.
* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
(test_fixit_insert_newline): Add previous line to expected output.
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise.
* gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise.

From-SVN: r263884

5 years agoSanopt: ignore params with DECL_HAS_VALUE_EXPR_P (PR sanitizer/86962).
Martin Liska [Mon, 27 Aug 2018 13:21:28 +0000 (15:21 +0200)]
Sanopt: ignore params with DECL_HAS_VALUE_EXPR_P (PR sanitizer/86962).

2018-08-27  Martin Liska  <mliska@suse.cz>

        PR sanitizer/86962
* sanopt.c (sanitize_rewrite_addressable_params): Ignore
        params with DECL_HAS_VALUE_EXPR_P.
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR sanitizer/86962
* gcc.dg/asan/pr86962.c: New test.

From-SVN: r263882

5 years agoAdd test for memcpy expansion with hint.
Martin Liska [Mon, 27 Aug 2018 13:18:43 +0000 (15:18 +0200)]
Add test for memcpy expansion with hint.

2018-08-27  Martin Liska  <mliska@suse.cz>

* config/i386/i386.c (ix86_expand_set_or_movmem): Dump
        selected expansion strategy.
2018-08-27  Martin Liska  <mliska@suse.cz>

* gcc.dg/tree-prof/val-prof-10.c: New test.

From-SVN: r263881

5 years agoCome up with fndecl_built_in_p.
Martin Liska [Mon, 27 Aug 2018 12:34:52 +0000 (14:34 +0200)]
Come up with fndecl_built_in_p.

2018-08-27  Martin Liska  <mliska@suse.cz>

* builtins.h (is_builtin_fn): Remove and fndecl_built_in_p.
* builtins.c (is_builtin_fn): Likewise.
* attribs.c (diag_attr_exclusions): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
(builtin_mathfn_code): Likewise.
(fold_builtin_expect): Likewise.
(fold_call_expr): Likewise.
(fold_builtin_call_array): Likewise.
(fold_call_stmt): Likewise.
(set_builtin_user_assembler_name): Likewise.
(is_simple_builtin): Likewise.
* calls.c (gimple_alloca_call_p): Likewise.
(maybe_warn_nonstring_arg): Likewise.
* cfgexpand.c (expand_call_stmt): Likewise.
* cgraph.c (cgraph_update_edges_for_call_stmt_node): Likewise.
(cgraph_edge::verify_corresponds_to_fndecl): Likewise.
(cgraph_node::verify_node): Likewise.
* cgraphclones.c (build_function_decl_skip_args): Likewise.
(cgraph_node::create_clone): Likewise.
* config/arm/arm.c (arm_insert_attributes): Likewise.
* config/i386/i386.c (ix86_gimple_fold_builtin): Likewise.
* dse.c (scan_insn): Likewise.
* expr.c (expand_expr_real_1): Likewise.
* fold-const.c (operand_equal_p): Likewise.
(fold_binary_loc): Likewise.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise.
* gimple-low.c (lower_stmt): Likewise.
* gimple-pretty-print.c (dump_gimple_call): Likewise.
* gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Likewise.
* gimple.c (gimple_build_call_from_tree): Likewise.
(gimple_call_builtin_p): Likewise.
(gimple_call_combined_fn): Likewise.
* gimplify.c (gimplify_call_expr): Likewise.
(gimple_boolify): Likewise.
(gimplify_modify_expr): Likewise.
(gimplify_addr_expr): Likewise.
* hsa-gen.c (gen_hsa_insns_for_call): Likewise.
* ipa-cp.c (determine_versionability): Likewise.
* ipa-fnsummary.c (compute_fn_summary): Likewise.
* ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise.
* ipa-split.c (visit_bb): Likewise.
(split_function): Likewise.
* ipa-visibility.c (cgraph_externally_visible_p): Likewise.
* lto-cgraph.c (input_node): Likewise.
* lto-streamer-out.c (write_symbol): Likewise.
* omp-low.c (setjmp_or_longjmp_p): Likewise.
(lower_omp_1): Likewise.
* predict.c (strip_predict_hints): Likewise.
* print-tree.c (print_node): Likewise.
* symtab.c (symtab_node::output_to_lto_symbol_table_p): Likewise.
* trans-mem.c (is_tm_irrevocable): Likewise.
(is_tm_load): Likewise.
(is_tm_simple_load): Likewise.
(is_tm_store): Likewise.
(is_tm_simple_store): Likewise.
(is_tm_abort): Likewise.
(tm_region_init_1): Likewise.
* tree-call-cdce.c (gen_shrink_wrap_conditions): Likewise.
* tree-cfg.c (verify_gimple_call): Likewise.
(move_stmt_r): Likewise.
(stmt_can_terminate_bb_p): Likewise.
* tree-eh.c (lower_eh_constructs_2): Likewise.
* tree-if-conv.c (if_convertible_stmt_p): Likewise.
* tree-inline.c (remap_gimple_stmt): Likewise.
(copy_bb): Likewise.
(estimate_num_insns): Likewise.
(fold_marked_statements): Likewise.
* tree-sra.c (scan_function): Likewise.
* tree-ssa-ccp.c (surely_varying_stmt_p): Likewise.
(optimize_stack_restore): Likewise.
(pass_fold_builtins::execute): Likewise.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise.
(mark_all_reaching_defs_necessary_1): Likewise.
* tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise.
* tree-ssa-forwprop.c (simplify_builtin_call): Likewise.
(pass_forwprop::execute): Likewise.
* tree-ssa-loop-im.c (stmt_cost): Likewise.
* tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise.
* tree-ssa-strlen.c (get_string_length): Likewise.
* tree-ssa-structalias.c (handle_lhs_call): Likewise.
(find_func_aliases_for_call): Likewise.
* tree-ssa-ter.c (find_replaceable_in_bb): Likewise.
* tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise.
* tree-tailcall.c (find_tail_calls): Likewise.
* tree.c (need_assembler_name_p): Likewise.
(free_lang_data_in_decl): Likewise.
(get_call_combined_fn): Likewise.
* ubsan.c (is_ubsan_builtin_p): Likewise.
* varasm.c (incorporeal_function_p): Likewise.
* tree.h (DECL_BUILT_IN): Remove and replace with
        fndecl_built_in_p.
(DECL_BUILT_IN_P): Transfort to fndecl_built_in_p.
(fndecl_built_in_p): New.
2018-08-27  Martin Liska  <mliska@suse.cz>

* gcc-interface/decl.c (update_profile): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
* gcc-interface/gigi.h (call_is_atomic_load): Likewise.
* gcc-interface/utils.c (gnat_pushdecl): Likewise.
2018-08-27  Martin Liska  <mliska@suse.cz>

* c-common.c (check_function_restrict): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
(check_builtin_function_arguments): Likewise.
(reject_gcc_builtin): Likewise.
* c-warn.c (sizeof_pointer_memaccess_warning): Likewise.
2018-08-27  Martin Liska  <mliska@suse.cz>

* c-decl.c (locate_old_decl): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
(diagnose_mismatched_decls): Likewise.
(merge_decls): Likewise.
(warn_if_shadowing): Likewise.
(pushdecl): Likewise.
(implicitly_declare): Likewise.
* c-parser.c (c_parser_postfix_expression_after_primary): Likewise.
* c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise.
* c-typeck.c (build_function_call_vec): Likewise.
(convert_arguments): Likewise.
2018-08-27  Martin Liska  <mliska@suse.cz>

* call.c (build_call_a): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
(build_cxx_call): Likewise.
* constexpr.c (constexpr_fn_retval): Likewise.
(cxx_eval_builtin_function_call): Likewise.
(cxx_eval_call_expression): Likewise.
(potential_constant_expression_1): Likewise.
* cp-gimplify.c (cp_gimplify_expr): Likewise.
(cp_fold): Likewise.
* decl.c (decls_match): Likewise.
(validate_constexpr_redeclaration): Likewise.
(duplicate_decls): Likewise.
(make_rtl_for_nonlocal_decl): Likewise.
* name-lookup.c (consider_binding_level): Likewise.
(cp_emit_debug_info_for_using): Likewise.
* semantics.c (finish_call_expr): Likewise.
* tree.c (builtin_valid_in_constant_expr_p): Likewise.
2018-08-27  Martin Liska  <mliska@suse.cz>

* go-gcc.cc (Gcc_backend::call_expression): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
2018-08-27  Martin Liska  <mliska@suse.cz>

* lto-lang.c (handle_const_attribute): Use new function
        fndecl_built_in_p and remove check for FUNCTION_DECL if
        possible.
* lto-symtab.c (lto_symtab_merge_p): Likewise.
(lto_symtab_merge_decls_1): Likewise.
(lto_symtab_merge_symbols): Likewise.
* lto.c (lto_maybe_register_decl): Likewise.
(read_cgraph_and_symbols): Likewise.

From-SVN: r263880

5 years agoImprove switch code emission for a balanced tree (PR tree-optimization/86847).
Martin Liska [Mon, 27 Aug 2018 12:21:11 +0000 (14:21 +0200)]
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

5 years agoFix probability for bit-tests.
Martin Liska [Mon, 27 Aug 2018 12:18:24 +0000 (14:18 +0200)]
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

5 years agoFix probabilities for jump table (PR tree-optimization/86702).
Martin Liska [Mon, 27 Aug 2018 12:17:54 +0000 (14:17 +0200)]
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

5 years agoAdd new gswitch related functions into tree-cfg.c.
Martin Liska [Mon, 27 Aug 2018 12:17:19 +0000 (14:17 +0200)]
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

5 years agocfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
Richard Biener [Mon, 27 Aug 2018 10:55:53 +0000 (10:55 +0000)]
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

5 years agotree-ssa-pre.c (compute_antic): Re-use inverted postorder for partial antic compute.
Richard Biener [Mon, 27 Aug 2018 10:50:45 +0000 (10:50 +0000)]
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

5 years agore PR rtl-optimization/87065 (combine causes ICE in trunc_int_for_mode)
Jakub Jelinek [Mon, 27 Aug 2018 08:41:22 +0000 (10:41 +0200)]
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

5 years agoDo not read gcda files multiple times (PR gcov-profile/87069).
Martin Liska [Mon, 27 Aug 2018 08:01:54 +0000 (10:01 +0200)]
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