aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-09-20Support 64-bit vectorization for single-precision floating rounding operation.liuhongt2-0/+231
Here's list the patch supported. rint/nearbyint/ceil/floor/trunc/lrint/lceil/lfloor/round/lround. gcc/ChangeLog: PR target/106910 * config/i386/mmx.md (nearbyintv2sf2): New expander. (rintv2sf2): Ditto. (ceilv2sf2): Ditto. (lceilv2sfv2si2): Ditto. (floorv2sf2): Ditto. (lfloorv2sfv2si2): Ditto. (btruncv2sf2): Ditto. (lrintv2sfv2si2): Ditto. (roundv2sf2): Ditto. (lroundv2sfv2si2): Ditto. (*mmx_roundv2sf2): New define_insn. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106910-1.c: New test.
2022-09-20middle-end: handle bitop with an invariant induction.[PR105735]konglin13-10/+199
Enhance final_value_replacement_loop to handle bitop with an invariant induction. This patch will enable below optimization: { - long unsigned int bit; - - <bb 2> [local count: 32534376]: - - <bb 3> [local count: 1041207449]: - # tmp_10 = PHI <tmp_7(5), tmp_4(D)(2)> - # bit_12 = PHI <bit_8(5), 0(2)> - tmp_7 = bit2_6(D) & tmp_10; - bit_8 = bit_12 + 1; - if (bit_8 != 32) - goto <bb 5>; [96.97%] - else - goto <bb 4>; [3.03%] - - <bb 5> [local count: 1009658865]: - goto <bb 3>; [100.00%] - - <bb 4> [local count: 32534376]: - # tmp_11 = PHI <tmp_7(3)> - return tmp_11; + tmp_11 = tmp_4 (D) & bit2_6 (D); + return tmp_11; } gcc/ChangeLog: PR middle-end/105735 * tree-scalar-evolution.cc (analyze_and_compute_bitop_with_inv_effect): New function. (final_value_replacement_loop): Enhanced to handle bitop with inv induction. gcc/testsuite/ChangeLog: * gcc.target/i386/pr105735-1.c: New test. * gcc.target/i386/pr105735-2.c: New test.
2022-09-20LoongArch: Prepare static PIE supportXi Ruoyao1-2/+4
Static PIE allows us to extend the ASLR to cover static executables and it's not too difficult to support it. On GCC side, we just pass a group of options to the linker, like other ports with static PIE support. The real implementation of static PIE (rcrt1.o) will be added into Glibc later. gcc/ChangeLog: * config/loongarch/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): For -static-pie, pass -static -pie --no-dynamic-linker -z text to the linker, and do not pass --dynamic-linker.
2022-09-20frange: flush denormals to zeroAldy Hernandez2-0/+24
For some architectures (or for -funsafe-math-optimizations) we may flush denormals to zero, in which case we need to be careful to extend the ranges to the appropriate zero. This patch does exactly that. For a range of [x, -DENORMAL] we flush to [x, -0.0] and for [+DENORMAL, x] we flush to [+0.0, x]. gcc/ChangeLog: * value-range.cc (frange::flush_denormals_to_zero): New. (frange::set): Call flush_denormals_to_zero. * value-range.h (class frange): Add flush_denormals_to_zero.
2022-09-20Adjust issue_rate for latest Intel processors.liuhongt1-0/+14
For Skylake based processor, decoder is 4-way. For Sunny Cove and Willow Cove, decoder is 5-way. For Golden cove, decoder is 6-way. gcc/ChangeLog: * config/i386/x86-tune-sched.cc (ix86_issue_rate): Adjust for latest Intel processors.
2022-09-20i386: Fixed vec_init_dup_v16bf [PR106887]konglin12-7/+112
gcc/ChangeLog: PR target/106887 * config/i386/i386-expand.cc (ix86_expand_vector_init_duplicate): Fixed V16BF mode case. gcc/testsuite/ChangeLog: PR target/106887 * gcc.target/i386/vect-bfloat16-2c.c: New test.
2022-09-20Daily bump.GCC Administrator5-1/+29
2022-09-19c: Stray inform note with -Waddress [PR106947]Marek Polacek2-9/+32
A trivial fix for maybe_warn_for_null_address where we print an inform note without first checking the return value of a warning call. PR c/106947 gcc/c/ChangeLog: * c-typeck.cc (maybe_warn_for_null_address): Don't emit stray notes. gcc/testsuite/ChangeLog: * c-c++-common/Waddress-7.c: New test.
2022-09-19Fortran: add IEEE_MODES_TYPE, IEEE_GET_MODES and IEEE_SET_MODESFrancois-Xavier Coudert1-0/+95
The IEEE_MODES_TYPE type and the two functions that get and set it were added in Fortran 2018. They can be implemented using the already existing target-specific functions. A future optimization could, on some targets, set/get all modes through one or two instructions only, but that would need a new set of functions in all config/fpu-* files. 2022-09-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> libgfortran/ * ieee/ieee_exceptions.F90: Add IEEE_MODES_TYPE, IEEE_GET_MODES and IEEE_SET_MODES. * ieee/ieee_arithmetic.F90: Make them public in IEEE_ARITHMETIC as well. gcc/testsuite/ * gfortran.dg/ieee/modes_1.f90: New test.
2022-09-19Improve sorry message for -fzero-call-used-regsTorbjörn SVENSSON1-2/+15
When the -fzero-call-used-regs command line option is used with an unsupported value, indicate that it's a value problem instead of an option problem. Without the patch, the error is: In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target 10 | } | ^ With the patch, the error would be like this: In file included from gcc/testsuite/c-c++-common/zero-scratch-regs-8.c:5: gcc/testsuite/c-c++-common/zero-scratch-regs-1.c: In function 'foo': gcc/testsuite/c-c++-common/zero-scratch-regs-1.c:10:1: sorry, unimplemented: argument 'all-arg' is not supported for '-fzero-call-used-regs' on this target 10 | } | ^ 2022-09-19 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> gcc/ChangeLog: * targhooks.cc (default_zero_call_used_regs): Improve sorry message. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-09-19Fortran: F2018 rounding modes changesFrancois-Xavier Coudert2-0/+21
Add the new IEEE_AWAY rounding mode. It is unsupported on all known targets, but could be supported by glibc and AIX as part of the C2x proposal. Testing for now is minimal. Add the optional RADIX argument to IEEE_SET_ROUNDING_MODE and IEEE_GET_ROUNDING_MODE. It is unused for now, because we do not support radices other than 2. 2022-08-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> gcc/fortran/ * libgfortran.h: Declare GFC_FPE_AWAY. gcc/testsuite/ * gfortran.dg/ieee/rounding_2.f90: New test. libgfortran/ * ieee/ieee_arithmetic.F90: Add RADIX argument to IEEE_SET_ROUNDING_MODE and IEEE_GET_ROUNDING_MODE. * config/fpu-387.h: Add IEEE_AWAY mode. * config/fpu-aarch64.h: Add IEEE_AWAY mode. * config/fpu-aix.h: Add IEEE_AWAY mode. * config/fpu-generic.h: Add IEEE_AWAY mode. * config/fpu-glibc.h: Add IEEE_AWAY mode. * config/fpu-sysv.h: Add IEEE_AWAY mode.
2022-09-19Daily bump.GCC Administrator3-1/+77
2022-09-18OpenMP: Push attaches to end of clause list in "target" regionsJulian Brown2-2/+37
This patch moves GOMP_MAP_ATTACH{_ZERO_LENGTH_ARRAY_SECTION} nodes to the end of the clause list, for offload regions. This ensures that when we do the attach operation, both the "attachment point" and the target region have both already been mapped on the target. This avoids a pathological case that can otherwise happen with struct sibling-list handling. This version of the patch moves the attach-node motion to gimplify_adjust_omp_clauses. 2022-09-15 Julian Brown <julian@codesourcery.com> gcc/ * gimplify.cc (omp_segregate_mapping_groups): Update comment. (gimplify_adjust_omp_clauses): Move ATTACH and ATTACH_ZERO_LENGTH_ARRAY_SECTION nodes to the end of the clause list for offloaded OpenMP regions. gcc/testsuite/ * g++.dg/gomp/target-lambda-1.C: Adjust expected scan output.
2022-09-18RISC-V: Don't try to vectorize tree-ssa/gen-vect-34.cPalmer Dabbelt1-1/+1
We don't yet support vectorization on RISC-V. gcc/testsuite/ChangeLog * gcc.dg/tree-ssa/gen-vect-34.c: Skip RISC-V targets.
2022-09-18[PR106831] Avoid propagating long doubles that may have multiple ↵Jakub Jelinek1-0/+15
representations. Long doubles are tricky when it comes to considering singletons because small numbers and +-INF can have multiple representations for the same number. So we need to be very careful not to treat those as singletons, lest they be incorrectly propagated by VRP. This is similar to the -0.0 and +0.0 duality. In long doubles +INF can be represented with +INF in the MSB and either -0.0 or +0.0 in the LSB. Similarly for numbers that are exactly representable in DF. For example, 1.0 can be represented as either (1.0, +0.0) or (1.0, -0.0). This patch avoids treating these numbers as singletons. Note that NANs in long double format have a LSB of don't care, but this is irrelevant for singleton_p, because NANs are never considered singletons. Also, internally in the frange we store NANs as a pair of boolean flags indicating whether they are +NAN or -NAN, so we don't need any special treatment here for comparing range equality etc. We never see anything but the boolean flags. PR middle-end/106831 gcc/ChangeLog: * value-range.cc (frange::singleton_p): Avoid propagating long doubles that may have multiple representations.
2022-09-18Rewrite NAN and sign handling in frangeAldy Hernandez9-485/+481
The attatched patch rewrites the NAN and sign handling, dropping both tristates in favor of a pair of boolean flags for NANs, and nothing at all for signs. The signs are tracked in the range itself, so now it's possible to describe things like [-0.0, +0.0] +NAN, [+0, +0], [-5, +0], [+0, 3] -NAN, etc. Here is an example of the various ranges and how they are displayed: [frange] float VARYING NAN ;; Varying includes NAN [frange] UNDEFINED ;; Empty set as always [frange] float [] +-NAN ;; Unknown sign NAN [frange] float [] -NAN ;; -NAN [frange] float [] +NAN ;; +NAN [frange] float [-0.0, 0.0] ;; All zeros. [frange] float [-0.0, -0.0] +-NAN ;; -0 or NAN. [frange] float [-5.0e+0, -1.0e+0] +NAN ;; [-5, -1] or +NAN [frange] float [-5.0e+0, -0.0] +-NAN ;; [-5, -0] or NAN [frange] float [-5.0e+0, -0.0] ;; [-5, -0] [frange] float [5.0e+0, 1.0e+1] ;; [5, 10] Notice the NAN signs are decoupled from the range, so we can represent a negative range with a positive NAN. For this range, frange::signbit_p() would return false, as only when the signs of the NANs and range agree can we be certain. There is no longer any pessimization of ranges for intersects involving NANs. Also, union and intersect work with signed zeros: // [-0, x] U [+0, x] => [-0, x] // [ x, -0] U [ x, +0] => [ x, +0] // [-0, x] ^ [+0, x] => [+0, x] // [ x, -0] ^ [ x, +0] => [ x, -0] The special casing for signed zeros in the singleton code is gone in favor of just making sure the signs in the range agree, that is [-0, -0] for example. I have removed the idea that a known NAN is a "range", so a NAN is no longer in the endpoints itself. Requesting the bound of a known NAN is a hard fail. For that matter, we don't store the actual NAN in the range. The only information we have are the set of boolean flags. This way we make sure nothing seeps into the frange. This also means it's explicit that we don't track anything but the sign in NANs. We can revisit this if we desire to track signalling or whatever concoction y'all can imagine. Regstrapped with mpfr tests on x86-64 and ppc64le Linux. Selftests were also run with -ffinite-math-only on x86-64. At Jakub's suggestion, I built lapack with associated tests. They pass on x86-64 and ppc64le Linux with no regressions from mainline. As a sanity check, I also ran them for -ffinite-math-only on x86 which (as expected) returned: NaN arithmetic did not perform per the ieee spec Otherwise, all tests pass for -ffinite-math-only. gcc/ChangeLog: * range-op-float.cc (frange_add_zeros): Replace set_signbit with union of zero. * value-query.cc (range_query::get_tree_range): Remove set_signbit use. * value-range-pretty-print.cc (vrange_printer::print_frange_prop): Remove. (vrange_printer::print_frange_nan): New. * value-range-pretty-print.h (print_frange_prop): Remove. (print_frange_nan): New. * value-range-storage.cc (frange_storage_slot::set_frange): Set kind and NAN fields. (frange_storage_slot::get_frange): Restore kind and NAN fields. * value-range-storage.h (class frange_storage_slot): Add kind and NAN fields. * value-range.cc (frange::update_nan): Remove. (frange::set_signbit): Remove. (frange::set): Adjust for NAN fields. (frange::normalize_kind): Remove m_props. (frange::combine_zeros): New. (frange::union_nans): New. (frange::union_): Handle new NAN fields. (frange::intersect_nans): New. (frange::intersect): Handle new NAN fields. (frange::operator=): Same. (frange::operator==): Same. (frange::contains_p): Same. (frange::singleton_p): Remove special case for signed zeros. (frange::verify_range): Adjust for new NAN fields. (frange::set_zero): Handle signed zeros. (frange::set_nonnegative): Same. (range_tests_nan): Adjust tests. (range_tests_signed_zeros): Same. (range_tests_signbit): Same. (range_tests_floats): Same. * value-range.h (class fp_prop): Remove. (FP_PROP_ACCESSOR): Remove. (class frange_props): Remove (frange::lower_bound): NANs don't have endpoints. (frange::upper_bound): Same. (frange_props::operator==): Remove. (frange_props::union_): Remove. (frange_props::intersect): Remove. (frange::update_nan): New. (frange::clear_nan): New. (frange::undefined_p): New. (frange::set_nan): New. (frange::known_finite): Adjust for new NAN representation. (frange::maybe_isnan): Same. (frange::known_isnan): Same. (frange::signbit_p): Same. * gimple-range-fold.cc (range_of_builtin_int_call): Rename known_signbit_p into signbit_p.
2022-09-18Daily bump.GCC Administrator4-1/+31
2022-09-18Force qualification of type names while bootstrapping.Gaius Mulley42-7759/+7827
Force qualification of types generated by mc during bootstrap. Also remove ACX_NONCANONICAL_HOST and ACX_NONCANONICAL_TARGET from configure.ac. gcc/m2/ChangeLog: * configure: Rebuilt. * configure.ac (ACX_NONCANONICAL_HOST): Removed. (ACX_NONCANONICAL_TARGET) Removed. * mc/decl.mod (forceQualified): New constant. (isQualifiedForced) New procedure function. (getFQstring) check isQualifiedForced. (getFQDstring) check isQualifiedForced. * mc-boot/GArgs.c: Rebuilt. * mc-boot/GCmdArgs.c: Rebuilt. * mc-boot/GDebug.c: Rebuilt. * mc-boot/GDynamicStrings.c: Rebuilt. * mc-boot/GEnvironment.c: Rebuilt. * mc-boot/GFIO.c: Rebuilt. * mc-boot/GFpuIO.c: Rebuilt. * mc-boot/GIO.c: Rebuilt. * mc-boot/GIndexing.c: Rebuilt. * mc-boot/GM2Dependent.c: Rebuilt. * mc-boot/GM2RTS.c: Rebuilt. * mc-boot/GMemUtils.c: Rebuilt. * mc-boot/GNumberIO.c: Rebuilt. * mc-boot/GPushBackInput.c: Rebuilt. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GRTint.c: Rebuilt. * mc-boot/GSArgs.c: Rebuilt. * mc-boot/GStdIO.c: Rebuilt. * mc-boot/GTimeString.c: Rebuilt. * mc-boot/Galists.c: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Glists.c: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcComp.c: Rebuilt. * mc-boot/GmcError.c: Rebuilt. * mc-boot/GmcLexBuf.c: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcPretty.c: Rebuilt. * mc-boot/GmcStack.c: Rebuilt. * mc-boot/GmcStream.c: Rebuilt. * mc-boot/Gmcp1.c: Rebuilt. * mc-boot/Gmcp2.c: Rebuilt. * mc-boot/Gmcp3.c: Rebuilt. * mc-boot/Gmcp4.c: Rebuilt. * mc-boot/Gmcp5.c: Rebuilt. * mc-boot/GnameKey.c: Rebuilt. * mc-boot/GsymbolKey.c: Rebuilt. * mc-boot/Gvarargs.c: Rebuilt. * mc-boot/Gwlists.c: Rebuilt. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-09-17Remove unused parameter warning via introducing attribute unused.Gaius Mulley92-480/+885
Introduce attribute unused into the grammar of gm2 and mc. Emit attribute ((unused)) during parameters if specified. Removes many unused warnings when building gm2 under bootstrap (specifically used during generic walk procedures in M2GCCDeclare.mod). gcc/m2/ChangeLog: * gm2-compiler/M2AsmUtil.mod (UnderScoreString): Removed. * gm2-compiler/M2GCCDeclare.mod (DeclareStringConstant): delete variable location and remove passing it to any procedure. (PromoteToString) remove variable location and remove it from all usage. (TryDeclareConst) remove tokenno. (DeclareConst): remove tokenno. * gm2-compiler/M2GenGCC.mod (CodeStatement): Remove first parameter for CodeInitStart and CodeFinallyStart. (BuildTreeFromInterface): Remove location variable as BuildStringConstant no longer has this parameter. (CodeInitStart): Remove the unused first parameter. (CodeFinallyStart): Remove the unused first parameter. (CodeAddr): Remove location variable as BuildStringConstant no longer has this parameter. * gm2-compiler/M2LexBuf.mod (stop): Removed. * gm2-compiler/M2Options.def (m2linemap): Import list replaced identifier GetSaveTempsDir. * gm2-compiler/M2Options.mod (DynamicStrings): Import list replaced identifiers GenModuleListFlag and SaveTempsDir. (SetSaveTempsDir) copy directory string. (GetSaveTempsDir) New procedure function. * gm2-compiler/M2Range.mod (BuildStringParamLoc): Remove location variable as it is no longer needed by BuildStringConstant. * gm2-compiler/P0SyntaxCheck.bnf: Extend grammar to allow attribute unused in parameters. * gm2-compiler/P1Build.bnf: Extend grammar to allow attribute unused in parameters. * gm2-compiler/P2Build.bnf (NameKey): Imported. (MetaErrorT1) Imported. Extend grammar to allow attribute unused in parameters and also check attribute contents for usused and noreturn. * gm2-compiler/P3Build.bnf: Extend grammar to allow attribute unused in parameters. * gm2-compiler/PCBuild.bnf: Extend grammar to allow attribute unused in parameters. * gm2-compiler/PHBuild.bnf: Extend grammar to allow attribute unused in parameters. * gm2-compiler/SymbolTable.mod (GetOuterModule): Remove function procedure. * gm2-gcc/m2decl.cc (BuildStringConstant): Remove unused location parameter. * gm2-gcc/m2decl.def (BuildStringConstant): Remove unused location parameter. * gm2-gcc/m2decl.h (BuildStringConstant): Remove unused location parameter. * m2/gm2-lang.cc: Tidy up comments. * m2/m2-tree.def: Tidy up comments. * m2/m2-tree.h: Tidy up comments. * m2/m2pp.cc: Tidy up comments. * m2/m2pp.h: Tidy up comments. * mc-boot/GASCII.c: Rebuilt. * mc-boot/GArgs.c: Rebuilt. * mc-boot/GAssertion.c: Rebuilt. * mc-boot/GBreak.c: Rebuilt. * mc-boot/GCmdArgs.c: Rebuilt. * mc-boot/GDebug.c: Rebuilt. * mc-boot/GDynamicStrings.c: Rebuilt. * mc-boot/GEnvironment.c: Rebuilt. * mc-boot/GFIO.c: Rebuilt. * mc-boot/GFormatStrings.c: Rebuilt. * mc-boot/GFpuIO.c: Rebuilt. * mc-boot/GIO.c: Rebuilt. * mc-boot/GIndexing.c: Rebuilt. * mc-boot/GM2Dependent.c: Rebuilt. * mc-boot/GM2EXCEPTION.c: Rebuilt. * mc-boot/GM2RTS.c: Rebuilt. * mc-boot/GMemUtils.c: Rebuilt. * mc-boot/GNumberIO.c: Rebuilt. * mc-boot/GPushBackInput.c: Rebuilt. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GRTint.c: Rebuilt. * mc-boot/GSArgs.c: Rebuilt. * mc-boot/GSFIO.c: Rebuilt. * mc-boot/GStdIO.c: Rebuilt. * mc-boot/GStorage.c: Rebuilt. * mc-boot/GStrCase.c: Rebuilt. * mc-boot/GStrIO.c: Rebuilt. * mc-boot/GStrLib.c: Rebuilt. * mc-boot/GStringConvert.c: Rebuilt. * mc-boot/GSysStorage.c: Rebuilt. * mc-boot/GTimeString.c: Rebuilt. * mc-boot/Galists.c: Rebuilt. * mc-boot/Gdecl.h: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Glists.c: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcComp.c: Rebuilt. * mc-boot/GmcDebug.c: Rebuilt. * mc-boot/GmcError.c: Rebuilt. * mc-boot/GmcFileName.c: Rebuilt. * mc-boot/GmcLexBuf.c: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcPreprocess.c: Rebuilt. * mc-boot/GmcPretty.c: Rebuilt. * mc-boot/GmcPrintf.c: Rebuilt. * mc-boot/GmcQuiet.c: Rebuilt. * mc-boot/GmcReserved.c: Rebuilt. * mc-boot/GmcSearch.c: Rebuilt. * mc-boot/GmcStack.c: Rebuilt. * mc-boot/GmcStream.c: Rebuilt. * mc-boot/Gmcp1.c: Rebuilt. * mc-boot/Gmcp2.c: Rebuilt. * mc-boot/Gmcp3.c: Rebuilt. * mc-boot/Gmcp4.c: Rebuilt. * mc-boot/Gmcp5.c: Rebuilt. * mc-boot/GnameKey.c: Rebuilt. * mc-boot/GsymbolKey.c: Rebuilt. * mc-boot/Gtop.c: Rebuilt. * mc-boot/Gvarargs.c: Rebuilt. * mc-boot/Gwlists.c: Rebuilt. * mc/decl.def (makeVarParameter): Add parameter to signify used. (makeNonVarParameter): Add parameter to signify used. (addVarParameters): Add parameter to signify used. * mc/decl.mod: Add isused boolean to parameters. * mc/mcp1.bnf: Extend grammar to handle attribute unused during parameters. * mc/mcp2.bnf: Extend grammar to handle attribute unused during parameters. * mc/mcp3.bnf: Extend grammar to handle attribute unused during parameters. (mcPrintf): Import list replaced identifiers makekey and makeKey. * mc/mcp4.bnf: Extend grammar to handle attribute unused during parameters. * mc/mcp5.bnf: Extend grammar to handle attribute unused during parameters. * tools-src/mklink.c: Pass envp with argc, argv parameters for module initializer/finalization calls. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-09-17Fix unsigned comparison warningJan-Benedict Glaw1-1/+1
When -mfloat-abi=hard support was added, a cast went missing that used to silence a warning in common code: /usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o builtins.o -MT builtins.o -MMD -MP -MF ./.deps/builtins.TPo ../../gcc/gcc/builtins.cc In file included from ./tm.h:21, from ../../gcc/gcc/backend.h:28, from ../../gcc/gcc/builtins.cc:27: ../../gcc/gcc/builtins.cc: In function 'int apply_args_size()': ../../gcc/gcc/config/csky/csky.h:421:13: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits] 421 | (((REGNO) >= CSKY_FIRST_PARM_REGNUM \ ../../gcc/gcc/builtins.cc:1444:13: note: in expansion of macro 'FUNCTION_ARG_REGNO_P' 1444 | if (FUNCTION_ARG_REGNO_P (regno)) | ^~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [Makefile:1146: builtins.o] Error 1 The needed (int) cast is even mentioned in the comment above, so reinstate it here. gcc/ChangeLog: * config/csky/csky.h (FUNCTION_ARG_REGNO_P): Cast REGNO to (int) to prevent warning.
2022-09-17c++: modules ICE with typename friendPatrick Palka3-2/+20
A couple of xtreme-header-* modules tests began ICEing in C++23 mode ever since r13-2650-g5d84a4418aa962 which introduced into <ranges> a dependently scoped friend declaration: friend /* typename */ _OuterIter::value_type; This happens because the streaming code assumes a TYPE_P friend must be a class type, but here it's a TYPENAME_TYPE, which doesn't have a TEMPLATE_INFO or CLASSTYPE_BEFRIENDING_CLASSES. This patch tries to correct this in a minimal way. gcc/cp/ChangeLog: * module.cc (friend_from_decl_list): Don't consider CLASSTYPE_TEMPLATE_INFO for a TYPENAME_TYPE friend. (trees_in::read_class_def): Don't add to CLASSTYPE_BEFRIENDING_CLASSES for a TYPENAME_TYPE friend. gcc/testsuite/ChangeLog: * g++.dg/modules/typename-friend_a.C: New test. * g++.dg/modules/typename-friend_b.C: New test.
2022-09-17reassoc: Fix up recent regression in optimize_range_tests_cmp_bitwise [PR106958]Jakub Jelinek2-3/+19
As the following testcase reduced from glibc fmtmsg.c shows (it doesn't ICE on x86_64/i686 unfortunately, but does on various other arches), my last optimize_range_tests_cmp_bitwise change wasn't fully correct. The intent was to let all pointer operands be cast to pointer_sized_int_node first in addition to the other casts (to type1) which are done for id >= l cases. But one spot I've touched used always cast to type1 (note, the (b % 4) == 3 case is impossible for pointer operands because that is for !TYPE_UNSIGNED operands and pointers are TYPE_UNSIGNED) and in the other spot the cast would be done only for id >= l if not useless, but for pointers we need to cast it always. 2022-09-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/106958 * tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): If id >= l, cast op to type1, otherwise to pointer_sized_int_node. If type has pointer type, cast exp to pointer_sized_int_node even when id < l. * gcc.c-torture/compile/pr106958.c: New test.
2022-09-17Daily bump.GCC Administrator4-1/+48
2022-09-16Fix for an AutoFDO test.Eugene Rozenfeld1-3/+3
After https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c17975d81aaed49ff759c20c68b31304a6953d58 the expected inlining in indir-call--prof-2.c test happens during afdo phase instead of einline. This patch adjusts the test accordingly. gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/indir-call-prof-2.c: Fix dg-final-use-autofdo.
2022-09-16c++: 'mutable' member within constexpr [PR92505]Patrick Palka3-4/+32
This patch permits accessing 'mutable' members of local objects during constexpr evaluation, while continuing to reject it for global objects (as in the last line of cpp0x/constexpr-mutable1.C). To distinguish between the two cases, it looks like it suffices to just check CONSTRUCTOR_MUTABLE_POSION in cxx_eval_component_reference before deciding to reject a DECL_MUTABLE_P member access. PR c++/92505 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_component_reference): Check non_constant_p sooner. In C++14 or later, reject a DECL_MUTABLE_P member access only if CONSTRUCTOR_MUTABLE_POISION is also set. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-mutable3.C: New test. * g++.dg/cpp1y/constexpr-mutable1.C: New test.
2022-09-16c++: member fn in omp loc list [PR106858]Jason Merrill4-5/+18
this-f names a member function, which isn't an addressable lvalue. Give a helpful error instead of crashing. The first hunk makes the error range cover the whole expression. PR c++/106858 gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_var_list_no_open): Pass the initial token location down. * semantics.cc (finish_omp_clauses): Check invalid_nonstatic_memfn_p. * typeck.cc (invalid_nonstatic_memfn_p): Handle null TREE_TYPE. gcc/testsuite/ChangeLog: * g++.dg/gomp/map-3.C: New test.
2022-09-16Modernize ix86_builtin_vectorized_function with corresponding expanders.liuhongt2-181/+84
For ifloor/lfloor/iceil/lceil/irint/lrint/iround/lround when size of in_mode is not equal out_mode, vectorizer doesn't go to internal fn way,still left that part in the ix86_builtin_vectorized_function. Remove others builtins and add corresponding expanders. gcc/ChangeLog: PR target/106910 * config/i386/i386-builtins.cc (ix86_builtin_vectorized_function): Modernized with corresponding expanders. * config/i386/sse.md (lrint<mode><sseintvecmodelower>2): New expander. (floor<mode>2): Ditto. (lfloor<mode><sseintvecmodelower>2): Ditto. (ceil<mode>2): Ditto. (lceil<mode><sseintvecmodelower>2): Ditto. (btrunc<mode>2): Ditto. (lround<mode><sseintvecmodelower>2): Ditto. (exp2<mode>2): Ditto.
2022-09-16Daily bump.GCC Administrator12-1/+118
2022-09-15Fortran: catch NULL pointer dereferences while simplifying PACK [PR106857]Harald Anlauf2-1/+13
gcc/fortran/ChangeLog: PR fortran/106857 * simplify.cc (gfc_simplify_pack): Check for NULL pointer dereferences while walking through constructors (error recovery). gcc/testsuite/ChangeLog: PR fortran/106857 * gfortran.dg/pr106857.f90: New test.
2022-09-15Fortran: error recovery for bad deferred character length assignment [PR104314]Harald Anlauf2-0/+10
gcc/fortran/ChangeLog: PR fortran/104314 * resolve.cc (deferred_op_assign): Do not try to generate temporary for deferred character length assignment if types do not agree. gcc/testsuite/ChangeLog: PR fortran/104314 * gfortran.dg/pr104314.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
2022-09-15float.h: Do not define INFINITY for C2x when infinities not supportedJoseph Myers3-3/+14
C2x has changed the rules for defining INFINITY in <float.h> so it is no longer defined when float does not support infinities, instead of being defined to an expression that overflows at translation time. Thus, make the definition conditional on __FLT_HAS_INFINITY__ (this is already inside a C2x-conditional part of <float.h>, because previous C standard versions only had this macro in <math.h>). Bootstrapped with no regressions for x86_64-pc-linux-gnu. Also did a spot test of the case of no infinities supported by building cc1 for vax-netbsdelf and testing compiling the new c2x-float-11.c test with it. gcc/ * ginclude/float.h (INFINITY): Define only if [__FLT_HAS_INFINITY__]. gcc/testsuite/ * gcc.dg/c2x-float-2.c: Require inff effective-target. * gcc.dg/c2x-float-11.c: New test.
2022-09-15tree-optimization/106922 - PRE and virtual operand translationRichard Biener2-6/+103
PRE implicitely keeps virtual operands at the blocks incoming version but the explicit updating point during PHI translation fails to trigger when there are no PHIs at all in a block. Later lazy updating then fails because of a too lose block check. A similar issues plagues reference invalidation when checking the ANTIC_OUT to ANTIC_IN translation. The following fixes both and makes the lazy updating work. The diagnostic testcase unfortunately requires boost so the testcase is the one I reduced for a missed optimization in PRE. The testcase fails with -m32 on x86_64 because we optimize too much before PRE which causes PRE to not trigger so we fail to eliminate a full redundancy. I'm going to open a separate bug for this. Hopefully the !lp64 selector is good enough. PR tree-optimization/106922 * tree-ssa-pre.cc (translate_vuse_through_block): Only keep the VUSE if its def dominates PHIBLOCK. (prune_clobbered_mems): Rewrite logic so we check whether a value dies in a block when the VUSE def doesn't dominate it. * g++.dg/tree-ssa/pr106922.C: New testcase.
2022-09-15Move void_list_node init to common codeRichard Biener11-31/+3
All frontends replicate this, so move it. gcc/ * tree.cc (build_common_tree_nodes): Initialize void_list_node here. gcc/ada/ * gcc-interface/trans.cc (gigi): Do not initialize void_list_node. gcc/c-family/ * c-common.h (build_void_list_node): Remove. * c-common.cc (c_common_nodes_and_builtins): Do not initialize void_list_node. gcc/c/ * c-decl.cc (build_void_list_node): Remove. gcc/cp/ * decl.cc (cxx_init_decl_processing): Inline last build_void_list_node call. (build_void_list_node): Remove. gcc/d/ * d-builtins.cc (d_build_c_type_nodes): Do not initialize void_list_node. gcc/fortran/ * f95-lang.cc (gfc_init_decl_processing): Do not initialize void_list_node. gcc/go/ * go-lang.cc (go_langhook_init): Do not initialize void_list_node. gcc/jit/ * dummy-frontend.cc (jit_langhook_init): Do not initialize void_list_node. gcc/lto/ * lto-lang.cc (lto_build_c_type_nodes): Do not initialize void_list_node.
2022-09-15Fix c-c++-common/gomp/target-50.c testJulian Brown1-1/+1
The expected scan dump output for this test will change after the following patch is committed: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601558.html But for now, this patch reverts to the old expected pattern so the test passes. I will apply as obvious. 2022-09-15 Julian Brown <julian@codesourcery.com> gcc/testsuite/ * c-c++-common/gomp/target-50.c: Modify scan pattern.
2022-09-15Fix c-c++-common/goacc/mdc-2.c and g++.dg/goacc/mdc.C testsJulian Brown2-0/+4
These testsuite hunks got left attached to the wrong patch in the series I just posted. I will apply as obvious. 2022-09-15 Julian Brown <julian@codesourcery.com> gcc/testsuite/ * c-c++-common/goacc/mdc-2.c: Update expected errors. * g++.dg/goacc/mdc.C: Likewise.
2022-09-15rs6000: Using pli(paddi) and rotate to build 64bit constantsJiufu Guo3-0/+71
Hi, Test cases are updated/added, and code is refined as the comments in the review for previous version: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/600768.html As mentioned in PR106550, since pli could support 34bits immediate, we could use less instructions(3insn would be ok) to build 64bits constant with pli. For example, for constant 0x020805006106003, we could generate it with: asm code1: pli 9,101736451 (0x6106003) sldi 9,9,32 paddi 9,9, 2130000 (0x0208050) or asm code2: pli 10, 2130000 pli 9, 101736451 rldimi 9, 10, 32, 0 The asm code2 would be better. This patch generates the asm code2 in split1 pass, this patch also supports to generate asm code1 when splitter is only after RA. This patch pass boostrap and regtest on ppc64. P10 testing is running. Thanks for any comments! BR, Jeff(Jiufu) PR target/106550 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Use pli. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr106550.c: New test. * gcc.target/powerpc/pr106550_1.c: New test.
2022-09-15Daily bump.GCC Administrator6-1/+259
2022-09-14Merge branch 'master' into devel/modula-2.Gaius Mulley83-313/+2302
2022-09-14Add definition for GM2_FOR_TARGET into gcc/m2/Make-lang.in.Gaius Mulley1-0/+2
gcc/m2/ChangeLog: * Make-lang.in (GM2_FOR_TARGET): Added. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-09-14frange: add both zeros to ranges when there's the possiblity of equality.Aldy Hernandez1-6/+25
Every time there's equality at play, we must be careful that any equality with zero matches both -0.0 and +0.0 when honoring signed zeros. We were doing this correctly for the == and != op1_range operators (albeit inefficiently), but aren't doing it at all when building >= and <=. This fixes the oversight. There is change in functionality here for the build_* functions. This is the last "simple" patch I submit before overhauling NAN and sign tracking. And that will likely be after Cauldron because it will need further testing (lapack, ppc64le, -ffinite-math-only, etc). Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * range-op-float.cc (frange_add_zeros): New. (build_le): Call frange_add_zeros. (build_ge): Same. (foperator_equal::op1_range): Same. (foperator_not_equal::op1_range): Same.
2022-09-14Pass full range to build_* in range-op-float.ccAldy Hernandez1-36/+36
The build_<relop> helper functions in range-op-float.cc take the actual value from the operand's endpoint, but this value could be deduced from the operand itself therefore cleaning up the call site. This also reduces the potential of mistakenly passing the wrong bound. No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * range-op-float.cc (build_le): Accept frange instead of number. (build_lt): Same. (build_ge): Same. (build_gt): Same. (foperator_lt::op1_range): Pass full range to build_*. (foperator_lt::op2_range): Same. (foperator_le::op1_range): Same. (foperator_le::op2_range): Same. (foperator_gt::op1_range): Same. (foperator_gt::op2_range): Same. (foperator_ge::op1_range): Same. (foperator_ge::op2_range): Same.
2022-09-14Use frange::set_nan() from the generic frange::set().Aldy Hernandez2-14/+22
This patch cleans up the frange::set() code by passing all things NAN to frange::set_nan(). No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * value-range.cc (frange::set): Use set_nan. * value-range.h (frange::set_nan): Inline code originally in set().
2022-09-14Provide cleaner set_nan(), clear_nan(), and update_nan() methods.Aldy Hernandez4-62/+51
set_* has a very specific meaning for irange's and friends. Methods prefixed with set_* are setters clobbering the existing range. As such, the current set_nan() method is confusing in that it's not actually setting a range to a NAN, but twiddling the NAN flags for an existing frange. This patch replaces set_nan() with an update_nan() to set the flag, and clear_nan() to clear it. This makes the code clearer, and though the confusing tristate is still there, it will be removed in upcoming patches. Also, there is now an actual set_nan() method to set the range to a NAN. This replaces two out of class functions doing the same thing. In future patches I will also add the ability to create a NAN with a specific sign, but doing so now would be confusing because we're not tracking NAN signs. We should also submit set_signbit to the same fate, but it's about to get removed. No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * range-op-float.cc (frange_set_nan): Remove. (build_lt): Use set_nan, update_nan, clear_nan. (build_gt): Same. (foperator_equal::op1_range): Same. (foperator_not_equal::op1_range): Same. (foperator_lt::op1_range): Same. (foperator_lt::op2_range): Same. (foperator_le::op1_range): Same. (foperator_le::op2_range): Same. (foperator_gt::op1_range): Same. (foperator_gt::op2_range): Same. (foperator_ge::op1_range): Same. (foperator_ge::op2_range): Same. (foperator_unordered::op1_range): Same. (foperator_ordered::op1_range): Same. * value-query.cc (range_query::get_tree_range): Same. * value-range.cc (frange::set_nan): Same. (frange::update_nan): Same. (frange::union_): Same. (frange::intersect): Same. (range_tests_nan): Same. (range_tests_signed_zeros): Same. (range_tests_signbit): Same. (range_tests_floats): Same. * value-range.h (class frange): Add update_nan and clear_nan. (frange::set_nan): New.
2022-09-14Minor fixes to frange.Aldy Hernandez4-17/+7
Following are a series of cleanups to the frange code in preparation for a much more invasive patch rewriting the NAN and sign tracking bits. Please be patient, as I'm trying to break everything up into small chunks instead of dropping a mondo patch removing the NAN and sign tristate handling. No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * value-query.cc (range_query::get_tree_range): Remove check for overflow. * value-range-pretty-print.cc (vrange_printer::visit): Move read of type until after undefined_p is checked. * value-range.cc (frange::set): Remove asserts for REAL_CST. (frange::contains_p): Tidy up. (range_tests_nan): Add comment. * value-range.h (frange::type): Check for undefined_p. (frange::set_undefined): Remove set of endpoints.
2022-09-14OpenMP/OpenACC: mapping group list-handling improvementsJulian Brown3-68/+213
This patch adjusts OpenMP/OpenACC clause list handling in a couple of places, in preparation for the following mapping-clause expansion rework patch. Firstly mapping groups are removed as a whole in the C and C++ front-ends when an error is detected, which avoids leaving "badly-formed" mapping clause groups in the list. Secondly, reindexing of the omp_mapping_group hashmap (during omp_build_struct_sibling_lists) has been reimplemented, fixing some tricky corner-cases where mapping groups are removed from a list at the same time as it is being reordered. Thirdly, code to check if a different clause on the same directive maps the whole of a struct that we have a component mapping for (for example) has been outlined, removing a bit of code duplication. 2022-09-13 Julian Brown <julian@codesourcery.com> gcc/ * gimplify.cc (omp_group_last): Allow GOMP_MAP_ATTACH_DETACH after GOMP_MAP_STRUCT (for reindexing). (omp_gather_mapping_groups): Reimplement using... (omp_gather_mapping_groups_1): This new function. Stop processing at GATHER_SENTINEL. (omp_group_base): Allow GOMP_MAP_TO_PSET without any following node. (omp_index_mapping_groups): Reimplement using... (omp_index_mapping_groups_1): This new function. Handle REINDEX_SENTINEL. (omp_reindex_mapping_groups, omp_mapped_by_containing_struct): New functions. (omp_tsort_mapping_groups_1): Adjust handling of base group being the same as current group. Use omp_mapped_by_containing_struct. (omp_build_struct_sibling_lists): Use omp_mapped_by_containing_struct and omp_reindex_mapping_groups. Robustify group deletion for reordered lists. (gimplify_scan_omp_clauses): Update calls to omp_build_struct_sibling_lists. gcc/c/ * c-typeck.cc (c_finish_omp_clauses): Remove whole mapping node group on error. gcc/cp/ * semantics.cc (finish_omp_clauses): Likewise.
2022-09-14OpenMP/OpenACC struct sibling list gimplification extension and reworkJulian Brown10-730/+951
This patch refactors struct sibling-list processing in gimplify.cc, and adjusts some related mapping-clause processing in the Fortran FE and omp-low.cc accordingly. 2022-09-13 Julian Brown <julian@codesourcery.com> gcc/fortran/ * trans-openmp.cc (gfc_trans_omp_clauses): Don't create GOMP_MAP_TO_PSET mappings for class metadata, nor GOMP_MAP_POINTER mappings for POINTER_TYPE_P decls. gcc/ * gimplify.cc (gimplify_omp_var_data): Remove GOVD_MAP_HAS_ATTACHMENTS. (GOMP_FIRSTPRIVATE_IMPLICIT): Renumber. (insert_struct_comp_map): Refactor function into... (build_omp_struct_comp_nodes): This new function. Remove list handling and improve self-documentation. (extract_base_bit_offset): Remove BASE_REF, OFFSETP parameters. Move code to strip outer parts of address out of function, but strip no-op conversions. (omp_mapping_group): Add DELETED field for use during reindexing. (omp_strip_components_and_deref, omp_strip_indirections): New functions. (omp_group_last, omp_group_base): Add GOMP_MAP_STRUCT handling. (omp_gather_mapping_groups): Initialise DELETED field for new groups. (omp_index_mapping_groups): Notice DELETED groups when (re)indexing. (omp_siblist_insert_node_after, omp_siblist_move_node_after, omp_siblist_move_nodes_after, omp_siblist_move_concat_nodes_after): New helper functions. (omp_accumulate_sibling_list): New function to build up GOMP_MAP_STRUCT node groups for sibling lists. Outlined from gimplify_scan_omp_clauses. (omp_build_struct_sibling_lists): New function. (gimplify_scan_omp_clauses): Remove struct_map_to_clause, struct_seen_clause, struct_deref_set. Call omp_build_struct_sibling_lists as pre-pass instead of handling sibling lists in the function's main processing loop. (gimplify_adjust_omp_clauses_1): Remove GOVD_MAP_HAS_ATTACHMENTS handling, unused now. * omp-low.cc (scan_sharing_clauses): Handle pointer-type indirect struct references, and references to pointers to structs also. gcc/testsuite/ * g++.dg/goacc/member-array-acc.C: New test. * g++.dg/gomp/member-array-omp.C: New test. * g++.dg/gomp/target-3.C: Update expected output. * g++.dg/gomp/target-lambda-1.C: Likewise. * g++.dg/gomp/target-this-2.C: Likewise. * c-c++-common/goacc/deep-copy-arrayofstruct.c: Move test from here. * c-c++-common/gomp/target-50.c: New test. libgomp/ * testsuite/libgomp.oacc-c-c++-common/deep-copy-15.c: New test. * testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c: New test. * testsuite/libgomp.oacc-c++/deep-copy-17.C: New test. * testsuite/libgomp.oacc-c-c++-common/deep-copy-arrayofstruct.c: Move test to here, make "run" test.
2022-09-14tree-optimization/106938 - cleanup abnormal edges after inliningRichard Biener2-6/+43
After inlining and IPA transforms we run fixup_cfg to fixup CFG effects in other functions. But that fails to clean abnormal edges from non-pure/const calls which might no longer be necessary when ->calls_setjmp is false. The following ensures this happens and refactors things so we call EH/abnormal cleanup only on the last stmt in a block. PR tree-optimization/106938 * tree-cfg.cc (execute_fixup_cfg): Purge dead abnormal edges for all last stmts in a block. Do EH cleanup only on the last stmt in a block. * gcc.dg/pr106938.c: New testcase.
2022-09-14[PR106936] Remove assert from get_value_range.Aldy Hernandez2-1/+14
This assert was put here to make sure that the legacy get_value_range() wasn't being called on stuff that legacy couldn't handle (floats, etc), because the result would ultimately be copied into a value_range_equiv. In this case, simplify_casted_cond() is calling it on an offset_type which is neither an integer nor a pointer. However, range_of_expr happily punted on it, and then the fallthru code set the range to VARYING. As value_range_equiv can store VARYING types of anything (including types it can't handle), this is fine. The easiest thing to do is remove the assert. If someone from the non legacy world tries to get a non integer/pointer range here, it's going to blow up anyhow because the temporary in get_value_range is int_range_max. PR tree-optimization/106936 gcc/ChangeLog: * value-query.cc (range_query::get_value_range): Remove assert. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/pr106936.C: New test.
2022-09-14Drop unused variableJan-Benedict Glaw1-1/+1
With the "STABS: remove -gstabs and -gxcoff functionality" patch, a left-over `start` variable remained unused: /usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o mips.o -MT mips.o -MMD -MP -MF ./.deps/mips.TPo ../../gcc/gcc/config/mips/mips.cc ../../gcc/gcc/config/mips/mips.cc: In function 'void mips_option_override()': ../../gcc/gcc/config/mips/mips.cc:20021:10: error: unused variable 'start' [-Werror=unused-variable] 20021 | int i, start, regno, mode; | ^~~~~ 2022-09-14 Jan-Benedict Glaw <jbglaw@lug-owl.de> gcc/ * config/mips/mips.cc (mips_option_override): Drop unused variable.
2022-09-14OpenMP 5.0: Clause ordering for OpenMP 5.0 (topological sorting by base pointer)Julian Brown5-193/+748
This patch reimplements the omp_target_reorder_clauses function in anticipation of supporting "deeper" struct mappings (that is, with several structure dereference operators, or similar). The idea is that in place of the (possibly quadratic) algorithm in omp_target_reorder_clauses that greedily moves clauses containing addresses that are subexpressions of other addresses before those other addresses, we employ a topological sort algorithm to calculate a proper order for map clauses. This should run in linear time, and hopefully handles degenerate cases where multiple "levels" of indirect accesses are present on a given directive. The new method also takes care to keep clause groups together, addressing the concerns raised in: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570501.html To figure out if some given clause depends on a base pointer in another clause, we strip off the outer layers of the address expression, and check (via a tree_operand_hash hash table we have built) if the result is a "base pointer" as defined in OpenMP 5.0 (1.2.6 Data Terminology). There are some subtleties involved, however: - We must treat MEM_REF with zero offset the same as INDIRECT_REF. This should probably be fixed in the front ends instead so we always use a canonical form (probably INDIRECT_REF). The following patch shows one instance of the problem, but there may be others: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571382.html - Mapping a whole struct implies mapping each of that struct's elements, which may be base pointers. Because those base pointers aren't necessarily explicitly referenced in the directive in question, we treat the whole-struct mapping as a dependency instead. 2022-09-13 Julian Brown <julian@codesourcery.com> gcc/ * gimplify.cc (is_or_contains_p, omp_target_reorder_clauses): Delete functions. (omp_tsort_mark): Add enum. (omp_mapping_group): Add struct. (debug_mapping_group, omp_get_base_pointer, omp_get_attachment, omp_group_last, omp_gather_mapping_groups, omp_group_base, omp_index_mapping_groups, omp_containing_struct, omp_tsort_mapping_groups_1, omp_tsort_mapping_groups, omp_segregate_mapping_groups, omp_reorder_mapping_groups): New functions. (gimplify_scan_omp_clauses): Call above functions instead of omp_target_reorder_clauses, unless we've seen an error. * omp-low.cc (scan_sharing_clauses): Avoid strict test if we haven't sorted mapping groups. gcc/testsuite/ * g++.dg/gomp/target-lambda-1.C: Adjust expected output. * g++.dg/gomp/target-this-3.C: Likewise. * g++.dg/gomp/target-this-4.C: Likewise.