aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-06-14tree-optimization/101031 - fix strlen opt invalidation logicRichard Biener2-8/+39
strlen opt uses ao_ref_init_from_ptr_and_size to prepare alias queries to invalidate its knowledge about strings. It constrains the size using the number of known-nonzero chars and adds one for a terminating nul - without knowing whether such nul exists or even fits the object. The latter is now a problem since the oracle disambiguates an access of size two (as built so) against a store to a plain char variable (where a terminating nul does not fit). The fix is to instead increment max_size but leave size to the number of chars we know are accessed. 2021-06-14 Richard Biener <rguenther@suse.de> PR tree-optimization/101031 * tree-ssa-strlen.c (maybe_invalidate): Increment max_size instead of size when accounting for a possibly string terminating nul. * gcc.dg/torture/pr101031.c: New testcase.
2021-06-14evrp: fix AddressSanitizer: alloc-dealloc-mismatchMartin Liska1-1/+1
The fixed error is: ==21166==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x60300000d900 #0 0x7367d7 in operator delete(void*, unsigned long) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/libsanitizer/asan/asan_new_delete.cpp:172 #1 0x3b82e6e in pointer_equiv_analyzer::~pointer_equiv_analyzer() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:161 #2 0x3b83387 in hybrid_folder::~hybrid_folder() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:517 #3 0x3b83387 in execute_early_vrp /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:686 #4 0x1790611 in execute_one_pass(opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2567 #5 0x1792003 in execute_pass_list_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2656 #6 0x1792029 in execute_pass_list_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2657 #7 0x179209f in execute_pass_list(function*, opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:2667 #8 0x178a5f3 in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:1773 #9 0x1792fac in do_per_function_toporder(void (*)(function*, void*), void*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/plugin.h:191 #10 0x1792fac in execute_ipa_pass_list(opt_pass*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/passes.c:3001 #11 0xc525fc in ipa_passes /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2154 #12 0xc525fc in symbol_table::compile() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2289 #13 0xc5a096 in symbol_table::compile() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2269 #14 0xc5a096 in symbol_table::finalize_compilation_unit() /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/cgraphunit.c:2537 #15 0x1a7a17c in compile_file /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:482 #16 0x69c758 in do_compile /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:2210 #17 0x69c758 in toplev::main(int, char**) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/toplev.c:2349 #18 0x6a932a in main /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/main.c:39 #19 0x7ffff7820b34 in __libc_start_main ../csu/libc-start.c:332 #20 0x6aa5fd in _start (/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/objdir/gcc/cc1+0x6aa5fd) 0x60300000d900 is located 0 bytes inside of 32-byte region [0x60300000d900,0x60300000d920) allocated by thread T0 here: #0 0x735ab7 in operator new[](unsigned long) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/libsanitizer/asan/asan_new_delete.cpp:102 #1 0x3b82dac in pointer_equiv_analyzer::pointer_equiv_analyzer(gimple_ranger*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-asan/build/gcc/gimple-ssa-evrp.c:156 gcc/ChangeLog: * gimple-ssa-evrp.c (pointer_equiv_analyzer::~pointer_equiv_analyzer): Use delete[].
2021-06-14Pick up global ranges in ranger after inlining.Aldy Hernandez1-7/+13
Ranger was not picking up global ranges because doing so could remove __builtin_unreachable calls too early to the detriment of LTO. However, we can safely remove these calls after inlining. This patch removes the restriction and allows ranger to pick up global ranges under these circumstances. Tested on x86-64 Linux. gcc/ChangeLog: * value-query.cc (gimple_range_global): Call get_range_global if called after inlining.
2021-06-14Daily bump.GCC Administrator5-1/+132
2021-06-13i386: Improve variable permutation insn avoidance [PR101021]Uros Bizjak1-4/+7
Emit constant permutation insn directly from expand_vec_perm_shufb. 2021-06-13 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/101021 * config/i386/i386-expand.c (expand_vec_perm_pshufb): Emit constant permutation insn directly from here.
2021-06-13c: adjust [[maybe_unused]] testcaseJason Merrill1-2/+2
Another testcase update needed for my r12-1405 commit. gcc/testsuite/ChangeLog: * gcc.dg/c2x-attr-maybe_unused-1.c: Expect no warnings.
2021-06-13use range based for loops to iterate over vec<>Trevor Saunders29-300/+108
This changes users of FOR_EACH_VEC_ELT to use range based for loops, where the index variables are otherwise unused. As such the index variables are all deleted, producing shorter and simpler code. Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org> gcc/analyzer/ChangeLog: * call-string.cc (call_string::call_string): Use range based for to iterate over vec<>. (call_string::to_json): Likewise. (call_string::hash): Likewise. (call_string::calc_recursion_depth): Likewise. * checker-path.cc (checker_path::fixup_locations): Likewise. * constraint-manager.cc (equiv_class::equiv_class): Likewise. (equiv_class::to_json): Likewise. (equiv_class::hash): Likewise. (constraint_manager::to_json): Likewise. * engine.cc (impl_region_model_context::on_svalue_leak): Likewise. (on_liveness_change): Likewise. (impl_region_model_context::on_unknown_change): Likewise. * program-state.cc (sm_state_map::set_state): Likewise. * region-model.cc (test_canonicalization_4): Likewise. gcc/ChangeLog: * attribs.c (find_attribute_namespace): Iterate over vec<> with range based for. * auto-profile.c (afdo_find_equiv_class): Likewise. * gcc.c (do_specs_vec): Likewise. (do_spec_1): Likewise. (driver::set_up_specs): Likewise. * gimple-loop-jam.c (any_access_function_variant_p): Likewise. * gimple-ssa-store-merging.c (compatible_load_p): Likewise. (imm_store_chain_info::try_coalesce_bswap): Likewise. (imm_store_chain_info::coalesce_immediate_stores): Likewise. (get_location_for_stmts): Likewise. * graphite-poly.c (print_iteration_domains): Likewise. (free_poly_bb): Likewise. (remove_gbbs_in_scop): Likewise. (free_scop): Likewise. (dump_gbb_cases): Likewise. (dump_gbb_conditions): Likewise. (print_pdrs): Likewise. (print_scop): Likewise. * ifcvt.c (cond_move_process_if_block): Likewise. * lower-subreg.c (decompose_multiword_subregs): Likewise. * regcprop.c (pass_cprop_hardreg::execute): Likewise. * sanopt.c (sanitize_rewrite_addressable_params): Likewise. * sel-sched-dump.c (dump_insn_vector): Likewise. * store-motion.c (store_ops_ok): Likewise. (store_killed_in_insn): Likewise. * timevar.c (timer::named_items::print): Likewise. * tree-cfgcleanup.c (cleanup_control_flow_pre): Likewise. (cleanup_tree_cfg_noloop): Likewise. * tree-data-ref.c (dump_data_references): Likewise. (print_dir_vectors): Likewise. (print_dist_vectors): Likewise. (dump_data_dependence_relations): Likewise. (dump_dist_dir_vectors): Likewise. (dump_ddrs): Likewise. (create_runtime_alias_checks): Likewise. (free_subscripts): Likewise. (save_dist_v): Likewise. (save_dir_v): Likewise. (invariant_access_functions): Likewise. (same_access_functions): Likewise. (access_functions_are_affine_or_constant_p): Likewise. (find_data_references_in_stmt): Likewise. (graphite_find_data_references_in_stmt): Likewise. (free_dependence_relations): Likewise. (free_data_refs): Likewise. * tree-inline.c (copy_debug_stmts): Likewise. * tree-into-ssa.c (dump_currdefs): Likewise. (rewrite_update_phi_arguments): Likewise. * tree-ssa-propagate.c (clean_up_loop_closed_phi): Likewise. * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr): Likewise. (vect_slp_analyze_node_dependences): Likewise. (vect_slp_analyze_instance_dependence): Likewise. (vect_record_base_alignments): Likewise. (vect_get_peeling_costs_all_drs): Likewise. (vect_peeling_supportable): Likewise. * tree-vectorizer.c (vec_info::~vec_info): Likewise. (vec_info::free_stmt_vec_infos): Likewise. gcc/cp/ChangeLog: * constexpr.c (cxx_eval_call_expression): Iterate over vec<> with range based for. (cxx_eval_store_expression): Likewise. (cxx_eval_loop_expr): Likewise. * decl.c (wrapup_namespace_globals): Likewise. (cp_finish_decl): Likewise. (cxx_simulate_enum_decl): Likewise. * parser.c (cp_parser_postfix_expression): Likewise.
2021-06-13[committed] More improvements to H8 logicals for test/compare eliminationJeff Law2-29/+43
gcc/ * config/h8300/logical.md (<code>qi3_1<cczn>): New pattern. (andqi3_1<cczn>): Removed. (<ors>qi3_1): Do not split for IOR/XOR a single bit. (H8/SX bit logicals): Split out from other patterns. * config/h8300/multiply.md (mulqihi3_const<cczn>): Renamed from mulqihi3_const_clobber_flags. (mulqihi3<cczn>, mulhisi3_const<cczn>, mulhisi3<cczn>): Similarly
2021-06-13x86: Replace ix86_red_zone_size with ix86_red_zone_usedH.J. Lu5-6/+81
Add red_zone_used to machine_function to track if red zone is used. When expanding function prologue, set red_zone_used to true if red zone is used. gcc/ PR target/101023 * config/i386/i386.c (ix86_expand_prologue): Set red_zone_used to true if red zone is used. (ix86_output_indirect_jmp): Replace ix86_red_zone_size with ix86_red_zone_used. * config/i386/i386.h (machine_function): Add red_zone_used. (ix86_red_zone_size): Removed. (ix86_red_zone_used): New. * config/i386/i386.md (peephole2 patterns): Replace ix86_red_zone_size with ix86_red_zone_used. gcc/testsuite/ PR target/101023 * g++.target/i386/pr101023a.C: New test. * g++.target/i386/pr101023b.C: Likewise.
2021-06-13Daily bump.GCC Administrator5-1/+35
2021-06-12testsuite: fix AIX testsuite failuresDavid Edelsohn3-1/+5
* g++.dg/ext/builtin-shufflevector-2.C: Ignore psabi warning. * gcc.dg/uninit-pr93100.c: Skip on AIX. * gcc.target/powerpc/pr100085.c: Require int128 and float128.
2021-06-12c-family: don't warn for [[maybe_unused]] on data memberJason Merrill4-4/+22
The C++17 standard (and C2x) says that [[maybe_unused]] may be applied to a non-static data member, so we shouldn't warn about it. And I don't see a reason not to handle a FIELD_DECL the same as any other decl, by setting TREE_USED on it. It doesn't look like anything yet cares about that flag on a FIELD_DECL, but setting it shouldn't hurt. gcc/c-family/ChangeLog: * c-attribs.c (handle_unused_attribute): Handle FIELD_DECL. gcc/testsuite/ChangeLog: * g++.dg/ext/attrib62.C: No longer warn. * g++.dg/diagnostic/maybe_unused1.C: New test. gcc/ChangeLog: * doc/extend.texi (unused variable attribute): Applies to structure fields as well.
2021-06-12c++: constexpr and array[0] [PR101029]Jason Merrill2-0/+180
build_vec_init_elt exits early if we're initializing a zero-element array, so build_vec_init needs to do the same to avoid trying to instantiate things after we've already started throwing important bits away. PR c++/101029 gcc/cp/ChangeLog: * init.c (build_vec_init): Shortcut [0] case. gcc/testsuite/ChangeLog: * g++.dg/ext/array4.C: New test.
2021-06-12c++: speed up looking up the current classJason Merrill1-0/+7
While looking at template instantiation tracing, I noticed that we were frequently looking up a particular class template instance while instantiating it. This patch shortcuts that lookup, and speeds up compiling stdc++.h with my (checking/unoptimized) compiler by about 3%. gcc/cp/ChangeLog: * pt.c (lookup_template_class_1): Shortcut current_class_type.
2021-06-12Daily bump.GCC Administrator7-1/+251
2021-06-11Fix a typo in an AutoFDO error stringEugene Rozenfeld1-1/+1
gcc/ChangeLog: * auto-profile.c (read_profile): fix a typo in an error string
2021-06-11Fix effective target for check-builtin-vec_rlnm-runnable.c testCarl Love1-1/+1
The effective target for a Power 9 runnable test should be p9vector_hw. 2021-06-11 Carl Love <cel@us.ibm.com> gcc/testsuite/ChangeLog * gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c (dg-require-effective-target): Change target to p9vector_hw.
2021-06-12For 'OMP_CLAUSE' in 'dump_generic_node', dump the whole OMP clause chainThomas Schwinge3-15/+21
... instead of just the first clause. gcc/ * tree-pretty-print.h (dump_omp_clauses): Add 'bool = true' default argument. * tree-pretty-print.c (dump_omp_clauses): Update. (dump_generic_node) <OMP_CLAUSE>: Use it. gcc/testsuite/ * gcc.dg/gomp/simd-clones-2.c: Enhance.
2021-06-11c++: Substitute into function parms in lexical order [PR96560]Patrick Palka2-55/+83
This makes tsubst_arg_types substitute into a function's parameter types in left-to-right instead of right-to-left order, in accordance with DR 1227. DR 1227 PR c++/96560 gcc/cp/ChangeLog: * pt.c (tsubst_arg_types): Rearrange so that we substitute into TYPE_ARG_TYPES in forward order while short circuiting appropriately. Adjust formatting. gcc/testsuite/ChangeLog: * g++.dg/template/sfinae-dr1227.C: New test.
2021-06-11d: foreach over a tuple doesn't work on 16-bit targets (PR100999)Iain Buclaw30-72/+379
Improves semantic passes in the front-end around the `foreach' and `static foreach' statements to be more resilient to compiling in a minimal D runtime environment. Checking of the index type has been improved as well so now there won't be needless compiler errors when using 8 or 16-bit integers as index types when the size fits the expected loop range. gcc/d/ChangeLog: PR d/100999 * dmd/MERGE: Merge upstream dmd 7a3808254. libphobos/ChangeLog: PR d/100999 * src/MERGE: Merge upstream phobos 55bb17543.
2021-06-11arm: Fix polymorphic variants failing with undefined reference to ↵Srinath Parvathaneni2-75/+212
`__ARM_undef` error. This patch fixes the issue mentioned in PR101016, which is mve polymorphic variants failing at linking with undefined reference to "__ARM_undef" error. gcc/ChangeLog: 2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/101016 * config/arm/arm_mve.h (__arm_vld1q): Change __ARM_mve_coerce(p0, int8_t const *) to __ARM_mve_coerce1(p0, int8_t *) in the argument for the polymorphic variants matching code. (__arm_vld1q_z): Likewise. (__arm_vld2q): Likewise. (__arm_vld4q): Likewise. (__arm_vldrbq_gather_offset): Likewise. (__arm_vldrbq_gather_offset_z): Likewise. gcc/testsuite/ChangeLog: 2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/101016 * gcc.target/arm/mve/intrinsics/pr101016.c: New test.
2021-06-11[PATCH] PR tree-optimization/96392 Optimize x+0.0 if x is an integerRoger Sayle1-1/+1
Doh! Wrong patch version. Sorry for the inconvenience. 2020-06-11 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR tree-optimization/96392 * fold-const.h (tree_expr_maybe_real_minus_zero_p): Fix prototype.
2021-06-11[PATCH] PR tree-optimization/96392 Optimize x+0.0 if x is an integerRoger Sayle5-29/+108
The patch implements a missed optimization enhancement. Under usual IEEE rules, x+0.0 can't be simplified to x when x might potentially be an IEEE minus zero (-0.0). The current logic in the middle-end checks whether the type of x should honor signed zeros, but with this patch we introduce tree_expr_maybe_real_minus_zero_p that allows us to confirm that the value can't possibly be -0.0, for example, the result of a conversion from an integer type, or the result of fabs (or has a type that doesn't honor signed zero). Whilst modifying match.pd, I also converted some additional folding transformations from "testing the type" to "testing the value". 2020-06-10 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR tree-optimization/96392 * fold-const.c (fold_real_zero_addition_p): Take both arguments of the addition or subtraction, not just the zero. Use this other argument in tests for signaling NaNs and signed zeros. (tree_expr_maybe_real_minus_zero_p): New predicate. * fold-const.h (fold_real_zero_addition_p): Update prototype. (tree_expr_maybe_real_minus_zero_p): New function prototype. * match.pd: Update calls to fold_real_zero_addition_p. Replace HONOR_NANS with tree_expr_maybe_nan_p. Replace HONOR_SIGNED_ZEROS with tree_expr_maybe_real_minus_zero_p. Replace HONOR_SNANS with tree_expr_maybe_signaling_nan_p. * tree-ssa-reassoc.c (eliminate_using_constants): Update call to fold_real_zero_addition_p. gcc/testsuite/ChangeLog PR tree-optimization/96392 * gcc.dg/pr96392.c: New test.
2021-06-11tree-optimization/101025 - fix store-motion dependence checkingRichard Biener2-2/+59
This plugs a hole in store-motion where it fails to perform dependence checking on conditionally executed but not store-motioned refs. 2021-06-11 Richard Biener <rguenther@suse.de> PR tree-optimization/101025 * tree-ssa-loop-im.c (sm_seq_valid_bb): Make sure to process all refs that require dependence checking. * gcc.dg/torture/pr101025.c: New testcase.
2021-06-11arm: Fix the mve multilib for the broken cmse support (pr99939).Srinath Parvathaneni2-1/+30
The current CMSE support in the multilib build for "-march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto" is broken as specified in PR99939 and this patch fixes the issue. gcc/testsuite/ChangeLog: 2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/99939 * gcc.target/arm/cmse/cmse-18.c: Add separate scan-assembler directives check for target is v8.1-m.main+mve or not before comparing the assembly output. * gcc.target/arm/cmse/cmse-20.c: New test. libgcc/ChangeLog: 2021-06-11 Srinath Parvathaneni <srinath.parvathaneni@arm.com> PR target/99939 * config/arm/cmse_nonsecure_call.S: Add __ARM_FEATURE_MVE macro. * config/arm/t-arm: To link cmse.o and cmse_nonsecure_call.o on passing -mcmse option.
2021-06-11c++: Add C++23 consteval if support - P1938R3 [PR100974]Jakub Jelinek19-10/+650
The following patch implements consteval if support. There is a new IF_STMT_CONSTEVAL_P flag on IF_STMT and IF_COND is boolean_false_node to match the non-manifestly constant evaluation behavior, while constexpr evaluation special-cases it. Perhaps cleaner would be to set the condition to __builtin_is_constant_evaluated () call but we need the IF_STMT_CONSTEVAL_P flag anyway and the IL would be larger. And I'm not changing the libstdc++ side, where perhaps we could change std::is_constant_evaluated definition for #ifdef __cpp_if_consteval case to if consteval { return true; } else { return false; } but we need to keep it defined to __builtin_is_constant_evaluated () for C++20 or older. 2021-06-11 Jakub Jelinek <jakub@redhat.com> PR c++/100974 gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Predefine __cpp_if_consteval for -std=c++2b for P1938R3 consteval if support. gcc/cp/ * cp-tree.h (struct saved_scope): Add consteval_if_p member. Formatting fix for the discarded_stmt comment. (in_consteval_if_p, IF_STMT_CONSTEVAL_P): Define. * parser.c (cp_parser_lambda_expression): Temporarily disable in_consteval_if_p when parsing lambda body. (cp_parser_selection_statement): Parse consteval if. * decl.c (struct named_label_entry): Add in_consteval_if member. (level_for_consteval_if): New function. (poplevel_named_label_1, check_previous_goto_1, check_goto): Handle consteval if. * constexpr.c (cxx_eval_builtin_function_call): Clarify in comment why CP_BUILT_IN_IS_CONSTANT_EVALUATED needs to *non_constant_p for !ctx->manifestly_const_eval. (cxx_eval_conditional_expression): For IF_STMT_CONSTEVAL_P evaluate condition as if it was __builtin_is_constant_evaluated call. (potential_constant_expression_1): For IF_STMT_CONSTEVAL_P always recurse on both branches. * cp-gimplify.c (genericize_if_stmt): Genericize IF_STMT_CONSTEVAL_P as the else branch. * pt.c (tsubst_expr) <case IF_STMT>: Copy IF_STMT_CONSTEVAL_P. Temporarily set in_consteval_if_p when recursing on IF_STMT_CONSTEVAL_P then branch. (tsubst_lambda_expr): Temporarily disable in_consteval_if_p when instantiating lambda body. * call.c (immediate_invocation_p): Return false when in_consteval_if_p. gcc/testsuite/ * g++.dg/cpp23/consteval-if1.C: New test. * g++.dg/cpp23/consteval-if2.C: New test. * g++.dg/cpp23/consteval-if3.C: New test. * g++.dg/cpp23/consteval-if4.C: New test. * g++.dg/cpp23/consteval-if5.C: New test. * g++.dg/cpp23/consteval-if6.C: New test. * g++.dg/cpp23/consteval-if7.C: New test. * g++.dg/cpp23/consteval-if8.C: New test. * g++.dg/cpp23/consteval-if9.C: New test. * g++.dg/cpp23/consteval-if10.C: New test. * g++.dg/cpp23/feat-cxx2b.C: Add __cpp_if_consteval tests.
2021-06-11analyzer: tweak priority of callstrings in worklist::key_t::cmpDavid Malcolm3-8/+37
While debugging another issue I noticed that the analyzer could fail to merge nodes for control flow in which one path had called a function and another path hadn't: BB / \ / \ fn call no fn call \ / \ / join BB The root cause was that the worklist sort function wasn't prioritizing call strings, and thus it was fully exploring the "no function called" path to the exit BB, and only then exploring the "within the function call" parts of the "funcion called" path. This patch prioritizes call strings when sorting the worklist so that the nodes with deeper call strings are processed before those with shallower call strings, thus allowing such nodes to be merged at the joinpoint. gcc/analyzer/ChangeLog: * engine.cc (worklist::key_t::cmp): Move sort by call_string to before SCC. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c: Update expected number of enodes after the loop. * gcc.dg/analyzer/paths-8.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-11tree-optimization/101028 - fix endless SLP reassoc discoveryRichard Biener2-3/+57
This fixes a missing clearing of mismatched lanes from the fatal fail path in SLP reassoc discovery in the most conservative way. 2021-06-11 Richard Biener <rguenther@suse.de> PR tree-optimization/101028 * tree-vect-slp.c (vect_build_slp_tree_2): When SLP reassoc discovery fails fatally, mark appropriate lanes in matches[] so. * gcc.dg/pr101028.c: New testcase.
2021-06-11tree-optimization/101026 - fix SLP re-associationRichard Biener2-1/+14
Since we cannot yet encode the operation in the SLP node itself but need a representative stmt require an existing one for now to avoid the need to build a fake GIMPLE stmt. 2021-06-11 Richard Biener <rguenther@suse.de> PR tree-optimization/101026 * tree-vect-slp.c (vect_build_slp_tree_2): Make sure we have a representative for the associated chain nodes. * gfortran.dg/pr101026.f: New testcase.
2021-06-11simplify-rtx: Fix up simplify_logical_relational_operation for vector IOR ↵Jakub Jelinek2-46/+67
[PR101008] simplify_relational_operation callees typically return just const0_rtx or const_true_rtx and then simplify_relational_operation attempts to fix that up if the comparison result has vector mode, or floating mode, or punt if it has scalar mode and vector mode operands (it doesn't know how exactly to deal with the scalar masks). But, simplify_logical_relational_operation has a special case, where it attempts to fold (x < y) | (x >= y) etc. and if it determines it is always true, it just returns const_true_rtx, without doing the dances that simplify_relational_operation does. That results in an ICE on the following testcase, where such folding happens during expansion (of debug stmts into DEBUG_INSNs) and we ICE because all of sudden a VOIDmode rtx appears where it expects a vector (V4SImode) rtx. The following patch fixes that by moving the adjustement into a separate helper routine and using it from both simplify_relational_operation and simplify_logical_relational_operation. 2021-06-11 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/101008 * simplify-rtx.c (relational_result): New function. (simplify_logical_relational_operation, simplify_relational_operation): Use it. * gcc.dg/pr101008.c: New test.
2021-06-11i386: Fix up *vec_concat<mode>_0_1 [PR101007]Jakub Jelinek2-1/+15
On Fri, Apr 23, 2021 at 12:53:58PM +0800, Hongtao Liu via Gcc-patches wrote: > -(define_insn "*vec_concatv4si_0" > - [(set (match_operand:V4SI 0 "register_operand" "=v,x") > - (vec_concat:V4SI > - (match_operand:V2SI 1 "nonimmediate_operand" "vm,?!*y") > - (match_operand:V2SI 2 "const0_operand" " C,C")))] > +(define_insn "*vec_concat<mode>_0" > + [(set (match_operand:VI124_128 0 "register_operand" "=v,x") > + (vec_concat:VI124_128 > + (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "vm,?!*y") > + (match_operand:<ssehalfvecmode> 2 "const0_operand" " C,C")))] > "TARGET_SSE2" > "@ > %vmovq\t{%1, %0|%0, %1} > @@ -22154,6 +22157,24 @@ (define_insn "avx_vec_concat<mode>" > (set_attr "prefix" "maybe_evex") > (set_attr "mode" "<sseinsnmode>")]) > > +(define_insn_and_split "*vec_concat<mode>_0" > + [(set (match_operand:V 0 "register_operand") > + (vec_select:V > + (vec_concat:<ssedoublevecmode> > + (match_operand:V 1 "nonimmediate_operand") > + (match_operand:V 2 "const0_operand")) > + (match_parallel 3 "movq_parallel" > + [(match_operand 4 "const_int_operand")])))] > + "ix86_pre_reload_split ()" > + "#" > + "&& 1" > + [(set (match_dup 0) > + (vec_concat:V (match_dup 1) (match_dup 5)))] > +{ > + operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]); > + operands[5] = CONST0_RTX (<ssehalfvecmode>mode); > +}) This regressed the following testcase with -msse -mno-sse2. The define_insn_and_split splits the permutation into *vec_concat<mode>_0 or *vec_concatv2di_0 insns which both have TARGET_SSE2 in their conditions (for the former you can see it above), but the define_insn_and_split matches always when the V mode's condition do, which for V16QI/V8HI/V4SI/V2DI/V4SF modes is always (well, when those modes are valid, which is TARGET_SSE). 2021-06-11 Jakub Jelinek <jakub@redhat.com> PR target/101007 * config/i386/sse.md (*vec_concat<mode>_0_1): Require TARGET_SSE2. * gcc.target/i386/sse-pr101007.c: New test.
2021-06-11i386: Try to avoid variable permutation instruction [PR101021]Uros Bizjak3-51/+114
Some permutations can be implemented without costly PSHUFB instruction, e.g.: { 8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7 } with PALIGNR, { 0,1,2,3, 4,5,6,7, 4,5,6,7, 12,13,14,15 } with PSHUFD, { 0,1, 2,3, 2,3, 6,7, 8,9,10,11,12,13,14,15 } with PSHUFLW and { 0,1,2,3,4,5,6,7, 8,9, 10,11, 10,11, 14,15 } with PSHUFHW. All these instructions have constant shuffle control mask and do not need to load shuffle mask from a memory to a temporary XMM register. 2021-06-11 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/101021 * config/i386/i386-expand.c (expand_vec_perm_pshufb): Return false if the permutation can be implemented with constant permutation instruction in wider mode. (canonicalize_vector_int_perm): Move above expand_vec_perm_pshufb. Handle V8QImode and V4HImode. gcc/testsuite/ PR target/101021 * gcc.target/i386/pr101021-1.c: New test. * gcc.target/i386/pr101021-2.c: Ditto.
2021-06-11Introduce -Wcoverage-invalid-line-numberMartin Liska5-17/+61
PR gcov-profile/100788 gcc/ChangeLog: * common.opt: Add new option. * coverage.c (coverage_begin_function): Emit warning instead on the internal compiler error. * doc/invoke.texi: Document the option. * toplev.c (process_options): Enable it by default. gcc/testsuite/ChangeLog: * gcc.dg/pr100788.c: New test.
2021-06-11Add missing ChangeLog entry.Martin Liska1-0/+7
2021-06-11middle-end/101009 - fix distance vector recordingRichard Biener2-2/+25
This fixes recording of distance vectors in case the DDR has just constant equal indexes. In that case we expect distance vectors with zero distances to be recorded which is what was done when any distance was computed for affine indexes. 2021-06-11 Richard Biener <rguenther@suse.de> PR middle-end/101009 * tree-data-ref.c (build_classic_dist_vector_1): Make sure to set *init_b to true when we encounter a constant equal index pair. (compute_affine_dependence): Also dump the actual DR_REF. * gcc.dg/torture/pr101009.c: New testcase.
2021-06-11Daily bump.GCC Administrator5-1/+218
2021-06-11rs6000: Support more short/char to float conversionKewen Lin2-0/+44
For some cases that when we load unsigned char/short values from the appropriate unsigned char/short memories and convert them to double/single precision floating point value, there would be implicit conversions to int first. It makes GCC not leverage the P9 instructions lxsibzx/lxsihzx. This patch is to add the related define_insn_and_split to support this kind of scenario. Bootstrapped/regtested on powerpc64le-linux-gnu P9 and powerpc64-linux-gnu P8. gcc/ChangeLog: * config/rs6000/rs6000.md (floatsi<SFDF:mode>2_lfiwax_<QHI:mode>_mem_zext): New define_insn_and_split. gcc/testsuite/ChangeLog: * gcc.target/powerpc/p9-fpcvt-3.c: New test.
2021-06-11Use stablesort for sorting association chainRichard Biener1-1/+1
This should preserve the original association order as much as possible for the initial SLP discovery attempt and also improve consistency. 2021-06-11 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_build_slp_tree_2): Use stablesort to sort operands of the associative chain.
2021-06-11Expose stable sort algorithm to gcc_sort_r and add vec::stablesortRichard Biener3-1/+38
This makes it possible to apply GCCs stable sort algorithm to vec<> and also use it with the qsort_r compatible interface. 2021-06-10 Richard Biener <rguenther@suse.de> * system.h (gcc_stablesort_r): Declare. * sort.cc (gcc_sort_r): Support stable sort. (gcc_stablesort_r): Define. * vec.h (vec<>::stablesort): Add.
2021-06-10c++: Extend std::is_constant_evaluated in if warning [PR100995]Marek Polacek5-16/+160
Jakub pointed me at <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1938r3.html#compiler-warnings> which shows that our existing warning could be extended to handle more cases. This patch implements that. A minor annoyance was handling macros, in libstdc++ we have reference operator[](size_type __pos) { __glibcxx_assert(__pos <= size()); ... } wherein __glibcxx_assert expands to if (__builtin_is_constant_evaluated() && !bool(__pos <= size()) ... but I'm of a mind to not warn on that. Once consteval if makes it in, we should tweak this warning one more time. PR c++/100995 gcc/cp/ChangeLog: * constexpr.c (maybe_constexpr_fn): New. * cp-tree.h (maybe_constexpr_fn): Declare. * semantics.c (find_std_constant_evaluated_r): New. (maybe_warn_for_constant_evaluated): New. (finish_if_stmt_cond): Call it. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/is-constant-evaluated9.C: Add dg-warning. * g++.dg/cpp2a/is-constant-evaluated12.C: New test.
2021-06-10c++: matching deduced template template parameters [PR67829]Patrick Palka4-0/+46
During deduction, when the template of the argument for a bound ttp is a template template parameter, we need to consider the TEMPLATE_TEMPLATE_PARAMETER for matching rather than the TEMPLATE_DECL thereof, because the canonical form of a template template parameter as a template argument is the former tree, not the latter. PR c++/67829 gcc/cp/ChangeLog: * pt.c (unify) <case BOUND_TEMPLATE_TEMPLATE_PARM>: When the TEMPLATE_DECL of a BOUND_TEMPLATE_TEMPLATE_PARM argument is a template template parameter, adjust to the TEMPLATE_TEMPLATE_PARAMETER before falling through. gcc/testsuite/ChangeLog: * g++.dg/template/ttp34.C: New test. * g++.dg/template/ttp34a.C: New test. * g++.dg/template/ttp34b.C: New test.
2021-06-10c++: normalization of non-templated return-type-req [PR100946]Patrick Palka2-0/+15
Here the satisfaction cache is conflating the satisfaction value of the two return-type-requirements because the corresponding constrained 'auto's have level 2, but they capture an empty current_template_parms. This ultimately causes the satisfaction cache to think the type constraint doesn't depend on the deduced type of the expression. When normalizing the constraints on an 'auto', the assumption made by normalize_placeholder_type_constraints is that the level of the 'auto' is one greater than the depth of the captured current_template_parms, an assumption which is not holding here. So this patch just makes n_p_t_c adjust the normalization context appropriately in this situation. PR c++/100946 gcc/cp/ChangeLog: * constraint.cc (normalize_placeholder_type_constraints): When normalizing a non-templated return-type-requirement, add a dummy level to initial_parms. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-return-req3.C: New test.
2021-06-10i386: Add V8QI and other 64bit vector permutations [PR89021]Peter Bergner4-33/+246
In addition to V8QI permutations, several other missing permutations are added for 64bit vector modes for TARGET_SSSE3 and TARGET_SSE4_1 targets. 2021-06-10 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/89021 * config/i386/i386-expand.c (ix86_split_mmx_punpck): Handle V2SF mode. Emit SHUFPS to fixup unpack-high for V2SF mode. (expand_vec_perm_blend): Handle 64bit modes for TARGET_SSE4_1. (expand_vec_perm_pshufb): Handle 64bit modes for TARGET_SSSE3. (expand_vec_perm_pblendv): Handle 64bit modes for TARGET_SSE4_1. (expand_vec_perm_interleave2): Handle 64bit modes. (expand_vec_perm_even_odd_pack): Handle V8QI mode. (expand_vec_perm_even_odd_1): Ditto. (ix86_vectorize_vec_perm_const): Ditto. * config/i386/i386.md (UNSPEC_PSHUFB): Move from ... * config/i386/sse.md: ... here. * config/i386/mmx.md (*vec_interleave_lowv2sf): New insn_and_split pattern. (*vec_interleave_highv2sf): Ditto. (mmx_pshufbv8qi3): New insn pattern. (*mmx_pblendw): Ditto.
2021-06-10libgo: update to Go1.16.5 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/326772
2021-06-10rs6000: Add new __builtin_vsx_build_pair and __builtin_mma_build_acc built-insPeter Bergner6-13/+58
The __builtin_vsx_assemble_pair and __builtin_mma_assemble_acc built-ins currently assign their first source operand to the first VSX register in a pair/quad, their second operand to the second register in a pair/quad, etc. This is not endian friendly and forces the user to generate different calls depending on endianness. In agreement with the POWER LLVM team, we've decided to lightly deprecate the assemble built-ins and replace them with "build" built-ins that automatically handle endianness so the same built-in call and be used for both little-endian and big-endian compiles. We are not removing the assemble built-ins, since there is code in the wild that use them, but we are removing their documentation to encourage the use of the new "build" variants. gcc/ * config/rs6000/rs6000-builtin.def (build_pair): New built-in. (build_acc): Likewise. * config/rs6000/rs6000-call.c (mma_expand_builtin): Swap assemble source operands in little-endian mode. (rs6000_gimple_fold_mma_builtin): Handle VSX_BUILTIN_BUILD_PAIR. (mma_init_builtins): Likewise. * config/rs6000/rs6000.c (rs6000_split_multireg_move): Handle endianness ordering for the MMA assemble and build source operands. * doc/extend.texi (__builtin_vsx_build_acc, __builtin_mma_build_pair): Document. (__builtin_mma_assemble_acc, __builtin_mma_assemble_pair): Remove documentation. gcc/testsuite/ * gcc.target/powerpc/mma-builtin-4.c (__builtin_vsx_build_pair): Add tests. Update expected counts. * gcc.target/powerpc/mma-builtin-5.c (__builtin_mma_build_acc): Add tests. Update expected counts.
2021-06-10d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967)Iain Buclaw4-38/+45
Generate a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed TypeInfo objects. The errors issued by the code generation pass relating to missing or disabled RTTI has been consolidated into a single function, so that a meaningful error will be emitted before the front-end terminates. gcc/d/ChangeLog: PR d/100967 * d-frontend.cc (getTypeInfoType): Move TypeInfo checks to check_typeinfo_type and call new function. * d-tree.h (check_typeinfo_type): Declare. * typeinfo.cc: Include dmd/scope.h. (create_frontend_tinfo_types): Generate front-end types even if Object is missing. (build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call new function. (check_typeinfo_type): New function. gcc/testsuite/ChangeLog: PR d/100967 * gdc.dg/pr100967.d: New test.
2021-06-10Use auto_vec in ssa_equiv_stack.Aldy Hernandez1-9/+2
There is a mismatch between the new and the delete for the ssa_equiv_stack class. The correct idiom should have been delete[]. It has been pointed out that perhaps a better alternative is to use an auto_vec which does everything automatically. Plus, it is more consistent with m_stack which is already an auto_vec. This patch fixes the issue in PR100984. Tested on x86-64 Linux. gcc/ChangeLog: PR tree-optimization/100984 * gimple-ssa-evrp.c (ssa_equiv_stack): Use auto_vec for replacements table. (ssa_equiv_stack::~ssa_equiv_stack): Remove.
2021-06-10Use memory loads and extensions to eliminate redundant test/compare insnsJeff Law2-7/+9
gcc/ * config/h8300/h8300.c (select_cc_mode): Handle MEM. Use REG_P. * config/h8300/extensions.md: Replace _clobber_flags patterns with <cczn>.
2021-06-10s390: Allow more vcond_mask patterns.Robin Dapp3-1/+83
Change vcond_mask iterator as to allow the corresponding int mode for the condition/mask so e.g. boolean conditions become possible: vtarget = bool_cond ? vsource1 : vsource2. gcc/ChangeLog: * config/s390/vector.md (vcond_mask_<mode><mode>): Change to (vcond_mask_<mode><tointvec>): this. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/vcond-mixed-double.c: New test. * gcc.target/s390/vector/vcond-mixed-float.c: New test.
2021-06-10testsuite: Change gcc.dg/vect/pr56541.c target.Robin Dapp1-1/+1
My last commit changed the target selector to ! vect_floatint_cvt when it should of course be vect_floatint_cvt. Fix this. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr56541.c: Fix target selector.