aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-11-18preprocessor: C++ module-directivesNathan Sidwell6-4/+514
C++20 modules introduces a new kind of preprocessor directive -- a module directive. These are directives but without the leading '#'. We have to detect them by sniffing the start of a logical line. When detected we replace the initial identifiers with unspellable tokens and pass them through to the language parser the same way deferred pragmas are. There's a PRAGMA_EOL at the logical end of line too. One additional complication is that we have to do header-name lexing after the initial tokens, and that requires changes in the macro-aware piece of the preprocessor. The above sniffer sets a counter in the lexer state, and that triggers at the appropriate point. We then do the same header-name lexing that occurs on a #include directive or has_include pseudo-macro. Except that the header name ends up in the token stream. A couple of token emitters need to deal with the new token possibility. gcc/c-family/ * c-lex.c (c_lex_with_flags): CPP_HEADER_NAMEs can now be seen. libcpp/ * include/cpplib.h (struct cpp_options): Add module_directives option. (NODE_MODULE): New node flag. (struct cpp_hashnode): Make rid-code a bitfield, increase bits in flags and swap with type field. * init.c (post_options): Create module-directive identifier nodes. * internal.h (struct lexer_state): Add directive_file_token & n_modules fields. Add module node enumerator. * lex.c (cpp_maybe_module_directive): New. (_cpp_lex_token): Call it. (cpp_output_token): Add '"' around CPP_HEADER_NAME token. (do_peek_ident, do_peek_module): New. (cpp_directives_only): Detect module-directive lines. * macro.c (cpp_get_token_1): Deal with directive_file_token triggering.
2020-11-18preprocessor: Add support for header unit translationNathan Sidwell2-40/+118
libcpp/ * files.c (struct _cpp_file): Add header_unit field. (_cpp_stack_file): Add header unit support. (cpp_find_header_unit): New. * include/cpplib.h (cpp_find_header_unit): Declare.
2020-11-18preprocessor: Update mkdeps for modulesNathan Sidwell3-1/+96
This is slightly different to the original patch I posted. This adds separate module target and dependency functions (rather than a single bi-modal function). libcpp/ * include/cpplib.h (struct cpp_options): Add modules to dep-options. * include/mkdeps.h (deps_add_module_target): Declare. (deps_add_module_dep): Declare. * mkdeps.c (class mkdeps): Add modules, module_name, cmi_name, is_header_unit fields. Adjust cdtors. (deps_add_module_target, deps_add_module_dep): New. (make_write): Write module dependencies, if enabled.
2020-11-18libstdc++: Fix ranges::join_view::_Iterator::operator-> [LWG 3500]Patrick Palka2-6/+20
This applies the proposed resolution of LWG 3500, which corrects the return type and constraints of this member function to use the right iterator type. Additionally, a nearby local variable is uglified. libstdc++-v3/ChangeLog: * include/std/ranges (join_view::_Iterator::_M_satisfy): Uglify local variable inner. (join_view::_Iterator::operator->): Use _Inner_iter instead of _Outer_iter in the function signature as per LWG 3500. * testsuite/std/ranges/adaptors/join.cc (test08): Test it.
2020-11-18[PR97870] LRA: don't remove asm goto, just nullify it.Vladimir N. Makarov1-3/+12
gcc/ 2020-11-18 Vladimir Makarov <vmakarov@redhat.com> PR target/97870 * lra-constraints.c (curr_insn_transform): Do not delete asm goto with wrong constraints. Nullify it saving CFG.
2020-11-18testsuite/libgomp.c/usleep.h: Use sleep-loop also for GCNTobias Burnus1-3/+4
As typically configured, newlib's libc.a does not build 'posix' and, hence, usleep is not available. Thus, use the same fallback as for nvptx. libgomp/ * testsuite/libgomp.c/usleep.h (fallback_usleep): Renamed from nvptx_usleep; use also for device={arch(gcn)}.
2020-11-18Fix PR ada/97859, building ada cross compiler targeting powerpc64le-linux-gnuMatthias Klose1-1/+1
2020-11-18 Matthias Klose <doko@ubuntu.com> PR ada/97859 * Makefile.rtl (powerpc% linux%): Also match powerpc64le cpu.
2020-11-18MSP430: Add 64-bit hardware multiply supportJozef Lawrynowicz3-4/+130
Hardware multipliers that support widening 32-bit multiplication can be used to perform a 64-bit * 64-bit multiplication more efficiently than a software implementation. The following equation is used to perform 64-bit multiplication for devices with "32bit" or "f5series" hardware multiply versions: 64bit_result = (low32_op0 * lop32_op1) + ((low32_op0 * high32_op1) << 32) + ((high32_op0 * low32_op1) << 32) libgcc/ChangeLog: * config/msp430/lib2hw_mul.S (mult64_hw): New. (if MUL_32): Use mult64_hw for __muldi3. (if MUL_F5): Use mult64_hw for __muldi3. * config/msp430/lib2mul.c (__muldi3): New. * config/msp430/t-msp430 (LIB2FUNCS_EXCLUDE): Define.
2020-11-18MSP430: Add mul{hi,si} and {u,}mulsidi3 expandersJozef Lawrynowicz1-5/+56
GCC generates better code when multiplication operations, which require library functions to perform, are caught in early in RTL, rather than leaving the operation to be mapped to a library function later on. When there is hardware multiply support, it is more efficient to perform widening multiplication using the hardware multiplier instead of letting GCC widen the arguments before calling the multiplication routine in the wider mode. gcc/ChangeLog: * config/msp430/msp430.md (mulhi3): New. (mulsi3): New. (mulsidi3): Rename to *mulsidi3_inline. (umulsidi3): Rename to *umulsidi3_inline. (mulsidi3): New define_expand. (umulsidi3): New define_expand.
2020-11-18tree-optimization/97886 - deal with strange LC PHI nodesRichard Biener1-0/+11
This makes vectorization properly assign vector types to PHI nodes that copy from externals on loop exit edges. 2020-11-18 Richard Biener <rguenther@suse.de> PR tree-optimization/97886 * tree-vect-loop.c (vectorizable_lc_phi): Properly assign vector types to invariants for SLP.
2020-11-18d: Fix LHS of array concatentation evaluated before the RHS.Iain Buclaw3-1/+44
In an array append expression: array ~= fun(array); The array in the left hand side of the expression was extended before evaluating the result of the right hand side, which resulted in the newly uninitialized array index being used before set. This fixes that so that the result of the right hand side is always saved in a reusable temporary before assigning to the destination. gcc/d/ChangeLog: PR d/97843 * d-codegen.cc (build_assign): Evaluate TARGET_EXPR before use in the right hand side of an assignment. * expr.cc (ExprVisitor::visit (CatAssignExp *)): Force a TARGET_EXPR on the element to append if it is a CALL_EXPR. gcc/testsuite/ChangeLog: PR d/97843 * gdc.dg/torture/pr97843.d: New test.
2020-11-18d: Fix a couple of ICEs found in the dmd front-end (PR97842)Iain Buclaw9-1/+93
- Segmentation fault on incomplete static if. - Segmentation fault resolving typeof() expression when gagging is on. Reviewed-on: https://github.com/dlang/dmd/pull/11971 gcc/d/ChangeLog: PR d/97842 * dmd/MERGE: Merge upstream dmd b6a779e49
2020-11-18d: Add dragonflybsd support for D compiler and runtimeIain Buclaw6-2/+66
gcc/ChangeLog: * config.gcc (*-*-dragonfly*): Add dragonfly-d.o and t-dragonfly. * config/dragonfly-d.c: New file. * config/t-dragonfly: New file. libphobos/ChangeLog: * configure.tgt: Add *-*-dragonfly* as a supported target. * configure: Regenerate. * m4/druntime/os.m4 (DRUNTIME_OS_SOURCES): Add dragonfly* as a posix target.
2020-11-18libphobos: Merge upstream phobos 7948e0967.Iain Buclaw2-268/+1
Removes deprecated functions from std.string module. Reviewed-on: https://github.com/dlang/phobos/pull/7694 libphobos/ChangeLog: * src/MERGE: Merge upstream phobos 7948e0967.
2020-11-18openmp: Fix ICE on non-rectangular loop with known 0 iterationsJakub Jelinek2-1/+17
The loops in the testcase are non-rectangular and have 0 iterations (the outer loop iterates, but the inner one never). In this case we just have the overall number of iterations computed (0), and don't have factor and other values computed. We never need to map logical iterations to the individual iterations in that case, and we were crashing during expansion of that code. 2020-11-18 Jakub Jelinek <jakub@redhat.com> PR middle-end/97862 * omp-expand.c (expand_omp_for_init_vars): Don't use the sqrt path if number of iterations is constant 0. * c-c++-common/gomp/pr97862.c: New test.
2020-11-18RISC-V: Support version controling for ISA standard extensionsKito Cheng21-88/+393
- New option -misa-spec support: -misa-spec=[2.2|20190608|20191213] and corresponding configuration option --with-isa-spec. - Current default ISA spec set to 2.2, but we intend to bump this to 20191213 or later in next release. gcc/ChangeLog: * common/config/riscv/riscv-common.c (riscv_ext_version): New. (riscv_ext_version_table): Ditto. (get_default_version): Ditto. (riscv_subset_t::implied_p): New field. (riscv_subset_t::riscv_subset_t): Init implied_p. (riscv_subset_list::add): New. (riscv_subset_list::handle_implied_ext): Pass riscv_subset_t instead of separated argument. (riscv_subset_list::to_string): Handle zifencei and zicsr, and omit version if version is unknown. (riscv_subset_list::parsing_subset_version): New argument `ext`, remove default_major_version and default_minor_version, get default version info via get_default_version. (riscv_subset_list::parse_std_ext): Update argument for parsing_subset_version calls. Handle 2.2 ISA spec, always enable zicsr and zifencei, they are included in baseline ISA in that time. (riscv_subset_list::parse_multiletter_ext): Update argument for `parsing_subset_version` and `add` calls. (riscv_subset_list::parse): Adjust argument for riscv_subset_list::handle_implied_ext call. * config.gcc (riscv*-*-*): Handle --with-isa-spec=. * config.in (HAVE_AS_MISA_SPEC): New. (HAVE_AS_MARCH_ZIFENCEI): Ditto. * config/riscv/riscv-opts.h (riscv_isa_spec_class): New. (riscv_isa_spec): Ditto. * config/riscv/riscv.h (HAVE_AS_MISA_SPEC): New. (ASM_SPEC): Pass -misa-spec if gas supported. * config/riscv/riscv.opt (riscv_isa_spec_class) New. * configure.ac (HAVE_AS_MARCH_ZIFENCEI): New test. (HAVE_AS_MISA_SPEC): Ditto. * configure: Regen. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-9.c: New. * gcc.target/riscv/arch-10.c: Ditto. * gcc.target/riscv/arch-11.c: Ditto. * gcc.target/riscv/attribute-6.c: Remove, we don't support G with version anymore. * gcc.target/riscv/attribute-8.c: Reorder arch string to fit canonical ordering. * gcc.target/riscv/attribute-9.c: We don't emit version for unknown extensions now. * gcc.target/riscv/attribute-11.c: Add -misa-spec=2.2 flags. * gcc.target/riscv/attribute-12.c: Ditto. * gcc.target/riscv/attribute-13.c: Ditto. * gcc.target/riscv/attribute-14.c: Ditto. * gcc.target/riscv/attribute-15.c: New. * gcc.target/riscv/attribute-16.c: Ditto. * gcc.target/riscv/attribute-17.c: Ditto.
2020-11-18RISC-V: Support zicsr and zifencei extension for -march.Kito Cheng6-2/+29
- CSR related instructions and fence instructions has to be splitted from baseline ISA, zicsr and zifencei are corresponding sub-extension. gcc/ChangeLog: * common/config/riscv/riscv-common.c (riscv_implied_info): d and f implied zicsr. (riscv_ext_flag_table): Handle zicsr and zifencei. * config/riscv/riscv-opts.h (MASK_ZICSR): New. (MASK_ZIFENCEI): Ditto. (TARGET_ZICSR): Ditto. (TARGET_ZIFENCEI): Ditto. * config/riscv/riscv.md (clear_cache): Check TARGET_ZIFENCEI. (fence_i): Ditto. * config/riscv/riscv.opt (riscv_zi_subext): New. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-8.c: New. * gcc.target/riscv/attribute-14.c: Ditto.
2020-11-18RISC-V: Handle implied extension in canonical ordering.Kito Cheng1-5/+172
- ISA spec has specify the order between multi-letter extensions, implied extension also need to follow store in canonical ordering, so most easy way is we keep that in-order during insertion. gcc/ChangeLog: * common/config/riscv/riscv-common.c (single_letter_subset_rank): New. (multi_letter_subset_rank): Ditto. (subset_cmp): Ditto. (riscv_subset_list::add): Insert subext in canonical ordering. (riscv_subset_list::parse_std_ext): Move handle_implied_ext to ... (riscv_subset_list::parse): ... here.
2020-11-18Clean up loop-closed PHIs after loop finalizeguojiufu6-3/+104
This patch propagates loop-closed PHIs them out at loop_optimizer_finalize. For some cases, to clean up loop-closed PHIs would save efforts of optimization passes after loopdone. Thanks, Jiufu Guo. gcc/ChangeLog: 2020-10-18 Jiufu Guo <guojiufu@linux.ibm.com> * cfgloop.h (loop_optimizer_finalize): Add flag argument. * loop-init.c (loop_optimizer_finalize): Call clean_up_loop_closed_phi. * tree-cfgcleanup.h (clean_up_loop_closed_phi): New declare. * tree-ssa-loop.c (tree_ssa_loop_done): Call loop_optimizer_finalize with flag argument. * tree-ssa-propagate.c (clean_up_loop_closed_phi): New function. gcc/testsuite/ChangeLog: 2020-10-18 Jiufu Guo <guojiufu@linux.ibm.com> * gcc.dg/tree-ssa/loopclosedphi.c: New test.
2020-11-17cmd/go, cmd/cgo: update gofrontend mangling checksIan Lance Taylor8-131/+276
This is a port of two patches in the master repository. https://golang.org/cl/259298 cmd/cgo: split gofrontend mangling checks into cmd/internal/pkgpath This is a step toward porting https://golang.org/cl/219817 from the gofrontend repo to the main repo. Note that this also corrects the implementation of the v2 mangling scheme to use ..u and ..U where appropriate. https://golang.org/cl/259299 cmd/go: use cmd/internal/pkgpath for gccgo pkgpath symbol For golang/go#37272 For golang/go#41862 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/270637
2020-11-18Daily bump.GCC Administrator9-1/+439
2020-11-17libstdc++: Revert changes for SYS_clock_gettime64 [PR 93421]Jonathan Wakely4-28/+70
As discussed in the PR, it's incredibly unlikely that a system that needs to use the SYS_clock_gettime syscall (e.g. glibc 2.16 or older) is going to define the SYS_clock_gettime64 macro. Ancient systems that need to use the syscall aren't going to have time64 support. This reverts the recent changes to try and make clock_gettime syscalls be compatible with systems that have been updated for time64 (those changes were wrong anyway as they misspelled the SYS_clock_gettime64 macro). The changes for futex syscalls are retained, because we still use them on modern systems that might be using time64. To ensure that the clock_gettime syscalls are safe, configure will fail if SYS_clock_gettime is needed, and SYS_clock_gettime64 is also defined (but to a distinct value from SYS_clock_gettime), and the tv_sec member of timespec is larger than long. This means we will be unable to build on a hypothetical system where we need the time32 version of SYS_clock_gettime but where userspace is using a time64 struct timespec. In the unlikely event that this failure is triggered on any real systems, we can fix it later. But we probably won't need to. libstdc++-v3/ChangeLog: PR libstdc++/93421 * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Fail if struct timespec isn't compatible with SYS_clock_gettime. * configure: Regenerate. * src/c++11/chrono.cc: Revert changes for time64 compatibility. Add static_assert instead. * src/c++11/futex.cc (_M_futex_wait_until_steady): Assume SYS_clock_gettime can use struct timespec.
2020-11-17add --with-{cpu,arch,tune}-{32,64} as alias flags for --with-{cpu,arch,tune}Sebastian Pop2-2/+20
gcc/ * config.gcc: add configure flags --with-{cpu,arch,tune}-{32,64} as alias flags for --with-{cpu,arch,tune} on AArch64. * doc/install.texi: Document new flags for aarch64.
2020-11-17add --with-tune configure flagSebastian Pop1-3/+2
fixes a configure error on Arm64 when passing --with-tune=... to configure: ``` This target does not support --with-tune. Valid --with options are: abi cpu arch ``` The missing flag sets target tuning to a different value than generic tuning. gcc/ * config.gcc: Add --with-tune to AArch64 configure flags.
2020-11-17recognize implied ranges for modulo.Andrew MacLeod2-0/+75
implement op1_range for modulo with implied positive and negative ranges. gcc/ PR tree-optimization/91029 * range-op.cc (operator_trunc_mod::op1_range): New. gcc/testsuite/ * gcc.dg/pr91029.c: New.
2020-11-17Fix ipa-icf ICE on variadic typesJan Hubicka1-2/+2
* ipa-icf.c (sem_function::hash_stmt): Fix conditional on variably_modified_type_p.
2020-11-17extend cache_integer_cstNathan Sidwell2-10/+28
This modules-related patch extends cache_integer_cst. Currently, when given a small cst, that cst is added to the type's small and /must not/ already be there. Large values are fine if they are already in the large cache. This adds a parameter to indicate small duplicates are ok, and it returns the cached value -- either what was already tehre, or the newly inserted const. gcc/ * tree.h (cache_integer_cst): Add defaulted might_duplicate parm. * tree.c (cache_integer_cst): Return the integer cst, add might_duplicate parm to permit finding a small duplicate.
2020-11-17c++: duplicate block-scope extern [PR 97877]Nathan Sidwell2-2/+25
We ICED with a duplicated block-scope extern, as duplicate_decls was dropping the decl_lang_specific of olddecl. Simplys adding appropriate retrofitting and copying turned out to be insufficient because you can get a block-scope using decl also matching the extern. The latter seems a little suspicious and I have asked CWG for advice. While there robustified the assert about releasing olddecls' lang-specific -- if it had one, the new decl better have one. PR c++/97877 gcc/cp/ * decl.c (duplicate_decls): Deal with duplicated DECL_LOCAL_DECL_P decls. Extend decl_lang_specific checking assert. gcc/testsuite/ * g++.dg/lookup/pr97877.C: New.
2020-11-17global treesNathan Sidwell2-13/+26
This reorders the common and c++ global tree arrays. It introduces a module-specific High Water Mark, below which are the immutable slots initialized at startup and beyond which are the lazily filled slots (and a few immutables we need to locate by name lookup anyway). gcc/c-family/ * c-common.h (enum c_tree_index): Reorder to place lazy fields after newly-added CTI_MODULE_HWM. gcc/cp/ * cp-tree.h (enum cp_tree_index): Reorder to place lazy fields after newly-added CPTI_MODULE_HWM.
2020-11-17Fortran texi: Fix description of GFC_RTCHECK_* macros.Harald Anlauf1-2/+2
gcc/fortran/ChangeLog: * gfortran.texi: Fix description of GFC_RTCHECK_* to match actual code.
2020-11-17IOR with nonzero, range cannot contain 0.Andrew MacLeod2-0/+22
Remove zero from IOR ranges with non-zero masks. gcc/ PR tree-optimization/83072 * range-op.cc (wi_optimize_and_or): Remove zero from IOR range when mask is non-zero. gcc/testsuite/ * gcc.dg/pr83072.c: New.
2020-11-17C++ : Remove an overzealous checking assert [PR97871]Iain Sandoe1-1/+0
It seems we accept __attribute__(()) without any diagnostic at present, so my added checking assert fires for something like: __attribute__ (()) int a; Fixed by removing the assert; in the case that the user enters something like: __attribute__ (()) extern "C" int foo; The diagnostic about attributes before linkage specs will fire and show the empty attributes. gcc/cp/ChangeLog: PR c++/97871 * parser.c (cp_parser_declaration): Remove checking assert.
2020-11-17float.h: Handle C2x __STDC_WANT_IEC_60559_EXT__Joseph Myers2-1/+16
TS 18661-1 and 18661-2 have various definitions conditional on __STDC_WANT_IEC_60559_BFP_EXT__ and __STDC_WANT_IEC_60559_DFP_EXT__ macros. When those TSes were integrated into C2x, most of the feature test macro conditionals were removed (with declarations for decimal FP becoming conditional only on whether decimal FP is supported by the implementation and those for binary FP becoming unconditionally required). A few tests of those feature test macros remained for declarations that appeared only in Annex F and not in the main part of the standard. A change accepted for C2x at the last WG14 meeting (but not yet added to the working draft in git) was to replace both those macros by __STDC_WANT_IEC_60559_EXT__; if __STDC_WANT_IEC_60559_EXT__ is defined, the specific declarations in the headers will then depend on which features are supported by the implementation, as for declarations not controlled by a feature test macro at all. Thus, add a check of __STDC_WANT_IEC_60559_EXT__ for CR_DECIMAL_DIG in float.h, the only case of this change relevant to GCC. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * ginclude/float.h (CR_DECIMAL_DIG): Also define for [__STDC_WANT_IEC_60559_EXT__]. gcc/testsuite/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * gcc.dg/cr-decimal-dig-3.c: New test.
2020-11-17float.h: C2x *_IS_IEC_60559 macrosJoseph Myers4-0/+69
C2x adds float.h macros that say whether float, double and long double match an IEC 60559 (IEEE 754) format and operations. Add these macros to GCC's float.h. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c-family/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * c-cppbuiltin.c (builtin_define_float_constants): Define "*_IS_IEC_60559__" macros. gcc/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * ginclude/float.h [__STDC_VERSION__ > 201710L] (FLT_IS_IEC_60559, DBL_IS_IEC_60559, LDBL_IS_IEC_60559): New macros. gcc/testsuite/ 2020-11-17 Joseph Myers <joseph@codesourcery.com> * gcc.dg/c11-float-6.c, gcc.dg/c2x-float-10.c: New tests.
2020-11-17testsuite: allow opd sectionDavid Edelsohn1-1/+1
PPC64 Linux ELFv1 uses function descriptors with the descriptor placed in the .opd section. This patch expands the pattern in the testcase to accept .opd section name associated with the function name. gcc/testsuite/ChangeLog: * gcc.dg/pr25376.c: Allow .opd section.
2020-11-17preprocessor: new callbacksNathan Sidwell1-0/+8
These two callbacks are needed for C++ modules. The first is for handling macros from header-units. These are resolved lazily. The second is for include-translation -- whether a #include gets turned into a header-unit import. libcpp/ * include/cpplib.h (struct cpp_callbacks): Add user_deferred_macro & translate_include.
2020-11-17libstdc++: Fix unconditional definition of __cpp_lib_span in <version> [PR ↵Jonathan Wakely2-1/+6
97869} The <span> header is empty unless Concepts are supported, but <version> defines the __cpp_lib_span feature test macro unconditionally. It should be guarded by the same conditions as in <span>. libstdc++-v3/ChangeLog: PR libstdc++/97869 * include/precompiled/stdc++.h: Include <coroutine>. * include/std/version (__cpp_lib_span): Check __cpp_lib_concepts before defining.
2020-11-17preprocessor: module line mapsNathan Sidwell3-41/+150
This patch adds LC_MODULE as a map kind, used to indicate a c++ module. Unlike a regular source file, it only contains a single location, and the source locations in that module are represented by ordinary locations whose 'included_from' location is the module. It also exposes some entry points that modules will use to create blocks of line maps. In the original posting, I'd missed the deletion of the linemap_enter_macro from internal.h. That's included here. libcpp/ * include/line-map.h (enum lc_reason): Add LC_MODULE. (MAP_MODULE_P): New. (line_map_new_raw): Declare. (linemap_enter_macro): Move declaration from internal.h (linemap_module_loc, linemap_module_reparent) (linemap_module_restore): Declare. (linemap_lookup_macro_indec): Declare. * internal.h (linemap_enter_macro): Moved to line-map.h. * line-map.c (linemap_new_raw): New, broken out of ... (new_linemap): ... here. Call it. (LAST_SOURCE_LINE_LOCATION): New. (liemap_module_loc, linemap_module_reparent) (linemap_module_restore): New. (linemap_lookup_macro_index): New, broken out of ... (linemap_macro_map_lookup): ... here. Call it. (linemap_dump): Add module dump.
2020-11-17Add MODE_OPAQUEAaron Sawdey13-2/+63
After discussion with Richard Sandiford on IRC, he suggested adding a new mode class MODE_OPAQUE to deal with the problems (PR 96791) we had been having with POImode/PXImode in powerpc target. This patch is the accumulation of changes I needed to make to add this and make it useable for the purposes of what power10 MMA needed. MODE_OPAQUE modes allow you to have modes for which you can just define loads and stores. By design, optimization does not expect to know how to do arithmetic or subregs on these modes. This allows us to have modes for multi-register vector operations where we don't want to open Pandora's Box and define general arithmetic operations. This patch will be followed by a target specific patch to change the powerpc power10 MMA builtins to use opaque modes, and will also let use use the vector pair loads/stores defined with that in the inline expansion of memcpy/memmove, allowing me to fix PR 96791. gcc/ChangeLog PR target/96791 * mode-classes.def: Add MODE_OPAQUE. * machmode.def: Add OPAQUE_MODE. * tree.def: Add OPAQUE_TYPE for types that will use MODE_OPAQUE. * doc/generic.texi: Document OPAQUE_TYPE. * doc/rtl.texi: Document MODE_OPAQUE. * machmode.h: Add OPAQUE_MODE_P(). * genmodes.c (complete_mode): Add MODE_OPAQUE. (opaque_mode): New function. * tree.c (tree_code_size): Add OPAQUE_TYPE. * tree.h: Add OPAQUE_TYPE_P(). * stor-layout.c (int_mode_for_mode): Treat MODE_OPAQUE modes like BLKmode. * ira.c (find_moveable_pseudos): Treat MODE_OPAQUE modes more like integer/float modes here. * dbxout.c (dbxout_type): Treat OPAQUE_TYPE like VOID_TYPE. * tree-pretty-print.c (dump_generic_node): Treat OPAQUE_TYPE like like other types.
2020-11-17libstdc++: Fix ranges::search_n for random access iterators [PR97828]Patrick Palka2-1/+61
My ranges transcription of the std::search_n implementation for random access iterators missed a crucial part of the algorithm which the existing tests didn't exercise. When __remainder is less than __count at the start of an iteration of the outer while loop, it means we're continuing a partial match of __count - __remainder elements from the previous iteration. If at the end of the iteration we don't complete this partial match, we need to reset __remainder so that it's only offset by the size of the most recent partial match before starting the next iteration. This patch fixes this appropriately, mirroring how it's done in the corresponding std::search_n implementation. libstdc++-v3/ChangeLog: PR libstdc++/97828 * include/bits/ranges_algo.h (__search_n_fn::operator()): Check random_access_iterator before using the backtracking implementation. When the backwards scan fails prematurely, reset __remainder appropriately. * testsuite/25_algorithms/search_n/97828.cc: New test.
2020-11-17preprocessor: Fix profiled bootstrap warning [pr97858]Nathan Sidwell1-15/+5
As Jakub points out, we only ever pass a single variadic parm (if at all), so just an optional arg is fine. PR preprocessor/97858 libcpp/ * mkdeps.c (munge): Drop varadic args, we only ever use one.
2020-11-17Improve handling of memory operands in ipa-icf 3/4Jan Hubicka2-5/+76
this patch is based on Maritn's patch https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02633.html however based on new code that track and compare memory accesses so it can be implemented correctly. As shown here https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558773.html the most common reason for function body being streamed in but merging to fail is the mismatch in base alias set. This patch collect base and ref types ao_alias_ptr types, stream them to WPA and at WPA time hash is produced. Now we can use alias_sets since these these are assumed to be same as ltrans time alias sets. This is currently not always true - but that is pre-existing issue. I will try to produce a testcase and make followup patch on this (that will stream out ODR types with TYPE_CANONICAL that is !ODR as !ODR type). However for this patch this is not a problem since the real alias sets are finer but definitly not coarser. We may make it possible to use canonical type hash and save some streaming, but I think it would be better to wait for next stage1 since it is not completely trivial WRT ODR types: either we hash ODR type names and then hash values would be too coarse for cases we got conflict betwen C and C++ type or we do not stream and will again get into trouble with hash values being too weak. Tried that - we get a lot of types that are struturally same but distinguished by ODR names (from template instantiations). As followup I will add code for merging with mismatched base alias sets. This makes the aforementioned problem about ODR names less pronounced but it is still present on pointer loads/stores which requires REF alias set mismatches. 2020-11-13 Jan Hubicka <hubicka@ucw.cz> Martin Liska <mliska@suse.cz> * ipa-icf.c: Include data-streamer.h and alias.h. (sem_function::sem_function): Initialize memory_access_types and m_alias_sets_hash. (sem_function::hash_stmt): For memory accesses and when going to do lto streaming add base and ref types into memory_access_types. (sem_item_optimizer::write_summary): Stream memory access types. (sem_item_optimizer::read_section): Likewise and also iniitalize m_alias_sets_hash. (sem_item_optimizer::execute): Call sem_item_optimizer::update_hash_by_memory_access_type. (sem_item_optimizer::update_hash_by_memory_access_type): Updat. * ipa-icf.h (sem_function): Add memory_access_types and m_alias_sets_hash.
2020-11-17Make ltrans type canonicals compatible with WPA onesJan Hubicka4-5/+10
This patch fixes profiledbootstrap failure with LTO enabled. Not refining alias sets from WPA to ltrans time is a good invariant to maintain and the canonical type hash behaves this way. However I broke this with the ODR logic. Normally we define canonical types for C++ ODR types according to their type names. However to make ODR types compatible with C types we check if structurally equivalent C type exists and if so, we ignore ODR names giving up on the precision. This however is not stable between WPA and ltrans since at ltrans the type merging does not see as many types as WPA does. To make this consistent the patch makes WPA ODR_TYPE_P == 0 for ODR types that conflicted with non-ODR type. I had to drop one sanity check in ipa-utils.h (that I think is not very important - I added it while introducing CXX_ODR_P machinery) and also it now may happen that we query odr_based_tbaa_p before registering first ODR type so we do not want to ICE here. ODR type registration happens early to produce ODR violation warings. Those are not done at ltrans, so dropping the registration is safe. The type will still be added while computing the type inheritance graph if needed for devirtualization (and late devirtualization is not very useful anyway since it won't enable inlining). gcc/ChangeLog: PR bootstrap/97857 * ipa-devirt.c (odr_based_tbaa_p): Do not ICE when odr_hash is not initialized * ipa-utils.h (type_with_linkage_p): Do not sanity check CXX_ODR_P. * tree-streamer-out.c (pack_ts_type_common_value_fields): Set CXX_ODR_P according to the canonical type. gcc/lto/ChangeLog: PR bootstrap/97857 * lto-common.c (gimple_register_canonical_type_1): Only register types with TYPE_CXX_ODR_P flag; sanity check that no conflict happens at ltrans time.
2020-11-17langhooks: preprocessor hooks for c++ modulesNathan Sidwell5-13/+94
This is a slightly modified version of 01-langhooks.def. I realized I didn't need the deferred macro langhook -- that can be directly installed into the preprocessor callbacks via preprocess_options lang hook. gcc/ * langhooks-def.h (LANG_HOOKS_PREPROCESS_MAIN_FILE) (LANG_HOOKS_PREPROCESS_OPTIONS, LANG_HOOKS_PREPROCESS_UNDEF) (LANG_HOOKS_PREPROCESS_TOKEN): New. (LANG_HOOKS_INITIALIZER): Add them. * langhooks.h (struct lang_hooks): Add preprocess_main_file, preprocess_options, preprocess_undef, preprocess_token hooks. Add enum PT_flags. gcc/c-family/ * c-lex.c: #include "langhooks.h". (cb_undef): Maybe call preprocess_undef lang hook. * c-opts.c (c_common_post_options): Maybe call preprocess_options lang hook. (push_command_line_include): Maybe call preprocess_main_file lang hook. (cb_file_change): Likewise. * c-ppoutput.c: #include "langhooks.h. (scan_translation_unit): Maybe call preprocess_token lang hook. (class do_streamer): New, derive from token_streamer. (directives_only_cb): Data pointer is do_streamer, call preprocess_token lang hook. (scan_translation_unit_directives_only): Use do_streamer. (print_line_1): Move src_line recording to after string output. (cb_undef): Maybe call preprocess_undef lang hook.
2020-11-17c-family: token streamerNathan Sidwell1-107/+5
This is broken out of modules patch 01-langhooks.diff, I realized that this part is independent, and removes some duplicated code -- migrated to the token_streamer class. gcc/c-family/ * c-ppoutput.c (scan_translation_unit): Use token_streamer, remove code duplicating that functionality.
2020-11-17x86: Add a testcase for PR target/31799H.J. Lu1-0/+12
Add a testcase for PR target/31799 which was fixed by commit 4f0473fe89e68bf7c09542ee5c3684da25a5b435 Author: Uros Bizjak <ubizjak@gmail.com> Date: Fri May 12 21:04:05 2017 +0200 compare-elim.c (try_eliminate_compare): Canonicalize operation with embedded compare to [(set (reg:CCM) (compare:CCM... * compare-elim.c (try_eliminate_compare): Canonicalize operation with embedded compare to [(set (reg:CCM) (compare:CCM (operation) (immediate))) (set (reg) (operation)]. * config/i386/i386.c (TARGET_FLAGS_REGNUM): New define. in GCC 8. PR target/31799 * gcc.target/i386/pr31799.c: New test.
2020-11-17aarch64: Remove XFAILs for two SVE testsRichard Sandiford2-5/+2
These tests started passing a while ago, so remove the XFAILs. gcc/testsuite/ * gcc.target/aarch64/sve/cond_cnot_1.c: Remove XFAIL. * gcc.target/aarch64/sve/cond_unary_1.c: Likewise.
2020-11-17PR97693: Specify required vectype in vectorizable_callRichard Sandiford2-1/+17
The vectorizable_call part of r11-1143 dropped the required vectype when moving from vect_get_vec_def_for_operand to vect_get_vec_defs_for_operand. This caused an ICE on the testcase for SVE, because we ended up with a non-predicate value being passed to a predicate input. AFAICT this was the only instance of that happening. The types seemed to get carried forward for all the other converted calls. gcc/ PR tree-optimization/97693 * tree-vect-stmts.c (vectorizable_call): Pass the required vectype to vect_get_vec_defs_for_operand. gcc/testsuite/ PR tree-optimization/97693 * gcc.dg/vect/pr97693.c: New test.
2020-11-17testsuite: Add a vect_load_lanes guardRichard Sandiford1-1/+1
We still fall back to load/store-lanes for slp-46.c, if the target supports it. gcc/testsuite/ * gcc.dg/vect/slp-46.c: XFAIL test for SLP on vect_load_lanes targets.
2020-11-17testsuite: Add a vect_element_align_preferred guardRichard Sandiford1-1/+1
We don't try to increase the alignment of decls if vect_element_align_preferred. gcc/testsuite/ * gcc.dg/vect/aligned-section-anchors-nest-1.c: XFAIL alignment test if vect_element_align_preferred.