aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-08-27Daily bump.GCC Administrator7-1/+283
2022-08-26Add real_iszero to real.*Aldy Hernandez2-0/+22
We have real_isnegzero but no real_iszero. We could memcmp with 0, but that's just ugly. gcc/ChangeLog: * real.cc (real_iszero): New. * real.h (real_iszero): New.
2022-08-26Add set/get functions for negative infinity in real.*Aldy Hernandez2-4/+15
For the frange implementation with endpoints I'm about to contribute, we need to set REAL_VALUE_TYPEs with negative infinity. The support is already there in real.cc, but it is awkward to get at. One could call real_inf() and then negate the value, but I've added the ability to pass the sign argument like many of the existing real.* functions. I've declared the functions in such a way to avoid changes to the existing code base: // Unchanged function returning true for either +-INF. bool real_isinf (const REAL_VALUE_TYPE *r); // New overload to be able to specify the sign. bool real_isinf (const REAL_VALUE_TYPE *r, int sign); // Replacement function for setting INF, defaults to +INF. void real_inf (REAL_VALUE_TYPE *, int sign = 0); gcc/ChangeLog: * real.cc (real_isinf): New overload. (real_inf): Add sign argument. * real.h (real_isinf): New overload. (real_inf): Add sign argument.
2022-08-26c++: Implement -Wself-move warning [PR81159]Marek Polacek4-2/+203
About 5 years ago we got a request to implement -Wself-move, which warns about useless moves like this: int x; x = std::move (x); This patch implements that warning. PR c++/81159 gcc/c-family/ChangeLog: * c.opt (Wself-move): New option. gcc/cp/ChangeLog: * typeck.cc (maybe_warn_self_move): New. (cp_build_modify_expr): Call maybe_warn_self_move. gcc/ChangeLog: * doc/invoke.texi: Document -Wself-move. gcc/testsuite/ChangeLog: * g++.dg/warn/Wself-move1.C: New test.
2022-08-26Make all default vrange setters set VARYING.Aldy Hernandez1-4/+8
frange is using some of the default vrange setters, some of which are leaving the range in an undefined state. We hadn't noticed this because neither frange nor unsupported_range, both which use some of the default implementation, weren't being used much. We can never go wrong with setting VARYING ;-). gcc/ChangeLog: * value-range.cc (vrange::set): Set varying. (vrange::set_nonzero): Same. (vrange::set_zero): Same. (vrange::set_nonnegative): Same.
2022-08-26[ranger] x == -0.0 does not mean we can replace x with -0.0Aldy Hernandez1-2/+15
On the true side of x == -0.0, we can't just blindly value propagate the -0.0 into every use of x because x could be +0.0. With this change, we only allow the transformation if !HONOR_SIGNED_ZEROS or if the range is known not to contain 0. gcc/ChangeLog: * range-op-float.cc (foperator_equal::op1_range): Do not blindly copy op2 range when honoring signed zeros.
2022-08-26Add newline when checking path profitability.Aldy Hernandez1-1/+9
It looks like we're missing a newline for cases where we don't print anything. gcc/ChangeLog: * tree-ssa-threadbackward.cc (possibly_profitable_path_p): Always add newline. (profitable_path_p): Same.
2022-08-26libcpp: Implement P2362R3 - Remove non-encodable wide character literals and ↵Jakub Jelinek2-0/+85
multicharacter [PR106647] My understanding of the paper is that we just want to promote the CPP_WCHAR "character constant too long for its type" warning to error as it is already error for u8, u and U literals. 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR c++/106647 * charset.cc (wide_str_to_charconst): Implement P2362R3 - Remove non-encodable wide character literals and multicharacter. For C++23 use CPP_DL_ERROR instead of CPP_DL_WARNING for "character constant too long for its type" diagnostics on CPP_WCHAR literals. * g++.dg/cpp23/wchar-multi1.C: New test. * g++.dg/cpp23/wchar-multi2.C: New test.
2022-08-26Remove uninit_analysis::use_cannot_happenRichard Biener2-213/+0
As written earlier uninit_analysis::use_cannot_happen is duplicate functionality implemented in a complement way, not adhering to the idea of disproving a may-uninit use and eventually (I have not yet found a testcase it helps to avoid false positives) avoiding false positives because of this or different ways it imposes limits on the predicate computations. This patch removes it. * gimple-predicate-analysis.h (uninit_analysis::use_cannot_happen): Remove. * gimple-predicate-analysis.cc (can_be_invalidated_p): Remove. (uninit_analysis::use_cannot_happen): Likewise. (uninit_analysis::is_use_guarded): Do not call use_cannot_happen. (dump_predicates): Remove. (simple_control_dep_chain): Remove edge overload.
2022-08-26New testcase for uninitRichard Biener1-0/+27
The following adds a testcase that illustrates a defect in compute_control_dep_chain and its attempt to identify loop exits as special to continue walking post-dominators but failing to do so for following post-dominators. On trunk there is now simple_control_dep_chain saving the day, avoiding the false positive but with GCC 12 we get a bogus diagnostic. * gcc.dg/uninit-pred-11.c: New testcase.
2022-08-26OpenMP: Support reverse offload (middle end part)Tobias Burnus46-72/+239
gcc/ChangeLog: * internal-fn.cc (expand_GOMP_TARGET_REV): New. * internal-fn.def (GOMP_TARGET_REV): New. * lto-cgraph.cc (lto_output_node, verify_node_partition): Mark 'omp target device_ancestor_host' as in_other_partition and don't error if absent. * omp-low.cc (create_omp_child_function): Mark as 'noclone'. * omp-expand.cc (expand_omp_target): For reverse offload, remove sorry, use device = GOMP_DEVICE_HOST_FALLBACK and create empty-body nohost function. * omp-offload.cc (execute_omp_device_lower): Handle IFN_GOMP_TARGET_REV. (pass_omp_target_link::execute): For ACCEL_COMPILER, don't nullify fn argument for reverse offload libgomp/ChangeLog: * libgomp.texi (OpenMP 5.0): Mark 'ancestor' as implemented but refer to 'requires'. * testsuite/libgomp.c-c++-common/reverse-offload-1-aux.c: New test. * testsuite/libgomp.c-c++-common/reverse-offload-1.c: New test. * testsuite/libgomp.fortran/reverse-offload-1-aux.f90: New test. * testsuite/libgomp.fortran/reverse-offload-1.f90: New test. gcc/testsuite/ChangeLog: * c-c++-common/gomp/reverse-offload-1.c: Remove dg-sorry. * c-c++-common/gomp/target-device-ancestor-4.c: Likewise. * gfortran.dg/gomp/target-device-ancestor-4.f90: Likewise. * gfortran.dg/gomp/target-device-ancestor-5.f90: Likewise. * c-c++-common/goacc/classify-kernels-parloops.c: Add 'noclone' to scan-tree-dump-times. * c-c++-common/goacc/classify-kernels-unparallelized-parloops.c: Likewise. * c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise. * c-c++-common/goacc/classify-kernels.c: Likewise. * c-c++-common/goacc/classify-parallel.c: Likewise. * c-c++-common/goacc/classify-serial.c: Likewise. * c-c++-common/goacc/kernels-counter-vars-function-scope.c: Likewise. * c-c++-common/goacc/kernels-loop-2.c: Likewise. * c-c++-common/goacc/kernels-loop-3.c: Likewise. * c-c++-common/goacc/kernels-loop-data-2.c: Likewise. * c-c++-common/goacc/kernels-loop-data-enter-exit-2.c: Likewise. * c-c++-common/goacc/kernels-loop-data-enter-exit.c: Likewise. * c-c++-common/goacc/kernels-loop-data-update.c: Likewise. * c-c++-common/goacc/kernels-loop-data.c: Likewise. * c-c++-common/goacc/kernels-loop-g.c: Likewise. * c-c++-common/goacc/kernels-loop-mod-not-zero.c: Likewise. * c-c++-common/goacc/kernels-loop-n.c: Likewise. * c-c++-common/goacc/kernels-loop-nest.c: Likewise. * c-c++-common/goacc/kernels-loop.c: Likewise. * c-c++-common/goacc/kernels-one-counter-var.c: Likewise. * c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c: Likewise. * gfortran.dg/goacc/classify-kernels-parloops.f95: Likewise. * gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95: Likewise. * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise. * gfortran.dg/goacc/classify-kernels.f95: Likewise. * gfortran.dg/goacc/classify-parallel.f95: Likewise. * gfortran.dg/goacc/classify-serial.f95: Likewise. * gfortran.dg/goacc/kernels-loop-2.f95: Likewise. * gfortran.dg/goacc/kernels-loop-data-2.f95: Likewise. * gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: Likewise. * gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: Likewise. * gfortran.dg/goacc/kernels-loop-data-update.f95: Likewise. * gfortran.dg/goacc/kernels-loop-data.f95: Likewise. * gfortran.dg/goacc/kernels-loop-n.f95: Likewise. * gfortran.dg/goacc/kernels-loop.f95: Likewise. * gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95: Likewise.
2022-08-26fortran: Expand ieee_arithmetic module's ieee_value inline [PR106579]Jakub Jelinek1-0/+119
The following patch expands IEEE_VALUE function inline in the FE. 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR fortran/106579 * trans-intrinsic.cc: Include realmpfr.h. (conv_intrinsic_ieee_value): New function. (gfc_conv_ieee_arithmetic_function): Handle ieee_value.
2022-08-26fortran: Expand ieee_arithmetic module's ieee_class inline [PR106579]Jakub Jelinek3-1/+101
The following patch expands IEEE_CLASS inline in the FE, using the __builtin_fpclassify, __builtin_signbit and the new __builtin_issignaling builtins. 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR fortran/106579 gcc/fortran/ * f95-lang.cc (gfc_init_builtin_functions): Initialize BUILT_IN_FPCLASSIFY. * libgfortran.h (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN, IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL, IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL, IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL, IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF): New enum. * trans-intrinsic.cc (conv_intrinsic_ieee_class): New function. (gfc_conv_ieee_arithmetic_function): Handle ieee_class. libgfortran/ * ieee/ieee_helper.c (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN, IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL, IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL, IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL, IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF): Move to gcc/fortran/libgfortran.h.
2022-08-26Implement __builtin_issignalingJakub Jelinek20-3/+775
The following patch implements a new builtin, __builtin_issignaling, which can be used to implement the ISO/IEC TS 18661-1 issignaling macro. It is implemented as type-generic function, so there is just one builtin, not many with various suffixes. This patch doesn't address PR56831 nor PR58416, but I think compared to using glibc issignaling macro could make some cases better (as the builtin is expanded always inline and for SFmode/DFmode just reinterprets a memory or pseudo register as SImode/DImode, so could avoid some raising of exception + turning sNaN into qNaN before the builtin can analyze it). For floading point modes that do not have NaNs it will return 0, otherwise I've tried to implement this for all the other supported real formats. It handles both the MIPS/PA floats where a sNaN has the mantissa MSB set and the rest where a sNaN has it cleared, with the exception of format which are known never to be in the MIPS/PA form. The MIPS/PA floats are handled using a test like (x & mask) == mask, the other usually as ((x ^ bit) & mask) > val where bit, mask and val are some constants. IBM double double is done by doing DFmode test on the most significant half, and Intel/Motorola extended (12 or 16 bytes) and IEEE quad are handled by extracting 32-bit/16-bit words or 64-bit parts from the value and testing those. On x86, XFmode is handled by a special optab so that even pseudo numbers are considered signaling, like in glibc and like the i386 specific testcase tests. 2022-08-26 Jakub Jelinek <jakub@redhat.com> gcc/ * builtins.def (BUILT_IN_ISSIGNALING): New built-in. * builtins.cc (expand_builtin_issignaling): New function. (expand_builtin_signbit): Don't overwrite target. (expand_builtin): Handle BUILT_IN_ISSIGNALING. (fold_builtin_classify): Likewise. (fold_builtin_1): Likewise. * optabs.def (issignaling_optab): New. * fold-const-call.cc (fold_const_call_ss): Handle BUILT_IN_ISSIGNALING. * config/i386/i386.md (issignalingxf2): New expander. * doc/extend.texi (__builtin_issignaling): Document. (__builtin_isinf, __builtin_isnan): Clarify behavior with -ffinite-math-only. * doc/md.texi (issignaling<mode>2): Likewise. gcc/c-family/ * c-common.cc (check_builtin_function_arguments): Handle BUILT_IN_ISSIGNALING. gcc/c/ * c-typeck.cc (convert_arguments): Handle BUILT_IN_ISSIGNALING. gcc/fortran/ * f95-lang.cc (gfc_init_builtin_functions): Initialize BUILT_IN_ISSIGNALING. gcc/testsuite/ * gcc.dg/torture/builtin-issignaling-1.c: New test. * gcc.dg/torture/builtin-issignaling-2.c: New test. * gcc.dg/torture/float16-builtin-issignaling-1.c: New test. * gcc.dg/torture/float32-builtin-issignaling-1.c: New test. * gcc.dg/torture/float32x-builtin-issignaling-1.c: New test. * gcc.dg/torture/float64-builtin-issignaling-1.c: New test. * gcc.dg/torture/float64x-builtin-issignaling-1.c: New test. * gcc.dg/torture/float128-builtin-issignaling-1.c: New test. * gcc.dg/torture/float128x-builtin-issignaling-1.c: New test. * gcc.target/i386/builtin-issignaling-1.c: New test.
2022-08-26internal-fn, tree-cfg: Fix .TRAP handling and another __builtin_trap vops ↵Jakub Jelinek3-8/+19
issue [PR106099] This patch fixes 2 __builtin_unreachable/__builtin_trap related issues. One (first hunk) is that CDDCE happily removes calls to .TRAP () internal-fn as useless. The problem is that the internal-fn is ECF_CONST | ECF_NORETURN, doesn't have lhs and so DCE thinks it doesn't have side-effects and removes it. __builtin_unreachable which has the same ECF_* flags works fine, as since PR44485 we implicitly add ECF_LOOPING_CONST_OR_PURE to ECF_CONST | ECF_NORETURN builtins, but do it in flags_from_decl_or_type which isn't called for internal-fns. As IFN_TRAP is the only ifn with such flags, it seems easier to add it explicitly. The other issue (which on the testcase can be seen only with the first bug unfixed) is that execute_fixup_cfg can add a __builtin_trap which needs vops, but nothing adds it and it can appear in many passes which don't have corresponding TODO_update_ssa_only_virtuals etc. Fixed similarly as last time but emitting ifn there instead. 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/106099 * internal-fn.def (TRAP): Add ECF_LOOPING_CONST_OR_PURE flag. * tree-cfg.cc (execute_fixup_cfg): Add IFN_TRAP instead of __builtin_trap to avoid the need of vops. * gcc.dg/pr106099.c: New test.
2022-08-26c++: Implement C++23 P2071R2 - Named universal character escapes [PR106648]Jakub Jelinek11-0/+337
The following patch implements the C++23 P2071R2 - Named universal character escapes paper to support \N{LATIN SMALL LETTER E} etc. I've used Unicode 14.0, there are 144803 character name properties (including the ones generated by Unicode NR1 and NR2 rules) and correction/control/alternate aliases, together with zero terminators that would be 3884745 bytes, which is clearly unacceptable for libcpp. This patch instead contains a generator which from the UnicodeData.txt and NameAliases.txt files emits a space optimized radix tree (208765 bytes long for 14.0), a single string literal dictionary (59418 bytes), maximum name length (currently 88 chars) and two small helper arrays for the NR1/NR2 name generation. The radix tree needs 2 to 9 bytes per node, the exact format is described in the generator program. There could be ways to shrink the dictionary size somewhat at the expense of slightly slower lookups. Currently the patch implements strict matching (that is what is needed to actually implement it on valid code) and Unicode UAX44-LM2 algorithm loose matching to provide hints (that algorithm essentially ignores hyphens in between two alphanumeric characters, spaces and underscores (with one exception for hyphen) and does case insensitive matching). In the attachment is a WIP patch that shows how to implement also spellcheck.{h,cc} style discovery of misspellings, but I'll need to talk to David Malcolm about it, as spellcheck.{h,cc} is in gcc/ subdir (so the WIP incremental patch instead prints all the names to stderr). 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR c++/106648 libcpp/ * charset.cc: Implement C++23 P2071R2 - Named universal character escapes. Include uname2c.h. (hangul_syllables, hangul_count): New variables. (struct uname2c_data): New type. (_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions. (_cpp_valid_ucn): Use them. Handle named universal character escapes. (convert_ucn): Adjust comment. (convert_escape): Call convert_ucn even for \N. (_cpp_interpret_identifier): Handle named universal character escapes. * lex.cc (get_bidi_ucn): Fix up function comment formatting. (get_bidi_named): New function. (forms_identifier_p, lex_string): Handle named universal character escapes. * makeuname2c.cc: New file. Small parts copied from makeucnid.cc. * uname2c.h: New generated file. gcc/c-family/ * c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_named_character_escapes to 202207L. gcc/testsuite/ * c-c++-common/cpp/named-universal-char-escape-1.c: New test. * c-c++-common/cpp/named-universal-char-escape-2.c: New test. * c-c++-common/cpp/named-universal-char-escape-3.c: New test. * c-c++-common/cpp/named-universal-char-escape-4.c: New test. * c-c++-common/Wbidi-chars-25.c: New test. * gcc.dg/cpp/named-universal-char-escape-1.c: New test. * gcc.dg/cpp/named-universal-char-escape-2.c: New test. * g++.dg/cpp/named-universal-char-escape-1.C: New test. * g++.dg/cpp/named-universal-char-escape-2.C: New test. * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_named_character_escapes.
2022-08-26Improve compute_control_dep_chain path findingRichard Biener2-3/+81
This improves the compute_control_dep_chain path finding by first marking the dominating region we search and then making sure to not walk outside if it when enumerating all paths from the dominating block to the interesting PHI edge source. I have limited the DFS walk done for the marking in similar ways as we limit the walking in compute_control_dep_chain, more careful limiting might be necessary though - the --param uninit-control-dep-attempts param I re-use has a rather high default of 1000 which we might be able to reduce with this patch as well (I think we'll usually hit some of the other limits before ever reaching this). * gimple-predicate-analysis.cc (dfs_mark_dominating_region): New helper. (compute_control_dep_chain): Adjust to honor marked region if provided. (uninit_analysis::init_from_phi_def): Pre-mark the dominating region to improve compute_control_dep_chain walking. * vec.h (vec<T, va_heap, vl_ptr>::allocated): Add forwarder.
2022-08-26Improve uninit_analysis::collect_phi_def_edgesRichard Biener1-5/+5
This avoids expanding an edge to those of a PHI def if it is not may-undefined, reducing the number of compute_control_dep_chain calls. * gimple-predicate-analysis.cc (uninit_analysis::collect_phi_def_edges): Only expand a PHI def edge when it is possibly undefined.
2022-08-26cr16: remove obsoleted portMartin Liska15-4489/+4
contrib/ChangeLog: * config-list.mk: Remove cr16. gcc/ChangeLog: * doc/extend.texi: Remove cr16 related stuff. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. * doc/md.texi: Likewise. * function-tests.cc (test_expansion_to_rtl): Likewise. * common/config/cr16/cr16-common.cc: Removed. * config/cr16/constraints.md: Removed. * config/cr16/cr16-protos.h: Removed. * config/cr16/cr16.cc: Removed. * config/cr16/cr16.h: Removed. * config/cr16/cr16.md: Removed. * config/cr16/cr16.opt: Removed. * config/cr16/predicates.md: Removed. * config/cr16/t-cr16: Removed. libgcc/ChangeLog: * config.host: Remove cr16 related stuff. * config/cr16/crti.S: Removed. * config/cr16/crtlibid.S: Removed. * config/cr16/crtn.S: Removed. * config/cr16/divmodhi3.c: Removed. * config/cr16/lib1funcs.S: Removed. * config/cr16/t-cr16: Removed. * config/cr16/t-crtlibid: Removed. * config/cr16/unwind-cr16.c: Removed. * config/cr16/unwind-dw2.h: Removed. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Remove cr16 related stuff.
2022-08-26Don't gimple fold ymm-version vblendvpd/vblendvps/vpblendvb w/o TARGET_AVX2liuhongt3-5/+27
Since 256-bit vector integer comparison is under TARGET_AVX2, and gimple folding for vblendvpd/vblendvps/vpblendvb relies on that. Restrict gimple fold condition to TARGET_AVX2. gcc/ChangeLog: PR target/106704 * config/i386/i386-builtin.def (BDESC): Add CODE_FOR_avx_blendvpd256/CODE_FOR_avx_blendvps256 to corresponding builtins. * config/i386/i386.cc (ix86_gimple_fold_builtin): Don't fold IX86_BUILTIN_PBLENDVB256, IX86_BUILTIN_BLENDVPS256, IX86_BUILTIN_BLENDVPD256 w/o TARGET_AVX2. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106704.c: New test.
2022-08-26Daily bump.GCC Administrator7-1/+207
2022-08-25c: Implement C23 nullptr (N3042)Marek Polacek18-42/+586
This patch implements the C23 nullptr literal: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm> (with wording fixes from N3047), which is intended to replace the problematic definition of NULL which might be either of integer type or void*. Since C++ has had nullptr for over a decade now, it was relatively easy to just move the built-in node definitions from the C++ FE to the C/C++ common code. Also, our DWARF emitter already handles NULLPTR_TYPE by emitting DW_TAG_unspecified_type. However, I had to handle a lot of contexts such as ?:, comparison, conversion, etc. There are some minor differences, e.g. in C you can do bool b = nullptr; but in C++ you have to use direct-initialization: bool b{nullptr}; And I think that nullptr_t n = 0; is only valid in C++. Of course, C doesn't have to handle mangling, RTTI, substitution, overloading, ... This patch also defines nullptr_t in <stddef.h>. However, it does not define __STDC_VERSION_STDDEF_H__ yet, because we don't know yet what value it should be defined to. gcc/c-family/ChangeLog: * c-common.cc (c_common_reswords): Enable nullptr in C2X. (c_common_nodes_and_builtins): Create the built-in node for nullptr. * c-common.h (enum c_tree_index): Add CTI_NULLPTR, CTI_NULLPTR_TYPE. (struct c_common_resword): Resize the disable member. (D_C2X): Add. (nullptr_node): Define. (nullptr_type_node): Define. (NULLPTR_TYPE_P): Define. * c-pretty-print.cc (c_pretty_printer::simple_type_specifier): Handle NULLPTR_TYPE. (c_pretty_printer::direct_abstract_declarator): Likewise. (c_pretty_printer::constant): Likewise. gcc/c/ChangeLog: * c-convert.cc (c_convert) <case POINTER_TYPE>: Handle NULLPTR_TYPE. Give a better diagnostic when converting to nullptr_t. * c-decl.cc (c_init_decl_processing): Perform C-specific nullptr initialization. * c-parser.cc (c_parse_init): Maybe OR D_C2X into mask. (c_parser_postfix_expression): Handle RID_NULLPTR. * c-typeck.cc (null_pointer_constant_p): Return true when expr is nullptr_node. (build_unary_op) <case TRUTH_NOT_EXPR>: Handle NULLPTR_TYPE. (build_conditional_expr): Handle the case when the second/third operand is NULLPTR_TYPE and third/second operand is POINTER_TYPE. (convert_for_assignment): Handle converting an expression of type nullptr_t to pointer/bool. (build_binary_op) <case TRUTH_XOR_EXPR>: Handle NULLPTR_TYPE. <case EQ_EXPR>: Handle comparing operands of type nullptr_t. gcc/cp/ChangeLog: * cp-tree.h (enum cp_tree_index): Remove CTI_NULLPTR, CTI_NULLPTR_TYPE. Move it to c_tree_index. (nullptr_node): No longer define here. (nullptr_type_node): Likewise. (NULLPTR_TYPE_P): Likewise. * decl.cc (cxx_init_decl_processing): Only keep C++-specific nullptr initialization; move the shared code to c_common_nodes_and_builtins. gcc/ChangeLog: * ginclude/stddef.h: Define nullptr_t. gcc/testsuite/ChangeLog: * gcc.dg/c11-nullptr-1.c: New test. * gcc.dg/c17-nullptr-1.c: New test. * gcc.dg/c17-nullptr-2.c: New test. * gcc.dg/c2x-nullptr-1.c: New test. * gcc.dg/c2x-nullptr-2.c: New test. * gcc.dg/c2x-nullptr-3.c: New test. * gcc.dg/c2x-nullptr-4.c: New test. * gcc.dg/c2x-nullptr-5.c: New test.
2022-08-25c: Support C2x empty initializer bracesJoseph Myers20-47/+305
ISO C2x standardizes empty initializer braces {}. Implement this feature accordingly. The basic case was already supported and so just needed diagnostic adjustments. However, the standard feature also includes two cases that were not previously supported: empty initializer braces for scalars, and empty initializer braces for VLAs. Thus, add support for those features as well, updating existing tests that expected them to be diagnosed. There was already some gimplifier support for converting variable-sized initializations with empty CONSTRUCTORs to memset. However, it didn't apply here; code earlier in gimplify_modify_expr ended up calling gimplify_init_constructor via gimplify_modify_expr_rhs, which ended up handling the CONSTRUCTOR in a way that generated an ICE later. Add a check for this case earlier in gimplify_modify_expr to avoid that issue. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ * gimplify.cc (gimplify_modify_expr): Convert initialization from a variable-size CONSTRUCTOR to memset before call to gimplify_modify_expr_rhs. gcc/c/ * c-decl.cc (start_decl): Do not diagnose initialization of variable-sized objects here. * c-parser.cc (c_parser_braced_init): Add argument DECL. All callers changed. (c_parser_initializer): Diagnose initialization of variable-sized objects other than with braced initializer. (c_parser_braced_init): Use pedwarn_c11 for empty initializer braces and update diagnostic text. Diagnose initialization of variable-sized objects with nonempty braces. * c-typeck.cc (digest_init): Update diagnostic for initialization of variable-sized objects. (really_start_incremental_init, set_designator) (process_init_element): Update comments. (pop_init_level): Allow scalar empty initializers. gcc/testsuite/ * gcc.dg/c11-empty-init-1.c, gcc.dg/c11-empty-init-2.c, gcc.dg/c11-empty-init-3.c, gcc.dg/c2x-empty-init-1.c, gcc.dg/c2x-empty-init-2.c, gcc.dg/c2x-empty-init-3.c, gcc.dg/gnu2x-empty-init-1.c, gcc.dg/gnu2x-empty-init-2.c: New tests. * gcc.dg/torture/dfp-default-init-1.c: Also test empty initializers. * gcc.dg/init-bad-1.c, gcc.dg/noncompile/pr71583.c, gcc.dg/pr61096-1.c, gcc.dg/vla-init-2.c, gcc.dg/vla-init-3.c, gcc.target/i386/sse2-bfloat16-scalar-typecheck.c: Update expected diagnostics. * gcc.dg/ubsan/c-shift-1.c: Use nonempty initializers for VLA initializations expected to be diagnosed.
2022-08-25c++: block copy elision in delegating ctorJason Merrill2-0/+18
CWG2403 deals with the issue that copy elision is not possible when the initialized object is a potentially-overlapping subobject and the initializer is a function that returns by value. Jonathan pointed out that this also affects delegating constructors, which might be used to construct a base subobject. gcc/cp/ChangeLog: * call.cc (unsafe_return_slot_p): Return 2 for *this in a constructor. gcc/testsuite/ChangeLog: * g++.dg/init/elide8.C: New test.
2022-08-25dwarf2: use DW_ATE_UTF for char8_tJason Merrill2-0/+10
While looking at the Rust changes to dwarf2out I noticed that this was missing from the char8_t support. gcc/ChangeLog: * dwarf2out.cc (base_type_die): Also use DW_ATE_UTF for char8_t. gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/utf-1.C: New test.
2022-08-25PR 106101: IBM zSystems: Fix strict_low_part problemAndreas Krebbel5-22/+116
This avoids generating illegal (strict_low_part (reg ...)) RTXs. This required two changes: 1. Do not use gen_lowpart to generate the inner expression of a STRICT_LOW_PART. gen_lowpart might fold the SUBREG either because there is already a paradoxical subreg or because it can directly be applied to the register. A new wrapper function makes sure that we always end up having an actual SUBREG. 2. Change the movstrict patterns to enforce a SUBREG as inner operand of the STRICT_LOW_PARTs. The new predicate introduced for the destination operand requires a SUBREG expression with a register_operand as inner operand. However, since reload strips away the majority of the SUBREGs we have to accept single registers as well once we reach reload. Bootstrapped and regression tested on IBM zSystems 64 bit. gcc/ChangeLog: PR target/106101 * config/s390/predicates.md (subreg_register_operand): New predicate. * config/s390/s390-protos.h (s390_gen_lowpart_subreg): New function prototype. * config/s390/s390.cc (s390_gen_lowpart_subreg): New function. (s390_expand_insv): Use s390_gen_lowpart_subreg instead of gen_lowpart. * config/s390/s390.md ("*get_tp_64", "*zero_extendhisi2_31") ("*zero_extendqisi2_31", "*zero_extendqihi2_31"): Likewise. ("movstrictqi", "movstricthi", "movstrictsi"): Use the subreg_register_operand predicate instead of register_operand. gcc/testsuite/ChangeLog: PR target/106101 * gcc.c-torture/compile/pr106101.c: New test.
2022-08-25LoongArch: add model attributeXi Ruoyao7-21/+238
A linker script and/or a section attribute may locate some object specially, so we need to handle the code model for such objects differently than the -mcmodel setting. This happens when the Linux kernel loads a module with per-CPU variables. Add an attribute to override the code model for a specific variable. gcc/ChangeLog: * config/loongarch/loongarch-protos.h (loongarch_symbol_type): Add SYMBOL_PCREL64 and change the description for SYMBOL_PCREL. * config/loongarch/loongarch.cc (loongarch_attribute_table): New attribute table. (TARGET_ATTRIBUTE_TABLE): Define the target hook. (loongarch_handle_model_attribute): New static function. (loongarch_classify_symbol): Take TARGET_CMODEL_EXTREME and the model attribute of SYMBOL_REF_DECL into account returning SYMBOL_PCREL or SYMBOL_PCREL64. (loongarch_use_anchors_for_symbol_p): New static function. (TARGET_USE_ANCHORS_FOR_SYMBOL_P): Define the target hook. (loongarch_symbol_extreme_p): New static function. (loongarch_symbolic_constant_p): Handle SYMBOL_PCREL64. (loongarch_symbol_insns): Likewise. (loongarch_split_symbol_type): Likewise. (loongarch_split_symbol): Check SYMBOL_PCREL64 instead of TARGET_CMODEL_EXTREME for PC-relative addressing. (loongarch_print_operand_reloc): Likewise. * doc/extend.texi (Variable Attributes): Document new LoongArch specific attribute. gcc/testsuite/ChangeLog: * gcc.target/loongarch/attr-model-test.c: New test. * gcc.target/loongarch/attr-model-1.c: New test. * gcc.target/loongarch/attr-model-2.c: New test. * gcc.target/loongarch/attr-model-diag.c: New test.
2022-08-25LoongArch: Avoid RTL flag check failure in loongarch_classify_symbolXi Ruoyao1-3/+2
SYMBOL_REF_TLS_MODEL invokes SYMBOL_REF_FLAGS, and SYMBOL_REF_FLAGS invokes RTL_FLAG_CHECK1 and aborts when RTL code is not SYMBOL_REF. r13-1833 removed "gcc_assert (SYMBOL_REF_P (x))" before invoking "SYMBOL_REF_TLS_MODEL (x)", indicating that it's now possible that "x" is not a SYMBOL_REF. So we need to check if "x" is SYMBOL_REF first. This fixes a test failure happening with r13-2173 with RTL flag checking enabled: pr106096.C:26:1: internal compiler error: RTL flag check: SYMBOL_REF_FLAGS used with unexpected rtx code 'const' in loongarch_classify_symbol gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_classify_symbol): Return early if the rtx is not SYMBOL_REF.
2022-08-25tree-optimization/106737 - remove intermediate SSA verification in autoparRichard Biener2-2/+18
The following removes intermediate SSA verification in autopar which isn't expected to succeed after previous changes delaying (virtual) SSA update to the end of the pass. PR tree-optimization/106737 * tree-parloops.cc (transform_to_exit_first_loop_alt): Do not verify SSA form. * gcc.dg/autopar/pr106737.c: New testcase.
2022-08-25Fortran/OpenMP: Fix strictly structured blocks parsingTobias Burnus2-1/+22
gcc/fortran/ChangeLog: * parse.cc (parse_omp_structured_block): When parsing strictly structured blocks, issue an error if the end-directive comes before the 'end block'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/strictly-structured-block-4.f90: New test.
2022-08-25LoongArch: Fix pr106459 by use HWIT instead of 1UL.Chenghua Xu3-9/+25
gcc/ChangeLog: PR target/106459 * config/loongarch/loongarch.cc (loongarch_build_integer): Use HOST_WIDE_INT. * config/loongarch/loongarch.h (IMM_REACH): Likewise. (HWIT_1U): New Defined. (LU12I_OPERAND): Use HOST_WIDE_INT. (LU32I_OPERAND): Likewise. (LU52I_OPERAND): Likewise. (HWIT_UC_0xFFF): Likwise. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr106459.c: New test.
2022-08-25Daily bump.GCC Administrator4-1/+272
2022-08-24[RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.mdAndrew Pinski1-4/+4
The constraints should be n instead of i. Also there needs to a check for out of bounds zero_extract for *bexti. gcc/ChangeLog: PR target/106632 PR target/106588 * config/riscv/bitmanip.md (*shNadduw): Use n constraint instead of i. (*slliuw): Likewise. (*bexti): Likewise. Also add a check for operands[2] to be less than the mode bitsize.
2022-08-24[RISCV] Add constraints for not_single_bit_mask_operand/single_bit_mask_operandAndrew Pinski2-3/+13
Like a previous patch, just add constraints for predicates not_single_bit_mask_operand and single_bit_mask_operand. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constraints.md (DbS): New constraint. (DnS): New constraint. * config/riscv/bitmanip.md (*bset<mode>_1_mask): Use new constraint. (*bclr<mode>): Likewise. (*binvi<mode>): Likewise.
2022-08-24[RISCV] Fix PR 106586: riscv32 vs ZBSAndrew Pinski3-6/+14
The problem here is two fold. With RISCV32, 32bit const_int are always signed extended to 64bit in HWI. So that means for SINGLE_BIT_MASK_OPERAND, it should mask off the upper bits to see it is a single bit for !TARGET_64BIT. Plus there are a few locations which forget to call trunc_int_for_mode when generating a SImode constant so they are not sign extended correctly for HWI. The predicates single_bit_mask_operand and not_single_bit_mask_operand need get the same handling as SINGLE_BIT_MASK_OPERAND so just use SINGLE_BIT_MASK_OPERAND. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with --with-arch=rvNimafdc_zba_zbb_zbc_zbs where N is replaced with 32 or 64. Thanks, Andrew Pinski gcc/ChangeLog: PR target/106586 * config/riscv/predicates.md (single_bit_mask_operand): Use SINGLE_BIT_MASK_OPERAND instead of directly calling pow2p_hwi. (not_single_bit_mask_operand): Likewise. * config/riscv/riscv.cc (riscv_build_integer_1): Don't special case 1<<31 for 32bits as it is already handled. Call trunc_int_for_mode on the upper part after the subtraction. (riscv_move_integer): Call trunc_int_for_mode before generating the integer just make sure the constant has been sign extended corectly. (riscv_emit_int_compare): Call trunc_int_for_mode after doing the addition for the new rhs. * config/riscv/riscv.h (SINGLE_BIT_MASK_OPERAND): If !TARGET64BIT, then mask off the upper 32bits of the HWI as it will be sign extended.
2022-08-24[RISCV] Use a constraint for bset<mode>_mask and bset<mode>_1_maskAndrew Pinski3-2/+15
A constraint here just makes it easier to understand what the operands are. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with --with-arch=rvNimafdc_zba_zbb_zbc_zbs (where N is 32 and 64). Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constraints.md (DsS): New constraint. (DsD): New constraint. * config/riscv/iterators.md (shiftm1c): New iterator. * config/riscv/bitmanip.md (*bset<mode>_mask): Use shiftm1c. (*bset<mode>_1_mask): Likewise.
2022-08-24[RISCV] Use constraints/predicates instead of checking const_int directly ↵Andrew Pinski3-5/+14
for shNadd patterns This simplifies the code by adding a predicate and a constraint for 1/2/3. The aarch64 backend has a similar predicate called aarch64_shift_imm_<mode> which they use there. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constraints.md (Ds3): New constraint. * config/riscv/predicates.md (imm123_operand): New predicate. * config/riscv/bitmanip.md (*shNadd): Use Ds3 and imm123_operand. (*shNadduw): Likewise.
2022-08-24[RISCV] Add %~ to print w if TARGET_64BIT and use itAndrew Pinski3-10/+30
To make things easier and more maintainable, we need to add support printing out w if TARGET_64BIT so this patch adds %~ to do that, similar how the x86 backend uses %~ to print out i/f for TARGET_AVX2. We could have chosen any punctuation symbol but ~ looks the closest to w. OK? Build and tested for riscv64-linux-gnu and riscv32-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/riscv.cc (riscv_print_operand): Handle '~'. (riscv_print_operand_punct_valid_p): New function (TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define. * config/riscv/bitmanip.md (<bitmanip_optab>si2/clz_ctz_pcnt): Use %~ instead of conditional the pattern on TARGET_64BIT. (rotrsi3): Likewise. (rotlsi3): Likewise. * config/riscv/riscv.md: Add ~ to the list of modifiers. (addsi3): Use %~ instead of conditional the pattern on TARGET_64BIT. (subsi3): Likewise. (negsi2): Likewise. (mulsi3): Likewise. (optab>si3/any_div): Likewise. (*add<mode>hi3): Likewise. (<optab>si3/any_shift): Likewise.
2022-08-24[RISCV] Add the list of operand modifiers to riscv.md tooAndrew Pinski2-1/+17
To make it easier to find operands modifiers while in the md file, add the list of modifiers to the top of the md file. This is similar to i386 target. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_print_operand): Make a mention to keep the list in riscv.md in sync with this list. * config/riscv/riscv.md: Add list of modifiers as comments.
2022-08-24[RISCV] Move iterators from sync.md to iterators.mdAndrew Pinski2-4/+7
Like the previous two patches this moves the iterators that are in sync.md to iterators.md. OK? build and tested for riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/sync.md (any_atomic, atomic_optab): Move to ... * config/riscv/iterators.md: Here.
2022-08-24[RISCV] Move iterators from bitmanip.md to iterators.mdAndrew Pinski2-26/+26
Just like the previous patch this move all of the iterators of bitmanip.md to iterators.md. All modern backends put the iterators in iterators.md for easier access. OK? Built and tested for riscv32-linux-gnu with --with-arch=rv32imafdc_zba_zbb_zbc_zbs. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/bitmanip.md (bitmanip_bitwise, bitmanip_minmax, clz_ctz_pcna, tbitmanip_optab, bitmanip_insn, shiftm1): Move to ... * config/riscv/iterators.md: Here.
2022-08-24[RISCV] Move iterators from riscv.md to iterators.mdAndrew Pinski2-169/+212
This moves the iterators out from riscv.md to iterators.md like most modern backends. I have not moved the iterators from the other .md files yet. OK? Build and tested on riscv64-linux-gnu and riscv32-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/riscv.md (GPR): Move to new file. (P, X, BR): Likewise. (MOVE32, MOVE64, SHORT): Likewise. (HISI, SUPERQI, SUBX): Likewise. (ANYI, ANYF, SOFTF): Likewise. (size, load, default_load): Likewise. (softload, store, softstore): Likewise. (reg, fmt, ifmt, amo): Likewise. (UNITMODE, HALFMODE): Likewise. (RINT, rint_pattern, rint_rm): Likewise. (QUIET_COMPARISON, quiet_pattern, QUIET_PATTERN): Likewise. (any_extend, any_shiftrt, any_shift): Likewise. (any_bitwise): Likewise. (any_div, any_mod): Likewise. (any_gt, any_ge, any_lt, any_le): Likewise. (u, su): Likewise. (optab, insn): Likewise. * config/riscv/iterators.md: New file.
2022-08-24Fix PR 106690: enable effective_target_bswap for RISCV targets with ZBB ↵Andrew Pinski1-0/+7
enabled by default While looking for testcases to quickly test, I Noticed that check_effective_target_bswap was not enabled for riscv when ZBB is enabled. This patch checks if ZBB is enabled when targeting RISCV* for bswap. OK? Ran the testsuite for riscv32-linux-gnu both with and without ZBB enabled. PR testsuite/106690 gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_bswap): Return true if riscv and ZBB ISA extension is enabled.
2022-08-24Fix PR 106601: __builtin_bswap16 code gen could be improved with ZBB enabledAndrew Pinski3-0/+48
The default expansion for bswap16 is two extractions (shift/and) followed by an insertation (ior) and then a zero extend. This can be improved with ZBB enabled to just full byteswap followed by a (logical) shift right. This patch adds a new pattern for this which does that. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu. gcc/ChangeLog: PR target/106601 * config/riscv/bitmanip.md (bswaphi2): New pattern. gcc/testsuite/ChangeLog: PR target/106601 * gcc.target/riscv/zbb_32_bswap-2.c: New test. * gcc.target/riscv/zbb_bswap-2.c: New test.
2022-08-24Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bitAndrew Pinski3-1/+23
The problem here is the bswap<mode>2 pattern had a check for TARGET_64BIT but then used the X iterator. Since the X iterator is either SI or DI depending on the setting TARGET_64BIT, there is no reason for the TARGET_64BIT. OK? Built and tested on both riscv32-linux-gnu and riscv64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: PR target/106600 * config/riscv/bitmanip.md (bswap<mode>2): Remove condition on TARGET_64BIT as X is already conditional there. gcc/testsuite/ChangeLog: PR target/106600 * gcc.target/riscv/zbb_32_bswap-1.c: New test. * gcc.target/riscv/zbb_bswap-1.c: New test.
2022-08-24Fortran: improve error recovery while simplifying size of bad array [PR103694]Harald Anlauf2-2/+14
gcc/fortran/ChangeLog: PR fortran/103694 * simplify.cc (simplify_size): The size expression of an array cannot be simplified if an error occurs while resolving the array spec. gcc/testsuite/ChangeLog: PR fortran/103694 * gfortran.dg/pr103694.f90: New test.
2022-08-24tree.cc: Fix optimization of DFP default initializationJoseph Myers4-2/+140
When an object of decimal floating-point type is default-initialized, GCC is inconsistent about whether it is given the all-zero-bits representation (zero with the least quantum exponent) or whether it acts like a conversion of integer 0 to the DFP type (zero with quantum exponent 0). In particular, the representation stored in memory can have all zero bits, but optimization of access to the same object based on its known constant value can then produce zero with quantum exponent 0 instead. C2x leaves the quantum exponent for default initialization implementation-defined, but that doesn't allow such inconsistency in the interpretation of a single object. All zero bits seems most appropriate; change build_real to special-case dconst0 the same way other constants are special-cased and ensure that the correct zero for the type is generated. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ * tree.cc (build_real): Give DFP dconst0 the minimum quantum exponent for the type. gcc/testsuite/ * gcc.dg/torture/dfp-default-init-1.c, gcc.dg/torture/dfp-default-init-2.c, gcc.dg/torture/dfp-default-init-3.c: New tests.
2022-08-24bpf: facilitate constant propagation of function addressesJose E. Marchesi3-2/+36
eBPF effectively supports two kind of call instructions: - The so called pseudo-calls ("bpf to bpf"). - External calls ("bpf to kernel"). The BPF call instruction always gets an immediate argument, whose interpretation varies depending on the purpose of the instruction: - For pseudo-calls, the immediate argument is interpreted as a 32-bit PC-relative displacement measured in number of 64-bit words minus one. - For external calls, the immediate argument is interpreted as the identification of a kernel helper. In order to differenciate both flavors of CALL instructions the SRC field of the instruction (otherwise unused) is abused as an opcode; if the field holds 0 the instruction is an external call, if it holds BPF_PSEUDO_CALL the instruction is a pseudo-call. C-to-BPF toolchains, including the GNU toolchain, use the following practical heuristic at assembly time in order to determine what kind of CALL instruction to generate: call instructions requiring a fixup at assembly time are interpreted as pseudo-calls. This means that in practice a call instruction involving symbols at assembly time (such as `call foo') is assembled into a pseudo-call instruction, whereas something like `call 12' is assembled into an external call instruction. In both cases, the argument of CALL is an immediate: at the time of writing eBPF lacks support for indirect calls, i.e. there is no call-to-register instruction. This is the reason why BPF programs, in practice, rely on certain optimizations to happen in order to generate calls to immediates. This is a typical example involving a kernel helper: static void * (*bpf_map_lookup_elem)(void *map, const void *key) = (void *) 1; int foo (...) { char *ret; ret = bpf_map_lookup_elem (args...); if (ret) return 1; return 0; } Note how the code above relies on the compiler to do constant propagation so the call to bpf_map_lookup_elem can be compiled to a `call 1' instruction. While GCC provides a kernel_helper function declaration attribute that can be used in a robust way to tell GCC to generate an external call despite of optimization level and any other consideration, the Linux kernel bpf_helpers.h file relies on tricks like the above. This patch modifies the BPF backend to avoid SSA sparse constant propagation to be "undone" by the expander loading the function address into a register. A new test is also added. Tested in bpf-unknown-linux-gnu. No regressions. gcc/ChangeLog: PR target/106733 * config/bpf/bpf.cc (bpf_legitimate_address_p): Recognize integer constants as legitimate addresses for functions. (bpf_small_register_classes_for_mode_p): Define target hook. gcc/testsuite/ChangeLog: PR target/106733 * gcc.target/bpf/constant-calls.c: Rename to ... * gcc.target/bpf/constant-calls-1.c: and modify to not expect failure anymore. * gcc.target/bpf/constant-calls-2.c: New test.
2022-08-24Move things around in predicate analysisRichard Biener1-286/+286
This moves a few functions, notably normalization after a big comment documenting it. I've left the rest unorganized for now. * gimple-predicate-analysis.cc: Move predicate normalization after the comment documenting it.
2022-08-24Split uninit analysis from predicate analysisRichard Biener3-102/+121
This splits the API collected in gimple-predicate-analysis.h into what I'd call a predicate and assorted functionality plus utility used by the uninit pass that happens to use that. I've tried to be minimalistic with refactoring, there's still recursive instantiation of uninit_analysis, the new class encapsulating a series of uninit analysis queries from the uninit pass. But it at least should make the predicate part actually reusable and what predicate is dealt with is a little bit more clear in the uninit_analysis part. I will followup with moving the predicate implementation bits together in the gimple-predicate-analysis.cc file. * gimple-predicate-analysis.h (predicate): Split out non-predicate related functionality into .. (uninit_analysis): .. this new class. * gimple-predicate-analysis.cc: Refactor into two classes. * tree-ssa-uninit.cc (find_uninit_use): Use uninit_analysis.