Skip to content
Snippets Groups Projects
  1. Nov 18, 2024
    • Robin Dapp's avatar
      RISC-V: Add VLS modes to strided loads. · 52a392b8
      Robin Dapp authored
      This patch adds VLS modes to the strided load expanders.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md: Add VLS modes.
      	* config/riscv/vector-iterators.md: Ditto.
      	* config/riscv/vector.md: Ditto.
      52a392b8
    • Robin Dapp's avatar
      RISC-V: Add else operand to masked loads [PR115336]. · b89273a0
      Robin Dapp authored
      This patch adds else operands to masked loads.  Currently the default
      else operand predicate just accepts "undefined" (i.e. SCRATCH) values.
      
      	PR middle-end/115336
      	PR middle-end/116059
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md: Add else operand.
      	* config/riscv/predicates.md (maskload_else_operand): New
      	predicate.
      	* config/riscv/riscv-v.cc (get_else_operand): Remove static.
      	(expand_load_store): Use get_else_operand and adjust index.
      	(expand_gather_scatter): Ditto.
      	(expand_lanes_load_store): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr115336.c: New test.
      	* gcc.target/riscv/rvv/autovec/pr116059.c: New test.
      b89273a0
    • Robin Dapp's avatar
      i386: Add zero maskload else operand. · ebf30772
      Robin Dapp authored
      gcc/ChangeLog:
      
      	* config/i386/sse.md (maskload<mode><sseintvecmodelower>):
      	Call maskload<mode>..._1.
      	(maskload<mode><sseintvecmodelower>_1): Rename.
      ebf30772
    • Robin Dapp's avatar
      gcn: Add else operand to masked loads. · 4a39addb
      Robin Dapp authored
      This patch adds an undefined else operand to the masked loads.
      
      gcc/ChangeLog:
      
      	* config/gcn/predicates.md (maskload_else_operand): New
      	predicate.
      	* config/gcn/gcn-valu.md: Use new predicate.
      4a39addb
    • Robin Dapp's avatar
      aarch64: Add masked-load else operands. · a166a6cc
      Robin Dapp authored
      This adds zero else operands to masked loads and their intrinsics.
      I needed to adjust more than initially thought because we rely on
      combine for several instructions and a change in a "base" pattern
      needs to propagate to all those.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-sve-builtins-base.cc: Add else
      	handling.
      	* config/aarch64/aarch64-sve-builtins.cc (function_expander::use_contiguous_load_insn):
      	Ditto.
      	* config/aarch64/aarch64-sve-builtins.h: Add else operand to
      	contiguous load.
      	* config/aarch64/aarch64-sve.md (@aarch64_load<SVE_PRED_LOAD:pred_load>
      	_<ANY_EXTEND:optab><SVE_HSDI:mode><SVE_PARTIAL_I:mode>):
      	Split and add else operand.
      	(@aarch64_load_<ANY_EXTEND:optab><SVE_HSDI:mode><SVE_PARTIAL_I:mode>):
      	Ditto.
      	(*aarch64_load_<ANY_EXTEND:optab>_mov<SVE_HSDI:mode><SVE_PARTIAL_I:mode>):
      	Ditto.
      	* config/aarch64/aarch64-sve2.md: Ditto.
      	* config/aarch64/iterators.md: Remove unused iterators.
      	* config/aarch64/predicates.md (aarch64_maskload_else_operand):
      	Add zero else operand.
      a166a6cc
    • Robin Dapp's avatar
      vect: Add maskload else value support. · 634ae740
      Robin Dapp authored
      This patch adds an else operand to vectorized masked load calls.
      The current implementation adds else-value arguments to the respective
      target-querying functions that is used to supply the vectorizer with the
      proper else value.
      
      We query the target for its supported else operand and uses that for the
      maskload call.  If necessary, i.e. if the mode has padding bits and if
      the else operand is nonzero, a VEC_COND enforcing a zero else value is
      emitted.
      
      gcc/ChangeLog:
      
      	* optabs-query.cc (supports_vec_convert_optab_p): Return icode.
      	(get_supported_else_val): Return supported else value for
      	optab's operand at index.
      	(supports_vec_gather_load_p): Add else argument.
      	(supports_vec_scatter_store_p): Ditto.
      	* optabs-query.h (supports_vec_gather_load_p): Ditto.
      	(get_supported_else_val): Ditto.
      	* optabs-tree.cc (target_supports_mask_load_store_p): Ditto.
      	(can_vec_mask_load_store_p): Ditto.
      	(target_supports_len_load_store_p): Ditto.
      	(get_len_load_store_mode): Ditto.
      	* optabs-tree.h (target_supports_mask_load_store_p): Ditto.
      	(can_vec_mask_load_store_p): Ditto.
      	* tree-vect-data-refs.cc (vect_lanes_optab_supported_p): Ditto.
      	(vect_gather_scatter_fn_p): Ditto.
      	(vect_check_gather_scatter): Ditto.
      	(vect_load_lanes_supported): Ditto.
      	* tree-vect-patterns.cc (vect_recog_gather_scatter_pattern):
      	Ditto.
      	* tree-vect-slp.cc (vect_get_operand_map): Adjust indices for
      	else operand.
      	(vect_slp_analyze_node_operations): Skip undefined else operand.
      	* tree-vect-stmts.cc (exist_non_indexing_operands_for_use_p):
      	Add else operand handling.
      	(vect_get_vec_defs_for_operand): Handle undefined else operand.
      	(check_load_store_for_partial_vectors): Add else argument.
      	(vect_truncate_gather_scatter_offset): Ditto.
      	(vect_use_strided_gather_scatters_p): Ditto.
      	(get_group_load_store_type): Ditto.
      	(get_load_store_type): Ditto.
      	(vect_get_mask_load_else): Ditto.
      	(vect_get_else_val_from_tree): Ditto.
      	(vect_build_one_gather_load_call): Add zero else operand.
      	(vectorizable_load): Use else operand.
      	* tree-vectorizer.h (vect_gather_scatter_fn_p): Add else
      	argument.
      	(vect_load_lanes_supported): Ditto.
      	(vect_get_mask_load_else): Ditto.
      	(vect_get_else_val_from_tree): Ditto.
      634ae740
    • Robin Dapp's avatar
      tree-ifcvt: Add zero maskload else value. · 6b6bd536
      Robin Dapp authored
      When predicating a load we implicitly assume that the else value is
      zero.  This matters in case the loaded value is padded (like e.g.
      a Bool) and we must ensure that the padding bytes are zero on targets
      that don't implicitly zero inactive elements.
      
      A former version of this patch still had this handling in ifcvt but
      the latest version defers it to the vectorizer.
      
      gcc/ChangeLog:
      
      	* tree-if-conv.cc (predicate_load_or_store): Add zero else
      	operand and comment.
      6b6bd536
    • Robin Dapp's avatar
      ifn: Add else-operand handling. · 8f68d9cb
      Robin Dapp authored
      This patch adds else-operand handling to the internal functions.
      
      gcc/ChangeLog:
      
      	* internal-fn.cc (add_mask_and_len_args): Rename...
      	(add_mask_else_and_len_args): ...to this and add else handling.
      	(expand_partial_load_optab_fn): Use adjusted function.
      	(expand_partial_store_optab_fn): Ditto.
      	(expand_scatter_store_optab_fn): Ditto.
      	(expand_gather_load_optab_fn): Ditto.
      	(internal_fn_len_index): Add else handling.
      	(internal_fn_else_index): Ditto.
      	(internal_fn_mask_index): Ditto.
      	(get_supported_else_vals): New function.
      	(supported_else_val_p): New function.
      	(internal_gather_scatter_fn_supported_p): Add else operand.
      	* internal-fn.h (internal_gather_scatter_fn_supported_p): Define
      	else constants.
      	(MASK_LOAD_ELSE_ZERO): Ditto.
      	(MASK_LOAD_ELSE_M1): Ditto.
      	(MASK_LOAD_ELSE_UNDEFINED): Ditto.
      	(get_supported_else_vals): Declare.
      	(supported_else_val_p): Ditto.
      8f68d9cb
    • Robin Dapp's avatar
      docs: Document maskload else operand and behavior. · 5214ddb4
      Robin Dapp authored
      This patch amends the documentation for masked loads (maskload,
      vec_mask_load_lanes, and mask_gather_load as well as their len
      counterparts) with an else operand.
      
      gcc/ChangeLog:
      
      	* doc/md.texi: Document masked load else operand.
      5214ddb4
    • Tobias Burnus's avatar
      libgomp/plugin/plugin-nvptx.c: Change false to NULL to fix C23 wrong-return-type error [PR117626] · e7e3d183
      Tobias Burnus authored
      libgomp/ChangeLog:
      
      	PR libgomp/117626
      	* plugin/plugin-nvptx.c (nvptx_open_device): Use 'CUDA_CALL_ERET'
      	with 'NULL' as error return instead of 'CUDA_CALL' that returns false.
      e7e3d183
    • Andrew Pinski's avatar
      match: Fix the `max<a,b>==0` pattern for pointers [PR117646] · 45a32771
      Andrew Pinski authored
      
      For pointers I forgot that BIT_IOR_EXPR is not valid so when
      I added the pattern to convert `max<a,b> != 0` (r15-5356), GCC
      would start to ICEing saying pointer types were not valid for
      BIT_IOR_EXPR.
      This fixes the problem by casting to the unsigned type of the
      inner type. There was another way of fixing this to handling it
      as `a == 0 & b == 0` but both match and reassoication (for pointers)
      will then convert it back into the form I am creating here so
      let's just use that form instead.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/117646
      
      gcc/ChangeLog:
      
      	* match.pd (`max<a,b>==0`): Add casts to `unsigned type`.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/torture/minmaxneeqptr-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      45a32771
    • Jonathan Wakely's avatar
      libstdc++: Fix invalid casts in unordered container merge functions · dffc37de
      Jonathan Wakely authored
      
      François pointed out that static_cast<__node_ptr>(&_M_before_begin) is
      invalid, because _M_before_begin is only a node-base not a node.
      
      Refactor the new merge overloads to only cast when we know we have a
      valid node.
      
      He also pointed out some optimizations to allow reusing hash codes that
      might be cached in the node. The _M_src_hash_code function already has
      the right logic to decide when a cached hash code can be reused by a
      different _Hashtable object.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/hashtable.h (_Hashtable::_M_src_hash_code):
      	Improve comments.
      	(_Hashtable::_M_merge_unique(_Hashtable&)): Use pointer_traits
      	to get before-begin pointer. Only use static_cast on valid
      	nodes, not the before-begin pointer. Reuse a hash code cached in
      	the node when possible.
      	(_Hashtable::_M_merge_multi(_Hashtable&)): Likewise.
      
      Reviewed-by: default avatarFrançois Dumont <fdumont@gcc.gnu.org>
      dffc37de
    • Jason Merrill's avatar
      libcpp: add .c++-header-unit target · 7b8b96a3
      Jason Merrill authored
      The dependency output for header unit modules is based on the absolute
      pathname of the header file, but that's not something that a makefile can
      portably refer to.  This patch adds a .c++-header-unit target based on the
      header name relative to an element of the include path.
      
      libcpp/ChangeLog:
      
      	* internal.h (_cpp_get_file_dir): Declare.
      	* files.cc (_cpp_get_file_dir): New fn.
      	* mkdeps.cc (make_write): Use it.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/dep-4.H: New test.
      7b8b96a3
    • Andrew Pinski's avatar
      testsuite: Fix pr101145inf*.c testcases [PR117494] · 0dc389f2
      Andrew Pinski authored
      
      Instead of doing a dg-run with a specific target check for linux.
      Use signal as the effective-target since this requires the use
      of ALARM signal to do the testing.
      Also use check_vect in the main and renames main to main1 to make sure
      we don't use the registers.
      
      Tested on x86_64-linux-gnu.
      
      	PR testsuite/117494
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/pr101145inf.c: Remove dg-do and replace
      	with dg-require-effective-target of signal.
      	* gcc.dg/vect/pr101145inf_1.c: Likewise.
      	* gcc.dg/vect/pr101145inf.inc: Rename main to main1
      	and mark as noinline.
      	Include tree-vect.h. Have main call check_vect and main1.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      0dc389f2
    • Gerald Pfeifer's avatar
      libstdc++: Update reference to Angelika Langer's article · 83e86397
      Gerald Pfeifer authored
      libstdc++-v3:
      	* doc/xml/manual/allocator.xml: Update reference to Angelika
      	Langer's article.
      	* doc/html/manual/memory.html: Regenerate.
      83e86397
    • Jeff Law's avatar
      Improve ext-dce's ability to eliminate more extensions · beec2912
      Jeff Law authored
      I was looking at a regression in ext-dce's behavior just before Cauldron.
      Essentially a bugfix in ext-dce ended up causing us to fail to eliminate some
      useless extensions.
      
      When we have a SUBREG object with SUBREG_PROMOTED_VAR* flags set, we generally
      have to be more conservative in how we process bit group liveness, making bits
      live that wouldn't obviously be live otherwise.
      
      That's not always necessary though. For example, if we're storing a promoted
      subreg into memory, we may not care about those extra live bits on this
      instance of the subreg object (remember subregs are not shared!).  Essentially
      if the mode of the memory reference is not wider than the mode of the inner
      REG, then we can clear the promoted state which in turn may allow more
      extension elimination.
      
      So at the start of ext-dce we do a simple pass over the IL and remove promoted
      subreg state when it's obviously safe to do so (memory stores when the modes
      allow it).  That prevents extra bits from being live and ultimately allows us
      to remove more useless extensions.
      
      The testcase is in theory generic, but many targets won't have an opportunity
      to optimize this case.  So rather then build out a large inclusion/exclusion
      list, I've just made the test risc-v specific.
      
      Bootstrapped and regression tested on aarch64, riscv64, s390x, etc in my tester.
      
      gcc/
      	* ext-dce.cc (maybe_clear_subreg_promoted_p): New function.
      	(ext_dce_execute): Call it.
      
      gcc/testsuite
      	* gcc.target/riscv/ext-dce-1.c: New test.
      beec2912
    • Maciej W. Rozycki's avatar
      Alpha: Remove leftover `;;' for "unaligned_store<mode>" · 4a8eb5c6
      Maciej W. Rozycki authored
      Remove stray `;;' from the middle of the introductory comment for the
      "unaligned_store<mode>" expander, clearly a leftover from a previous
      edition.
      
      	gcc/
      	* config/alpha/alpha.md (unaligned_store<mode>): Remove stray
      	`;;'.
      4a8eb5c6
    • John David Anglin's avatar
      hppa: Update install documentation · 29c4f663
      John David Anglin authored
      2024-11-17  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/ChangeLog:
      
      	PR target/69374
      	* doc/install.texi (Specific) <hppa*-hp-hpux11>: Update anchor
      	and heading to reflect removal of 32-bit hppa support on HP-UX.
      	Trim 32-bit related text.
      29c4f663
    • GCC Administrator's avatar
      Daily bump. · 24da8634
      GCC Administrator authored
      24da8634
  2. Nov 17, 2024
    • Jason Merrill's avatar
      c++: regenerate opt urls · db348cae
      Jason Merrill authored
      This should have been part of r15-5367.  One day I'll remember to do this
      before buildbot sends me hate mail.
      
      gcc/c-family/ChangeLog:
      
      	* c.opt.urls: Regenerate.
      db348cae
    • John David Anglin's avatar
      hppa: Remove typedef for bool type · 8f50a079
      John David Anglin authored
      In C23, bool is now a keyword.  So, doing a typedef for it is invalid.
      
      2024-11-17  John David Anglin  <danglin@gcc.gnu.org>
      
      libgcc/ChangeLog:
      
      	PR target/117627
      	* config/pa/linux-atomic.c: Remove typedef for bool type.
      8f50a079
    • Florian Weimer's avatar
      c: Implement -Wdeprecated-non-prototype · 701d8e7e
      Florian Weimer authored
      This warning covers the C23 incompibilities resulting from using
      () as parameter lists in function declarations.
      
      The warning name comes from Clang.  The implementation is not
      perfect because GCC treats these two declarations as equivalent:
      
        void f ();
        void f (not_a_type);
      
      This is a bit confusing because they are clearly visually distinct.
      However, as of GCC 14, the second form is an error by default, so
      treating both the same as far as  -Wdeprecated-non-prototype does
      not seem so bad from a user experience view.
      
      gcc/c-family/
      
      	PR c/95445
      	* c-opts.cc (c_common_post_options): Initialize
      	warn_deprecated_non_prototype.
      	* c.opt (Wdeprecated-non-prototype): New option.
      	* c.opt.urls: Regenerate.
      
      gcc/c/
      
      	PR c/95445
      	* c-decl.cc (start_function): Warn about parameters
      	after parameter-less declaration.
      	* c-typeck.cc (build_function_call_vec): Pass fntype
      	to convert_arguments.
      	(convert_arguments): Change argument to fntype and
      	compute typelist.  Warn about parameter list mismatches
      	on first parameter.
      
      gcc/
      
      	PR c/95445
      	* doc/invoke.texi: Document -Wdeprecated-non-prototype.
      
      gcc/testsuite/
      
      	PR c/95445
      	* gcc.dg/Wdeprecated-non-prototype-1.c: New test.
      	* gcc.dg/Wdeprecated-non-prototype-2.c: New test.
      	* gcc.dg/Wdeprecated-non-prototype-3.c: New test.
      	* gcc.dg/Wdeprecated-non-prototype-4.c: New test.
      701d8e7e
    • Jason Merrill's avatar
      c++: -M and modules again · 3e89a4d5
      Jason Merrill authored
      While experimenting with testing module std I noticed that gcc -M broke on
      it; it seems I need to set directives_only even sooner than I did in
      r15-4219.
      
      gcc/c-family/ChangeLog:
      
      	* c-ppoutput.cc (preprocess_file): Don't set directives_only here.
      
      gcc/cp/ChangeLog:
      
      	* module.cc (module_preprocess_options): Set directives_only here.
      3e89a4d5
    • Jason Merrill's avatar
      c-family: add -fsearch-include-path · dbfbd3aa
      Jason Merrill authored
      The C++ modules code has a -fmodule-header (or -x c++-{user,system}-header)
      option to specify looking up headers to compile to header units on the usual
      include paths.  I'd like to have the same functionality for full C++20
      modules such as module std, which I proposed to live on the include path at
      bits/std.cc.  But this behavior doesn't seem necessarily connected to
      modules, so I'm proposing a general C/C++ option to specify the behavior of
      looking in the include path for the input files specified on the command
      line.
      
      Other ideas for the name of the option are very welcome.
      
      The libcpp change is to allow -fsearch-include-path{,=user} to find files in
      the current working directory, like -include.  This can be handy for a quick
      compile of both std.cc and a file that imports it, e.g.
      
      g++ -std=c++20 -fmodules -fsearch-include-path bits/std.cc importer.cc
      
      gcc/ChangeLog:
      
      	* doc/cppopts.texi: Document -fsearch-include-path.
      	* doc/invoke.texi: Mention it for modules.
      
      gcc/c-family/ChangeLog:
      
      	* c.opt: Add -fsearch-include-path.
      	* c-opts.cc (c_common_post_options): Handle it.
      
      gcc/cp/ChangeLog:
      
      	* module.cc (module_preprocess_options): Don't override it.
      
      libcpp/ChangeLog:
      
      	* internal.h (search_path_head): Declare.
      	* files.cc (search_path_head): No longer static.
      	* init.cc (cpp_read_main_file): Use it.
      dbfbd3aa
    • Jason Merrill's avatar
      libstdc++: add module std [PR106852] · 7db55c0b
      Jason Merrill authored
      This patch introduces an installed source form of module std and std.compat.
      To help a build system find them, we install a libstdc++.modules.json file
      alongside libstdc++.so, which tells the build system where the files are and
      any special flags it should use when compiling them (none, in this case).
      The format is from a proposal in SG15.  The build system can find this file
      with 'gcc -print-file-name=libstdc++.modules.json'.
      
      It seems preferable to use a relative path from this file to the sources so
      that moving the installation doesn't break the reference, but I didn't see
      any obvious way to compute that without relying on coreutils, perl, or
      python, so I wrote a POSIX shell script for it.  The .. canonicalization
      bits aren't necessary since I discovered $(abspath), but I guess I might as
      well leave them in.
      
      Currently this installs the sources under $(gxx_include_dir)/bits/,
      i.e. /usr/include/c++/15/bits.  So with my -fsearch-include-path change,
      std.cc can be compiled with g++ -fsearch-include-path bits/std.cc.  Note
      that if someone actually tries to #include <bits/std.cc> it will fail with
      "error: module control-line cannot be in included file".
      
      Any ideas about a more user-friendly way to express "compile module std" are
      welcome.
      
      The sources currently have the extension .cc, like other source files.
      
      std.cc started with m.cencora's implementation in PR114600.  I've made some
      adjustments, but more is probably desirable, e.g. of the <algorithm>
      handling of namespace ranges, and to remove exports of templates that are
      only specialized in a particular header.  I've filled in a bunch of missing
      exports, and added some FIXMEs where I noticed bits that are not implemented
      yet.
      
      Since bits/stdc++.h also intends to include the whole standard library, I
      include it rather than duplicate it.  But stdc++.h comments out <execution>,
      due to TBB issues; I include it separately and suppress TBB usage, so module
      std won't currently provide parallel execution.
      
      It seemed most convenient for the two files to be monolithic so we don't
      need to worry about include paths.  So the C library names that module
      std.compat exports in both namespace std and :: are a block of code that is
      appended to both files, adjusted based on whether the macro STD_COMPAT is
      defined before the block.
      
      In this implementation std.compat imports std; it would also be valid for it
      to duplicate everything in std.  I see the libc++ std.compat also imports
      std.
      
      As discussed in the PR, module std is supported in C++20 mode even though it
      was added in C++23.
      
      Changes to test module std will follow in a separate patch.  In my testing
      I've noticed a few compiler bugs that break various testcases, so I don't
      expect to enable module std testing by default at first.
      
      	PR libstdc++/106852
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/version.def: Add __cpp_lib_modules.
      	* include/bits/version.h: Regenerate.
      	* src/c++23/Makefile.am: Add modules std and std.compat.
      	* src/c++23/Makefile.in: Regenerate.
      	* src/c++23/std-clib.cc.in: New file.
      	* src/c++23/std.cc.in: New file.
      	* src/c++23/std.compat.cc.in: New file.
      	* src/c++23/libstdc++.modules.json.in: New file.
      
      contrib/ChangeLog:
      
      	* relpath.sh: New file.
      7db55c0b
    • Jan Hubicka's avatar
      Mark asm statements as necessary in ipa-fnsummary · bd59f2ee
      Jan Hubicka authored
      I forgot to mark asm statements as necessary in ipa-fnsummary. This should
      mask failure of gcc.dg/guality/pr36728-2.c where the patch enabled
      cloning which breaks debug info.
      
      gcc/ChangeLog:
      
      	* ipa-fnsummary.cc (find_necessary_statements): ASM statements are
      	necessary.
      bd59f2ee
    • Gerald Pfeifer's avatar
      libstdc++: Move a gcc.gnu.org link to https · 696bd862
      Gerald Pfeifer authored
      libstdc++-v3:
      	* doc/xml/manual/intro.xml: Move a gcc.gnu.org link to https.
      	* doc/html/manual/license.html: Regenerate.
      696bd862
    • Gerald Pfeifer's avatar
      libstdc++: Update link to Angelika Langer's book · 6d52a568
      Gerald Pfeifer authored
      libstdc++-v3:
      	* doc/xml/manual/io.xml: Update link to Angelika Langer's book.
      	* doc/html/manual/streambufs.html: Regenerate.
      6d52a568
    • Jan Hubicka's avatar
      ipa-modref bits for unsequenced and reproducible · addf0228
      Jan Hubicka authored
      C attributes reproducible and unsequenced implies that calling function twice
      leads to same effect if parameters are otherwise unchanged (function call
      itself does not count).  This is bit bit stronger that modref's notion of
      nondeterminism that says that same inputs will yield same outputs (function
      call itself does count).
      
      This patch makes reproducible/unsequenced imply determinism and cleans up
      determinism handling.  By itself it is not useful, since we can not make use of it
      unless we know what are the inputs/outputs of the function which I plan to handle
      by the "fn spec" attribute.
      
      gcc/ChangeLog:
      
      	* ipa-modref.cc (modref_summary::useful_p): const/pure implies
      	determinism.
      	(modref_summary_lto::useful_p): Likewise.
      	(ignore_nondeterminism_p): Add CALLEE_FNTYPE parameter; check for
      	reproducible/unsequenced
      	(modref_access_analysis::record_access_p): Use ignore_nondeterminism_p
      	when handling volatile accesses.
      	(modref_access_analysis::get_access_for_fnspec): Update.
      	(modref_access_analysis::process_fnspec): Cleanup handling of NOVOPS.
      	(modref_access_analysis::analyze_call): Use ignore_nondeterminism_p
      	when handling asm statements.
      	(modref_access_analysis::analyze_stmt): Update.
      	(propagate_unknown_call): Update.
      	(modref_propagate_in_scc): Update.
      	(ipa_merge_modref_summary_after_inlining): Update.
      addf0228
    • Jan Hubicka's avatar
      Add __builtion_unreachable to vector::size(), vector::capacity() · aac5c57e
      Jan Hubicka authored
      This patch makes it clear that vector sizes and capacities are not
      negative.  With recent change to ipa-fnsummary this should not affect
      inlining and improves codegen of some vector manipulation functions.
      
      I tested clang build.  Looking for throw_bad calls there are only 3
      called considerably often (bad_allloc, bad_array_new_length and
      function_callv).
      The patch seems to reduce bad_alloc and bad_array_new_length calls
      considerably:
      
      bad_alloc 380->147
      bad_array_new_length 832->128
      
      libstdc++-v3/ChangeLog:
      
      	PR tree-optimization/109442
      	* include/bits/stl_vector.h: (vector::size(),
      	vector::capacity()): Add __builtin_unreachable call to announce
      	that size and capacity are non-negative.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/109442
      	* g++.dg/tree-ssa/pr109442.C: New test.
      aac5c57e
    • GCC Administrator's avatar
      Daily bump. · a649efea
      GCC Administrator authored
      a649efea
  3. Nov 16, 2024
    • Jan Hubicka's avatar
      Avoid expicit builtion list in tree-ssa-dce · cc33f880
      Jan Hubicka authored
      while working on -fmalloc-dce I noticed that tree-ssa-dce.cc still has an
      outdated list of builtions that are known to not read memory that can be
      replaced by query to fnspec and modref.
      
      If I get things right, dce does some dead store removal, but only on those
      memory object that are non-aliased (automatic variabels with no address taken)
      and for all other memory addresses it resorts to
      mark_all_reaching_defs_necessary expecting DSE to do the rest.  So we really
      want to only check if there are no memory reads at all rather then trying to
      understand them by parsing fnspec or modref summary.
      
      I did run testsuite ensuring that all builtins matched previously are
      still matched.  There are few testcases where this check fails, due to
      type incompatibility.  New code uses gimple_call_builtin while other
      just checked callee_decl.
      
      We test things like calling free() without parmeter which I don't think
      we want to care about, but there is also testase declaring
      
      void * calloc (long, long)
      
      where builtin declaration expects unsigned long.  I am not sure if this
      case should not be allowed by gimple_call_builtin?
      
      Bootstrappe/regtested x86_64-linux. OK?
      
      gcc/ChangeLog:
      
      	* ipa-modref.cc (ipa_modref_callee_reads_no_memory_p): New function.
      	* ipa-modref.h (ipa_modref_callee_reads_no_memory_p): Declare
      	* tree-ssa-dce.cc (propagate_necessity): Use it.
      cc33f880
    • Jan Hubicka's avatar
      Minor cleanup to cxx_init_decl_processing · 101f8c73
      Jan Hubicka authored
      gcc/cp/ChangeLog:
      
      	* decl.cc (cxx_build_operator_new): Break out from ...
      	(cxx_build_operator_delete): Break out from ...
      	(cxx_init_operator_new_delete_decls): Break out from ...
      	(cxx_init_decl_processing): ... here.
      101f8c73
    • Georg-Johann Lay's avatar
      AVR: Fix building LibF7 after switching to C23. · 307b1117
      Georg-Johann Lay authored
      Since r15-5327, GNU-C23 is being used as C language default.
      libf7.h doesn't assume headers like stdbool.h are present
      and defines bool, true and false on its own.
      
      libgcc/config/avr/libf7/
      	* libf7.h (bool, true, false): Don't define in C23 or higher.
      307b1117
    • Andrew Pinski's avatar
      match: Optimize `max(a,b) == 0` to `(a|b) == 0` for unsigned [PR115275] · b085fc99
      Andrew Pinski authored
      
      For unsigned types, you can optimize `max<a,b> == 0` into
      `(a|b) == 0` (that is both have to be zero). A similar thing happens for `!= 0`.
      This optimization fixes the missed optimization (g++.dg/tree-ssa/pr115275.C)
      that was reported exposed by adding phiprop early.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/115275
      
      gcc/ChangeLog:
      
      	* match.pd (umax(a,b) ==/!= 0): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/tree-ssa/pr115275.C: New test.
      	* gcc.dg/tree-ssa/max_eqne-1.c: New test.
      	* gcc.dg/tree-ssa/max_eqne-2.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      b085fc99
    • Eikansh Gupta's avatar
      MATCH: Simplify `min(a, b) op max(a, b)` to `a op b` [PR109401] · 5eadc673
      Eikansh Gupta authored
      
      This patch simplify `min(a,b) op max(a,b)` to `a op b`. This optimization
      will work for all the binary commutative operations. So, the `op` here can
      be one of {plus, mult, bit_and, bit_xor, bit_ior, eq, ne, min, max}.
      
      	PR tree-optimization/109401
      
      gcc/ChangeLog:
      
      	* match.pd (min(a,b) op max(a,b) -> a op b): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/pr109401.c: New test.
      	* gcc.dg/tree-ssa/pr109401-1.c: New test.
      
      Signed-off-by: default avatarEikansh Gupta <quic_eikagupt@quicinc.com>
      5eadc673
    • Andrew Pinski's avatar
      libiberity: ANSIfy test-demangle.c · 94bea5dd
      Andrew Pinski authored
      
      Some of the function definitions used K&R style definitions (but not all).
      This just moves them all to be ANSI C
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      libiberty/ChangeLog:
      
      	* testsuite/test-demangle.c (get_line): Change K&R style
      	definition into ANSI C90 definitions.
      	(fail): Likewise.
      	(main): Likewise.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      94bea5dd
    • Georg-Johann Lay's avatar
      AVR: target/116781 - Fix ICE due to (clobber (match_dup)) in tablejump. · 083892ba
      Georg-Johann Lay authored
      This patch avoids (clobber (match_dup)) in insn patterns for tablejump.
      The machine description now uses a scratch_operand instead which is
      possible since the clobbered entity is known in advance:
      
      3-byte PC        : REG_Z
      2-byte PC + JMP  : REG_Z
      2-byte PC + RJMP : None, hence scratch:HI is used.
      
      The avr-casesi pass and optimization has to be adjusted to the new patterns.
      
      	PR target/116781
      gcc/
      	* config/avr/avr.md (*tablejump_split, *tablejump): Add
      	operand 2 as a "scratch_operand" instead of a match_dup.
      	(casesi): Adjust expander operands accordingly.  Use a scratch:HI
      	when the jump address is not clobbered.  This is the case for a
      	2-byte PC + has no JMP instruction.  In all the other cases, the
      	affected operand is REG_Z (reg:HI 30).
      	(casesi_<mode>_sequence): Adjust matcher to new anatomy.
      	* config/avr/avr-passes.cc (avr_is_casesi_sequence)
      	(avr_is_casesi_sequence, avr_optimize_casesi)
      	(avr_casei_sequence_check_operands): Adjust to new anatomy.
      083892ba
    • Georg-Johann Lay's avatar
      AVR: target/117500 - Use output_operand_lossage in avr_print_operand. · 02d73709
      Georg-Johann Lay authored
      	PR target/117500
      gcc/
      	* config/avr/avr.cc (avr_print_operand) [code = 'i']: Use
      	output_operand_lossage on bad operands instead of fatal_insn.
      02d73709
    • Georg-Johann Lay's avatar
      AVR: Add an RTL peephole to tweak lower_reg:QI o= cst. · bbfba1cc
      Georg-Johann Lay authored
      For operations like  X o= CST, regalloc may spill l-reg X to a d-reg:
         D =  X
         D o= CST
         X =  D
      where it is better to instead
         D =  CST
         X o= D
      This patch adds an according RTL peephole.
      
      gcc/
      	* config/avr/avr.md: Add a peephole2 that improves bit operations
      	with a lower register and a constant.
      bbfba1cc
Loading