aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2019-12-03typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc location ↵Paolo Carlini16-33/+92
in a few additional diagnostics; tidy. /cp 2019-12-03 Paolo Carlini <paolo.carlini@oracle.com> * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc location in a few additional diagnostics; tidy. (check_return_expr): Likewise. * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper for the address of main pedwarn. /testsuite 2019-12-03 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/inconsistent-deduction-1.C: New. * g++.dg/diagnostic/returning-a-value-1.C: Likewise. * g++.dg/cpp0x/decltype3.C: Check location(s) too. * g++.dg/cpp0x/decltype4.C: Likewise. * g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C: Likewise. * g++.dg/cpp2a/consteval13.C: Likewise. * g++.dg/expr/pmf-1.C: Likewise. * g++.dg/other/ptrmem2.C: Likewise. * g++.dg/template/ptrmem17.C: Likewise. * g++.old-deja/g++.bugs/900213_03.C: Likewise. * g++.old-deja/g++.other/pmf7.C: Likewise. * g++.old-deja/g++.other/ptrmem7.C: Likewise. * g++.dg/diagnostic/main2.C: New. From-SVN: r278947
2019-12-03ipa-fnsummary.c: Include tree-into-ssa.h.Jan Hubicka2-0/+10
* ipa-fnsummary.c: Include tree-into-ssa.h. (compute_fn_summary): Call update_ssa. From-SVN: r278946
2019-12-03re PR c++/91369 (Implement P0784R7: constexpr new)Jakub Jelinek4-16/+103
PR c++/91369 * constexpr.c (struct constexpr_global_ctx): Add cleanups member, initialize it in the ctor. (cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT is already in the values hash_map, don't evaluate it again. Put TARGET_EXPR_SLOT into hash_map even if not lval, and push it into save_exprs too. If there is TARGET_EXPR_CLEANUP and not CLEANUP_EH_ONLY, push the cleanup to cleanups vector. <case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to local auto_vec, after evaluating the body evaluate cleanups and restore previous cleanups. <case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE. (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec, after evaluating the expression evaluate cleanups. * g++.dg/cpp2a/constexpr-new8.C: New test. From-SVN: r278945
2019-12-03Clear calls_comdat_local when comdat group is dissolvedJan Hubicka3-0/+13
while looking into Firefox inlining dumps I noticed that we often do not inline because we think function calls comdat local while the comdat group itself has been dissolved. * cgraph.c (cgraph_node::verify_node): Check that calls_comdat_local is set only for symbol in comdat group. * symtab.c (symtab_node::dissolve_same_comdat_group_1): Clear it. From-SVN: r278944
2019-12-03Do not update SSA in lto-stremaer-inJan Hubicka5-3/+13
* cgraph.c: Include tree-into-ssa.h (cgraph_node::get_body): Call update_ssa. * cgraphunit.c (cgraph_node::expand): Likewise. * lto-streamer-in.c (input_function): Do not call update_ssa. From-SVN: r278943
2019-12-03Don't install unnecessary ARRAY_REF element sizesRichard Sandiford4-17/+41
Even EXACT_DIV_EXPR doesn't distribute across addition for wrapping types, so in general we can't fold EXACT_DIV_EXPRs of POLY_INT_CSTs at compile time. This was causing an ICE when trying to gimplify the element size field in an ARRAY_REF. If the result of that EXACT_DIV_EXPR is an invariant, we don't bother recording it in the ARRAY_REF and simply read the element size from the element type. This avoids the overhead of doing: /* ??? tree_ssa_useless_type_conversion will eliminate casts to sizetype from another type of the same width and signedness. */ if (TREE_TYPE (aligned_size) != sizetype) aligned_size = fold_convert_loc (loc, sizetype, aligned_size); return size_binop_loc (loc, MULT_EXPR, aligned_size, size_int (TYPE_ALIGN_UNIT (elmt_type))); each time array_ref_element_size is called. So rather than read array_ref_element_size, do some arithmetic on it, and only then check whether the result is an invariant, we might as well check whether the element size is an invariant to start with. We're then directly testing whether array_ref_element_size gives a reusable value. For consistency, the patch makes the same change for the offset field in a COMPONENT_REF, although I don't think that can trigger yet. 2019-12-03 Richard Sandiford <richard.sandiford@arm.com> gcc/ * gimplify.c (gimplify_compound_lval): Don't gimplify and install an array element size if array_element_size is already an invariant. Similarly don't gimplify and install a field offset if component_ref_field_offset is already an invariant. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/struct_1.c: New test. From-SVN: r278942
2019-12-03Mark constant-sized objects as addressable if they have poly-int accessesRichard Sandiford4-0/+50
If SVE code is written for a specific vector length, it might load from or store to fixed-sized objects. This needs to work even without -msve-vector-bits=N (which should never be needed for correctness). There's no way of handling a direct poly-int sized reference to a fixed-size register; it would have to go via memory. And in that case it's more efficient to mark the fixed-size object as addressable from the outset, like we do for array references with non-constant indices. 2019-12-03 Richard Sandiford <richard.sandiford@arm.com> gcc/ * cfgexpand.c (discover_nonconstant_array_refs_r): If an access with POLY_INT_CST size is made to a fixed-size object, force the object to live in memory. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/deref_1.c: New test. From-SVN: r278941
2019-12-03Add missing amdgcn vcondu patternsAndrew Stubbs2-10/+15
2019-12-03 Andrew Stubbs <ams@codesourcery.com> gcc/ * config/gcn/gcn-valu.md: Change "vcondu" patterns to use VEC_1REG_MODE for the data mode. From-SVN: r278940
2019-12-03PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.Marek Polacek41-33/+868
This patch implements C++20 P0960R3: Parenthesized initialization of aggregates (<wg21.link/p0960>; see R0 for more background info). Essentially, if you have an aggregate, you can now initialize it by (x, y), similarly to {x, y}. E.g. struct A { int x, y; // no A(int, int) ctor (see paren-init14.C for = delete; case) }; A a(1, 2); The difference between ()-init and {}-init is that narrowing conversions are permitted, designators are not permitted, a temporary object bound to a reference does not have its lifetime extended, and there is no brace elision. Further, things like int a[](1, 2, 3); // will deduce the array size const A& r(1, 2.3, 3); // narrowing is OK int (&&rr)[](1, 2, 3); int b[3](1, 2); // b[2] will be value-initialized now work as expected. Note that char f[]("fluff"); has always worked and this patch keeps it that way. Also note that A a((1, 2)) is not the same as A a{{1,2}}; the inner (1, 2) remains a COMPOUND_EXPR. The approach I took was to handle (1, 2) similarly to {1, 2} -- conjure up a CONSTRUCTOR, and introduce LOOKUP_AGGREGATE_PAREN_INIT to distinguish between the two. This kind of initialization is only supported in C++20; I've made no attempt to support it in earlier standards, like we don't support CTAD pre-C++17, for instance. * c-cppbuiltin.c (c_cpp_builtins): Predefine __cpp_aggregate_paren_init=201902 for -std=c++2a. * call.c (build_new_method_call_1): Handle parenthesized initialization of aggregates by building up a CONSTRUCTOR. (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT): Define. * decl.c (grok_reference_init): Handle aggregate initialization from a parenthesized list of values. (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT. (check_initializer): Handle initialization of an array from a parenthesized list of values. Use NULL_TREE instead of NULL. * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P. * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow narrowing when LOOKUP_AGGREGATE_PAREN_INIT. (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing flags to digest_init_r. * g++.dg/cpp0x/constexpr-99.C: Only expect an error in C++17 and lesser. * g++.dg/cpp0x/explicit7.C: Likewise. * g++.dg/cpp0x/initlist12.C: Adjust dg-error. * g++.dg/cpp0x/pr31437.C: Likewise. * g++.dg/cpp2a/feat-cxx2a.C: Add __cpp_aggregate_paren_init test. * g++.dg/cpp2a/paren-init1.C: New test. * g++.dg/cpp2a/paren-init10.C: New test. * g++.dg/cpp2a/paren-init11.C: New test. * g++.dg/cpp2a/paren-init12.C: New test. * g++.dg/cpp2a/paren-init13.C: New test. * g++.dg/cpp2a/paren-init14.C: New test. * g++.dg/cpp2a/paren-init15.C: New test. * g++.dg/cpp2a/paren-init16.C: New test. * g++.dg/cpp2a/paren-init17.C: New test. * g++.dg/cpp2a/paren-init18.C: New test. * g++.dg/cpp2a/paren-init19.C: New test. * g++.dg/cpp2a/paren-init2.C: New test. * g++.dg/cpp2a/paren-init3.C: New test. * g++.dg/cpp2a/paren-init4.C: New test. * g++.dg/cpp2a/paren-init5.C: New test. * g++.dg/cpp2a/paren-init6.C: New test. * g++.dg/cpp2a/paren-init7.C: New test. * g++.dg/cpp2a/paren-init8.C: New test. * g++.dg/cpp2a/paren-init9.C: New test. * g++.dg/ext/desig10.C: Adjust dg-error. * g++.dg/template/crash107.C: Likewise. * g++.dg/template/crash95.C: Likewise. * g++.old-deja/g++.jason/crash3.C: Likewise. * g++.old-deja/g++.law/ctors11.C: Likewise. * g++.old-deja/g++.law/ctors9.C: Likewise. * g++.old-deja/g++.mike/net22.C: Likewise. * g++.old-deja/g++.niklas/t128.C: Likewise. From-SVN: r278939
2019-12-03re PR target/92758 (r278833 breaks ↵Richard Biener2-2/+7
gcc.target/powerpc/fold-vec-splat-floatdouble.c) 2019-12-03 Richard Biener <rguenther@suse.de> PR tree-optimization/92758 * tree-ssa-forwprop.c (simplify_vector_constructor): Restore operation on uniform vectors. From-SVN: r278938
2019-12-03re PR tree-optimization/92645 (Hand written vector code is 450 times slower ↵Richard Biener4-22/+51
when compiled with GCC compared to Clang) 2019-12-03 Richard Biener <rguenther@suse.de> PR tree-optimization/92645 * gimple-fold.c (gimple_fold_builtin_memory_op): Fold memcpy from or to a properly aligned register variable. * gcc.target/i386/pr92645-5.c: New testcase. From-SVN: r278934
2019-12-03Makefile.in (SOURCES): Add doc/lto-dump.1.Matthias Klose2-6/+20
2019-12-03 Matthias Klose <doko@ubuntu.com> * Makefile.in (SOURCES): Add doc/lto-dump.1. (install-man): Add $(LTO_DUMP_INSTALL_NAME)$(man1ext). ($(LTO_DUMP_INSTALL_NAME)$(man1ext): New. From-SVN: r278933
2019-12-03re PR tree-optimization/92751 (VN partial def support confused about clobbers)Richard Biener4-5/+54
2019-12-03 Richard Biener <rguenther@suse.de> PR tree-optimization/92751 * tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Fail when a clobber ends up in the partial-def vector. (vn_reference_lookup_3): Let clobbers be handled by the assignment from CTOR handling. * g++.dg/tree-ssa/pr92751.C: New testcase. From-SVN: r278931
2019-12-03utils.c (potential_alignment_gap): Delete.Eric Botcazou2-62/+37
* gcc-interface/utils.c (potential_alignment_gap): Delete. (rest_of_record_type_compilation): Do not call above function. Use the alignment of the field instead of that of its type, if need be. When the original field has variable size, always lower the alignment of the pointer type. Reset the bit-field status of the new field if it does not encode a bit-field. From-SVN: r278930
2019-12-03utils.c (fold_convert_size): New function.Eric Botcazou2-7/+20
* gcc-interface/utils.c (fold_convert_size): New function. (fold_bit_position): Invoke it to do further folding. From-SVN: r278929
2019-12-03XFAIL loop_versioning_6.f90 for ! lp64Richard Sandiford2-4/+6
2019-12-03 Richard Sandiford <richard.sandiford@arm.com> gcc/testsuite/ * gfortran.dg/loop_versioning_6.f90: XFAIL the scans for ! lp64. From-SVN: r278928
2019-12-03decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...Eric Botcazou2-8/+58
* gcc-interface/decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism, do not promote the mode of the return type to an integral mode if it contains a field on a non-integral type and even demote it for 64-bit targets. From-SVN: r278927
2019-12-03re PR tree-optimization/92734 (Missing match.pd simplification done by ↵Jakub Jelinek4-10/+73
fold_binary_loc on generic) PR tree-optimization/92734 * match.pd ((CST1 - A) +- CST2 -> CST3 - A, CST1 - (CST2 - A) -> CST3 + A): Handle nop casts around inner subtraction. * gcc.dg/tree-ssa/pr92734.c: New test. From-SVN: r278925
2019-12-03re PR target/92744 (error: insn does not satisfy its constraints since r278439)Uros Bizjak4-3/+33
PR target/92744 * config/i386/i386.md (peephole2 for *swap<mode>): Use general_reg_operand predicates instead of register_operand. * g++.dg/dfp/pr92744.C: New test. From-SVN: r278924
2019-12-03re PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)Jakub Jelinek5-4/+25
PR c++/92732 * typeck2.c (digest_nsdmi_init): For bitfields, use DECL_BIT_FIELD_TYPE instead of TREE_TYPE. * g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion warnings. * g++.dg/cpp2a/bitfield4.C: New test. From-SVN: r278923
2019-12-03re PR c++/92705 (ICE: Segmentation fault (in build_new_op_1))Jason Merrill4-25/+48
PR c++/92705 * call.c (strip_standard_conversion): New function. (build_new_op_1): Use it for user_conv_p. (compare_ics): Likewise. (source_type): Likewise. * g++.dg/conversion/ambig4.C: New test. From-SVN: r278922
2019-12-03re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)Jakub Jelinek4-0/+59
PR c++/92695 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls, adjust the first argument to point to the derived object rather than its base. * g++.dg/cpp2a/constexpr-virtual14.C: New test. From-SVN: r278921
2019-12-03re PR tree-optimization/92645 (Hand written vector code is 450 times slower ↵Richard Biener2-0/+11
when compiled with GCC compared to Clang) 2019-12-03 Richard Biener <rguenther@suse.de> PR tree-optimization/92645 * tree-ssa.c (execute_update_addresses_taken): Avoid representing a full def of a vector via a BIT_INSERT_EXPR. From-SVN: r278920
2019-12-03Fix missing space of r278890Luo Xiong Hu2-2/+6
gcc/testsuite/ChangeLog: 2019-12-03 Luo Xiong Hu <luoxhu@linux.ibm.com> * gcc.target/powerpc/pr72804.c: Fix missing space. From-SVN: r278918
2019-12-03Diagnose use of [*] in old-style parameter definitions (PR c/88704).Joseph Myers4-0/+23
GCC wrongly accepts [*] in old-style parameter definitions because because parm_flag is set on the scope used for those definitions and, unlike the case of a prototype in a function definition, there is no subsequent check to disallow this invalid usage. This patch adds such a check. (At this point we don't have location information for the [*], so the diagnostic location isn't ideal.) Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/88704 gcc/c: * c-decl.c (store_parm_decls_oldstyle): Diagnose use of [*] in old-style parameter definitions. gcc/testsuite: * gcc.dg/vla-25.c: New test. From-SVN: r278917
2019-12-03inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of ↵Jakub Jelinek2-5/+12
-fdump-ipa-inline. * g++.dg/lto/inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of -fdump-ipa-inline. Use "inline" instead of "inlined" as last argument to scan-wpa-ipa-dump-times, use \\\( and \\\) instead of ( and ) in the regex. From-SVN: r278916
2019-12-03Daily bump.GCC Administrator1-1/+1
From-SVN: r278915
2019-12-02re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)Jakub Jelinek4-0/+19
PR c++/92695 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use STRIP_NOPS before checking for ADDR_EXPR. * g++.dg/cpp2a/constexpr-virtual15.C: New test. From-SVN: r278912
2019-12-02Make rs6000_invalid_builtin static.Bill Schmidt3-2/+8
2019-12-02 Bill Schmidt <wschmidt@linux.ibm.com> * config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Make static. * config/rs6000/rs6000-internal.h (rs6000_invalid_builtin): Remove decl. From-SVN: r278911
2019-12-02Tighten check for vector types in fold_convertible_p (PR 92741)Richard Sandiford4-1/+36
In this PR, IPA-CP was misled into using NOP_EXPR rather than VIEW_CONVERT_EXPR to reinterpret a vector of 4 shorts as a vector of 2 ints. This tripped the tree-cfg.c assert I'd added in r278245. 2019-12-02 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR middle-end/92741 * fold-const.c (fold_convertible_p): Check vector types more thoroughly. gcc/testsuite/ PR middle-end/92741 * gcc.dg/pr92741.c: New test. From-SVN: r278910
2019-12-02[AArch64] Catch attempts to use SVE types when SVE is disabledRichard Sandiford8-4/+64
This patch reports an error if code tries to use variable-length SVE types when SVE is disabled. We already report a similar error for definitions or uses of SVE functions when SVE is disabled. 2019-12-02 Richard Sandiford <richard.sandiford@arm.com> gcc/ * config/aarch64/aarch64.c (aarch64_report_sve_required): New function. (aarch64_expand_mov_immediate): Use it when attempting to measure the length of an SVE vector. (aarch64_mov_operand_p): Only allow SVE CNT immediates when SVE is enabled. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/nosve_4.c: New test. * gcc.target/aarch64/sve/acle/general/nosve_5.c: Likewise. * gcc.target/aarch64/sve/pcs/nosve_4.c: Expected a second error for the copy. * gcc.target/aarch64/sve/pcs/nosve_5.c: Likewise. * gcc.target/aarch64/sve/pcs/nosve_6.c: Likewise. From-SVN: r278909
2019-12-02[AArch64] Run general SVE ACLE tests for CRichard Sandiford2-3/+8
Now that the C frontend can cope with POLY_INT_CST-length initialisers, we can make aarch64-sve-acle.exp run the full set of tests. This will introduce new failures for -mabi=ilp32; I'll make the testsuite ILP32 clean separately. 2019-12-02 Richard Sandiford <richard.sandiford@arm.com> gcc/testsuite/ * gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Run the general/* tests too. From-SVN: r278908
2019-12-02[AArch64] Add a couple of SVE ACLE comparison foldsRichard Sandiford17-11/+122
When writing vector-length specific SVE code, it's useful to be able to store an svbool_t predicate in a GNU vector of unsigned chars. This patch makes sure that there is no overhead when converting to that form and then immediately reading it back again. 2019-12-02 Richard Sandiford <richard.sandiford@arm.com> gcc/ * config/aarch64/aarch64-sve-builtins.h (gimple_folder::force_vector): Declare. * config/aarch64/aarch64-sve-builtins.cc (gimple_folder::force_vector): New function. * config/aarch64/aarch64-sve-builtins-base.cc (svcmp_impl::fold): Likewise. (svdup_impl::fold): Handle svdup_z too. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general/eqne_dup_1.c: New test. * gcc.target/aarch64/sve/acle/asm/dup_f16.c (dup_0_f16_z): Expect the call to be folded to zero. * gcc.target/aarch64/sve/acle/asm/dup_f32.c (dup_0_f32_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_f64.c (dup_0_f64_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_s8.c (dup_0_s8_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_s16.c (dup_0_s16_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_s32.c (dup_0_s32_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_s64.c (dup_0_s64_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_u8.c (dup_0_u8_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_u16.c (dup_0_u16_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_u32.c (dup_0_u32_z): Likewise. * gcc.target/aarch64/sve/acle/asm/dup_u64.c (dup_0_u64_z): Likewise. From-SVN: r278907
2019-12-02[Committed][Arm][testsuite] Fix failure for arm-fp16-ops-*.CSudakshina Das2-10/+14
Since r275022 which deprecates some uses of volatile, all arm-fp16-ops-*.C were failing with warnings of deprecated valatile uses on arm-none-eabi and arm-none-linux-gnueabihf. This patch removes the volatile declarations from the header. Since none of the tests are run with any high optimization levels, this should change should not prevent the real function of the tests. gcc/testsuite/ChangeLog: 2019-12-02 Sudakshina Das <sudi.das@arm.com> * g++.dg/ext/arm-fp16/arm-fp16-ops.h: Remove volatile keyword. From-SVN: r278905
2019-12-02Refactor IPA devirt a bit.Martin Liska6-14/+80
2019-12-02 Martin Liska <mliska@suse.cz> * ipa-devirt.c (warn_types_mismatch): Use get_odr_name_for_type function. (debug_tree_odr_name): New. * ipa-utils.h (get_odr_name_for_type): New. 2019-12-02 Martin Liska <mliska@suse.cz> * g++.dg/lto/odr-7_0.C: New test. * g++.dg/lto/odr-7_1.C: New test. From-SVN: r278898
2019-12-02Fix dg failureJan Hubicka2-4/+8
* g++.dg/lto/inline-crossmodule-1_0.C: fix template. From-SVN: r278897
2019-12-02re PR tree-optimization/92742 (ICE in info_for_reduction, at ↵Richard Biener4-1/+34
tree-vect-loop.c:4367) 2019-12-02 Richard Biener <rguenther@suse.de> PR tree-optimization/92742 * tree-vect-loop.c (vect_fixup_reduc_chain): Do not touch the def-type but verify it is consistent with the original stmts. * gcc.dg/torture/pr92742.c: New testcase. From-SVN: r278896
2019-12-02re PR tree-optimization/92712 (Performance regression with assumed values)Jakub Jelinek9-10/+179
PR tree-optimization/92712 * match.pd ((A * B) +- A -> (B +- 1) * A, A +- (A * B) -> (1 +- B) * A): Allow optimizing signed integers even when we don't know anything about range of A, but do know something about range of B and the simplification won't introduce new UB. * gcc.dg/tree-ssa/pr92712-1.c: New test. * gcc.dg/tree-ssa/pr92712-2.c: New test. * gcc.dg/tree-ssa/pr92712-3.c: New test. * gfortran.dg/loop_versioning_1.f90: Adjust expected number of likely to be innermost dimension messages. * gfortran.dg/loop_versioning_10.f90: Likewise. * gfortran.dg/loop_versioning_6.f90: Likewise. From-SVN: r278894
2019-12-02Enable recursive function versioningFeng Xue7-27/+283
2019-12-02 Feng Xue <fxue@os.amperecomputing.com> PR ipa/92133 * doc/invoke.texi (ipa-cp-max-recursive-depth): Document new option. (ipa-cp-min-recursive-probability): Likewise. * params.opt (ipa-cp-max-recursive-depth): New. (ipa-cp-min-recursive-probability): Likewise. * ipa-cp.c (ipcp_lattice<valtype>::add_value): Add two new parameters val_p and unlimited. (self_recursively_generated_p): New function. (get_val_across_arith_op): Likewise. (propagate_vals_across_arith_jfunc): Add constant propagation for self-recursive function. (incorporate_penalties): Do not penalize pure self-recursive function. (good_cloning_opportunity_p): Dump node_is_self_scc flag. (propagate_constants_topo): Set node_is_self_scc flag for cgraph node. (get_info_about_necessary_edges): Relax hotness check for edge to self-recursive function. * ipa-prop.h (ipa_node_params): Add new field node_is_self_scc. 2019-12-02 Feng Xue <fxue@os.amperecomputing.com> PR ipa/92133 * gcc.dg/ipa/ipa-clone-2.c: New test. From-SVN: r278893
2019-12-01Fix bugs relating to flexibly-sized objects in nios2 backend.Sandra Loosemore11-36/+199
2019-12-01 Sandra Loosemore <sandra@codesourcery.com> Fix bugs relating to flexibly-sized objects in nios2 backend. PR target/92499 gcc/c/ * c-decl.c (flexible_array_type_p): Move to common code. gcc/ * config/nios2/nios2.c (nios2_in_small_data_p): Do not consider objects of flexible types to be small if they have internal linkage or are declared extern. * config/nios2/nios2.h (ASM_OUTPUT_ALIGNED_LOCAL): Replace with... (ASM_OUTPUT_ALIGNED_DECL_LOCAL): ...this. Use targetm.in_small_data_p instead of the size of the object initializer. * tree.c (flexible_array_type_p): Move from C front end, and generalize to handle fields in non-C structures. * tree.h (flexible_array_type_p): Declare. gcc/testsuite/ * gcc.target/nios2/pr92499-1.c: New. * gcc.target/nios2/pr92499-2.c: New. * gcc.target/nios2/pr92499-3.c: New. From-SVN: r278891
2019-12-02PR92398: Fix testcase failure of pr72804.cLuo Xiong Hu6-15/+73
P9LE generated instruction is not worse than P8LE. mtvsrdd;xxlnot;stxv vs. not;not;std;std. It can have longer latency, but latency via memory is not so critical, and this does save decode and other resources. It's hard to choose which is best. Update the test case to fix failures. gcc/testsuite/ChangeLog: 2019-12-02 Luo Xiong Hu <luoxhu@linux.ibm.com> PR testsuite/92398 * gcc.target/powerpc/pr72804.c: Split the store function to... * gcc.target/powerpc/pr92398.h: ... this one. New. * gcc.target/powerpc/pr92398.p9+.c: New. * gcc.target/powerpc/pr92398.p9-.c: New. * lib/target-supports.exp (check_effective_target_p8): New. (check_effective_target_p9+): New. From-SVN: r278890
2019-12-02Daily bump.GCC Administrator1-1/+1
From-SVN: r278889
2019-12-01profile-count.h (profile_count::operator<): Use IPA value for comparsion.Jan Hubicka3-5/+14
* profile-count.h (profile_count::operator<): Use IPA value for comparsion. (profile_count::operator>): Likewise. (profile_count::operator<=): Likewise. (profile_count::operator>=): Likewise. * predict.c (maybe_hot_count_p): Do not convert to gcov_type. From-SVN: r278885
2019-12-01Daily bump.GCC Administrator1-1/+1
From-SVN: r278883
2019-11-30ipa-inline.c (compute_max_insns): Return int64_t.Jan Hubicka2-3/+7
* ipa-inline.c (compute_max_insns): Return int64_t. (inline_small_functions): Simplify. From-SVN: r278880
2019-11-30Update max_bb_count in execute_fixup_cfgJan Hubicka2-1/+10
* tree-cfg.c (execute_fixup_cfg): Update also max_bb_count when scaling happen. From-SVN: r278879
2019-11-30cgraph.h (symtab_node): Add symver flag.Jan Hubicka12-4/+256
2019-11-30 Jan Hubicka <hubicka@ucw.cz> * cgraph.h (symtab_node): Add symver flag. * cgraphunit.c (process_symver_attribute): New. (process_common_attributes): Use process_symver_attribute. * lto-cgraph.c (lto_output_node): Stream symver. (lto_output_varpool_node): Stream symver. (input_overwrite_node): Stream symver. (input_varpool_node): Stream symver. * output.h (do_assemble_symver): Decalre. * symtab.c (symtab_node::dump_base): Dump symver. (symtab_node::verify_base): Verify symver. (symtab_node::resolve_alias): Handle symver. * varasm.c (do_assemble_symver): New function. * varpool.c (varpool_node::assemble_aliases): Use it. * doc/extend.texi: (symver attribute): Document. * config/elfos.h (ASM_OUTPUT_SYMVER_DIRECTIVE): New. c-family/ChangeLog: 2019-11-30 Jan Hubicka <hubicka@ucw.cz> * c-attribs.c (handle_symver_attribute): New function (c_common_attributes): Add symver. From-SVN: r278878
2019-11-30[C] Add a target hook that allows targets to verify type usageRichard Sandiford17-3/+664
This patch adds a new target hook to check whether there are any target-specific reasons why a type cannot be used in a certain source-language context. It works in a similar way to existing hooks like TARGET_INVALID_CONVERSION and TARGET_INVALID_UNARY_OP. The reason for adding the hook is to report invalid uses of SVE types. Throughout a TU, the SVE vector and predicate types represent values that can be stored in an SVE vector or predicate register. At certain points in the TU we might be able to generate code that assumes the registers have a particular size, but often we can't. In some cases we might even make multiple different assumptions in the same TU (e.g. when implementing an ifunc for multiple vector lengths). But SVE types themselves are the same type throughout. The register size assumptions change how we generate code, but they don't change the definition of the types. This means that the types do not have a fixed size at the C level even when -msve-vector-bits=N is in effect. It also means that the size does not work in the same way as for C VLAs, where the abstract machine evaluates the size at a particular point and then carries that size forward to later code. The SVE ACLE deals with this by making it invalid to use C and C++ constructs that depend on the size or layout of SVE types. The spec refers to the types as "sizeless" types and defines their semantics as edits to the standards. See: https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00868.html for a fuller description and: https://gcc.gnu.org/ml/gcc/2019-11/msg00088.html for a recent update on the status. However, since all current sizeless types are target-specific built-in types, there's no real reason for the frontends to handle them directly. They can just hand off the checks to target code instead. It's then possible for the errors to refer to "SVE types" rather than "sizeless types", which is likely to be more meaningful to users. There is a slight overlap between the new tests and the ones for gnu_vector_type_p in r277950, but here the emphasis is on testing sizelessness. 2019-11-30 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.h (type_context_kind): New enum. (verify_type_context): Declare. * target.def (verify_type_context): New target hook. * doc/tm.texi.in (TARGET_VERIFY_TYPE_CONTEXT): Likewise. * doc/tm.texi: Regenerate. * tree.c (verify_type_context): New function. * config/aarch64/aarch64-protos.h (aarch64_sve::verify_type_context): Declare. * config/aarch64/aarch64-sve-builtins.cc (verify_type_context): New function. * config/aarch64/aarch64.c (aarch64_verify_type_context): Likewise. (TARGET_VERIFY_TYPE_CONTEXT): Define. gcc/c-family/ * c-common.c (pointer_int_sum): Use verify_type_context to check whether the target allows pointer arithmetic for the types involved. (c_sizeof_or_alignof_type, c_alignof_expr): Use verify_type_context to check whether the target allows sizeof and alignof operations for the types involved. gcc/c/ * c-decl.c (start_decl): Allow initialization of variables whose size is a POLY_INT_CST. (finish_decl): Use verify_type_context to check whether the target allows variables with a particular type to have static or thread-local storage duration. Don't raise a second error if such variables do not have a constant size. (grokdeclarator): Use verify_type_context to check whether the target allows fields or array elements to have a particular type. * c-typeck.c (pointer_diff): Use verify_type_context to test whether the target allows pointer difference for the types involved. (build_unary_op): Likewise for pointer increment and decrement. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: New test. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise. From-SVN: r278877
2019-11-30cgraph.c (cgraph_node::dump): Dump unit_id and merged_extern_inline.Jan Hubicka16-6/+136
* cgraph.c (cgraph_node::dump): Dump unit_id and merged_extern_inline. * cgraph.h (cgraph_node): Add unit_id and merged_extern_inline. (symbol_table): Add max_unit. (symbol_table::symbol_table): Initialize it. * cgraphclones.c (duplicate_thunk_for_node): Copy unit_id. merged_comdat, merged_extern_inline. (cgraph_node::create_clone): Likewise. (cgraph_node::create_version_clone): Likewise. * ipa-fnsummary.c (dump_ipa_call_summary): Dump info about cross module calls. * ipa-fnsummary.h (cross_module_call_p): New inline function. * ipa-inline-analyssi.c (simple_edge_hints): Use it. * ipa-inline.c (inline_small_functions): Likewise. * lto-symtab.c (lto_cgraph_replace_node): Record merged_extern_inline; copy merged_comdat and merged_extern_inline. * lto-cgraph.c (lto_output_node): Stream out merged_comdat, merged_extern_inline and unit_id. (input_overwrite_node): Stream in these. (input_cgraph_1): Set unit_base. * lto-streamer.h (lto_file_decl_data): Add unit_base. * symtab.c (symtab_node::make_decl_local): Record former_comdat. * g++.dg/lto/inline-crossmodule-1.h: New testcase. * g++.dg/lto/inline-crossmodule-1_0.C: New testcase. * g++.dg/lto/inline-crossmodule-1_1.C: New testcase. From-SVN: r278876
2019-11-30Do not look at _data component in gfc_dep_resolver.Thomas Koenig4-0/+37
2019-11-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91783 * dependency.c (gfc_dep_resolver): Do not look at _data component if present. 2019-11-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/91783 * gfortran.dg/dependency_56.f90: New test. From-SVN: r278873