Skip to content
Snippets Groups Projects
  1. Aug 08, 2024
    • Andrew Pinski's avatar
      vect: Small C++11-ification of vect_vect_recog_func_ptrs · ad7d4843
      Andrew Pinski authored
      
      This is a small C++11-ificiation for the use of vect_vect_recog_func_ptrs.
      Changes the loop into a range based loop which then we can remove the variable
      definition of NUM_PATTERNS. Also uses const reference instead of a pointer.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      gcc/ChangeLog:
      
      	* tree-vect-patterns.cc (NUM_PATTERNS): Delete.
      	(vect_pattern_recog_1): Constify and change
      	recog_func to a reference.
      	(vect_pattern_recog): Use range-based loop over
      	vect_vect_recog_func_ptrs.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      ad7d4843
    • Jin Ma's avatar
      RISC-V: Delete duplicate '#define RISCV_DWARF_VLENB' · ecdf7a4e
      Jin Ma authored
      gcc/ChangeLog:
      
      	* config/riscv/riscv.h (RISCV_DWARF_VLENB): Delete.
      ecdf7a4e
    • Andrew Stubbs's avatar
      amdgcn: Re-enable trampolines · 6f71e050
      Andrew Stubbs authored
      The stacks are executable since the reverse-offload features were added, so
      trampolines actually do work.
      
      gcc/ChangeLog:
      
      	* config/gcn/gcn.cc (gcn_trampoline_init): Re-enable trampolines.
      6f71e050
    • Jeff Law's avatar
      [RISC-V][PR target/116240] Ensure object is a comparison before extracting arguments · 190ad812
      Jeff Law authored
      This was supposed to go out the door yesterday, but I kept getting interrupted.
      
      The target bits for rtx costing can't assume the rtl they're given actually
      matches a target pattern.   It's just kind of inherent in how the costing
      routines get called in various places.
      
      In this particular case we're trying to cost a conditional move:
      
      (set (dest) (if_then_else (cond) (true) (false))
      
      On the RISC-V port the backend only allows actual conditionals for COND.  So
      something like (eq (reg) (const_int 0)).  In the costing code for if-then-else
      we did something like
      
      (XEXP (XEXP (cond, 0), 0)))
      
      Which fails miserably if COND is a terminal node like (reg) rather than (ne
      (reg) (const_int 0)
      
      So this patch tightens up the RTL scanning to ensure that we have a comparison
      before we start looking at the comparison's arguments.
      
      Run through my tester without incident, but I'll wait for the pre-commit tester
      to run through a cycle before pushing to the trunk.
      
      Jeff
      
      ps.   We probably could support a naked REG for the condition and internally convert it to (ne (reg) (const_int 0)), but I don't think it likely happens with any regularity.
      
      	PR target/116240
      gcc/
      	* config/riscv/riscv.cc (riscv_rtx_costs): Ensure object is a
      	comparison before looking at its arguments.
      
      gcc/testsuite
      	* gcc.target/riscv/pr116240.c: New test.
      190ad812
    • Manolis Tsamis's avatar
      Rearrange SLP nodes with duplicate statements [PR98138] · ab187858
      Manolis Tsamis authored
      This change checks when a two_operators SLP node has multiple occurrences of
      the same statement (e.g. {A, B, A, B, ...}) and tries to rearrange the operands
      so that there are no duplicates. Two vec_perm expressions are then introduced
      to recreate the original ordering. These duplicates can appear due to how
      two_operators nodes are handled, and they prevent vectorization in some cases.
      
      This targets the vectorization of the SPEC2017 x264 pixel_satd functions.
      In some processors a larger than 10% improvement on x264 has been observed.
      
      	PR tree-optimization/98138
      
      gcc/ChangeLog:
      
      	* tree-vect-slp.cc: Avoid duplicates in two_operators nodes.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/aarch64/vect-slp-two-operator.c: New test.
      ab187858
    • Nathaniel Shead's avatar
      c++: Propagate TREE_ADDRESSABLE in fixup_type_variants [PR115062] · 71aebb36
      Nathaniel Shead authored
      
      This has caused issues with modules when an import fills in the
      definition of a type already created with a typedef.
      
      	PR c++/115062
      
      gcc/cp/ChangeLog:
      
      	* class.cc (fixup_type_variants): Propagate TREE_ADDRESSABLE.
      	(finish_struct_bits): Cleanup now that TREE_ADDRESSABLE is
      	propagated by fixup_type_variants.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/pr115062_a.H: New test.
      	* g++.dg/modules/pr115062_b.H: New test.
      	* g++.dg/modules/pr115062_c.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      71aebb36
    • Nathaniel Shead's avatar
      c++/modules: Assume header bindings are global module · 0de1481a
      Nathaniel Shead authored
      
      While stepping through some code I noticed that we do some extra work
      (finding the originating module decl, stripping the template, and
      inspecting the attached-ness) for every declaration taken from a header
      unit.  This doesn't seem necessary though since no declaration in a
      header unit can be attached to anything but the global module, so we can
      just assume that global_p will be true.
      
      This was the original behaviour before I removed this assumption while
      refactoring for r15-2807-gc592310d5275e0.
      
      gcc/cp/ChangeLog:
      
      	* module.cc (module_state::read_cluster): Assume header module
      	declarations will require GM merging.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      0de1481a
    • Tobias Burnus's avatar
      libgomp/libgomp.texi: Mention -fno-builtin-omp_is_initial_device · 8b5a8b1f
      Tobias Burnus authored
      libgomp/ChangeLog:
      
      	* libgomp.texi (omp_is_initial_device): Mention
      	-fno-builtin-omp_is_initial_device and folding by default.
      8b5a8b1f
    • Roger Sayle's avatar
      i386: Tweak ix86_mode_can_transfer_bits to restore bootstrap on RHEL. · 4d44f3fc
      Roger Sayle authored
      This minor patch, very similar to one posted and approved previously at
      https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657229.html is
      required to restore builds on systems using gcc 4.8 as a host compiler.
      Using the enumeration constants E_SFmode and E_DFmode avoids issues with
      SFmode and DFmode being "non-literal types in constant expressions".
      
      2024-08-08  Roger Sayle  <roger@nextmovesoftware.com>
      
      gcc/ChangeLog
      	* config/i386/i386.cc (ix86_mode_can_transfer_bits): Use E_?Fmode
      	enumeration constants in switch statement.
      4d44f3fc
    • Jakub Jelinek's avatar
      c++, libstdc++: Implement C++26 P2747R2 - constexpr placement new [PR115744] · afa3a4a5
      Jakub Jelinek authored
      With the PR115754 fix in, constexpr placement new mostly just works,
      so this patch just adds constexpr keyword to the placement new operators
      in <new>, adds FTMs and testsuite coverage.
      
      There is one accepts-invalid though, the
      new (p + 1) int[]{2, 3};      // error (in this paper)
      case from the paper.  Can we handle that incrementally?
      The problem with that is I think calling operator new now that it is
      constexpr should be fine even in that case in constant expressions, so
      int *p = std::allocator<int>{}.allocate(3);
      int *q = operator new[] (sizeof (int) * 2, p + 1);
      should be ok, so it can't be easily the placement new operator call
      itself on whose constexpr evaluation we try something special, it should
      be on the new expression, but constexpr.cc actually sees only
      <<< Unknown tree: expr_stmt
        (void) (TARGET_EXPR <D.2640, (void *) TARGET_EXPR <D.2641, VIEW_CONVERT_EXPR<int *>(b) + 4>>, TARGET_EXPR <D.2642, operator new [] (8, NON_LVALUE_EXPR <D.2640>)>,   int * D.2643;
        <<< Unknown tree: expr_stmt
          (void) (D.2643 = (int *) D.2642) >>>;
      and that is just fine by the preexisting constexpr evaluation rules.
      
      Should build_new_1 emit some extra cast for the array cases with placement
      new in maybe_constexpr_fn (current_function_decl) that the existing P2738
      code would catch?
      
      2024-08-08  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/115744
      gcc/c-family/
      	* c-cppbuiltin.cc (c_cpp_builtins): Change __cpp_constexpr
      	from 202306L to 202406L for C++26.
      gcc/testsuite/
      	* g++.dg/cpp2a/construct_at.h (operator new, operator new[]):
      	Use constexpr instead of inline if __cpp_constexpr >= 202406L.
      	* g++.dg/cpp26/constexpr-new1.C: New test.
      	* g++.dg/cpp26/constexpr-new2.C: New test.
      	* g++.dg/cpp26/constexpr-new3.C: New test.
      	* g++.dg/cpp26/feat-cxx26.C (__cpp_constexpr): Adjust expected
      	value.
      libstdc++-v3/
      	* libsupc++/new (__glibcxx_want_constexpr_new): Define before
      	including bits/version.h.
      	(_GLIBCXX_PLACEMENT_CONSTEXPR): Define.
      	(operator new, operator new[]): Use it for placement new instead
      	of inline.
      	* include/bits/version.def (constexpr_new): New FTM.
      	* include/bits/version.h: Regenerate.
      afa3a4a5
    • Tobias Burnus's avatar
      libgomp.c++/static-aggr-constructor-destructor-{1,2}.C: Fix scan-tree-dump · e3a6dec3
      Tobias Burnus authored
      In principle, the optimized dump should be the same on the host, but as
      'nohost' is not handled, is is present. However when ENABLE_OFFLOADING is
      false, it is handled early enough to remove the function.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: Split
      	scan-tree-dump into with and without target offload_target_any.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C:
      	Likewise.
      e3a6dec3
    • Iain Sandoe's avatar
      Ada, libgnarl: Fix s-taprop__posix.adb compilation. · 6db71509
      Iain Sandoe authored
      
      Bootstrap on Darwin, and likely any other targets using the posix
      implementation of s-taprop was broken by commits between r15-2743
      and r15-2747:
      s-taprop.adb:297:15: error: "size_t" is not visible
      s-taprop.adb:297:15: error: multiple use clauses cause hiding
      s-taprop.adb:297:15: error: hidden declaration at s-osinte.ads:58
      s-taprop.adb:297:15: error: hidden declaration at i-c.ads:9
      
      This seems to be caused by an omitted change to use Interfaces.C.size_t
      instead of just size_t.  Fixed thus.
      
      gcc/ada/ChangeLog:
      
      	* libgnarl/s-taprop__posix.adb (Stack_Guard): Use Interfaces.C.size_t
      	for the type of Page_Size.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      6db71509
    • Rainer Orth's avatar
      ada: Fix s-taprop__solaris.adb compilation · 82ed4d51
      Rainer Orth authored
      Solaris Ada bootstrap is broken as of 2024-08-06 with
      
      s-taprop.adb:1971:23: error: "int" is not visible
      s-taprop.adb:1971:23: error: multiple use clauses cause hiding
      s-taprop.adb:1971:23: error: hidden declaration at s-osinte.ads:51
      s-taprop.adb:1971:23: error: hidden declaration at i-c.ads:62
      
      because one instance of int isn't qualified.  This patch fixes this.
      
      Bootstrapped without regressions on i386-pc-solaris2.11 and
      sparc-sun-solaris2.11.
      
      2024-08-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	gcc/ada:
      	* libgnarl/s-taprop__solaris.adb (Set_Task_Affinity): Fully
      	quality int.
      82ed4d51
    • Richard Biener's avatar
      tree-optimization/116258 - fix i386 testcase · 5aa4cd91
      Richard Biener authored
      With -march=cascadelake we use vpermilps instead of shufps.
      
      	PR tree-optimization/116258
      	* gcc.target/i386/pr116258.c: Also allow vpermilps.
      5aa4cd91
    • Surya Kumari Jangala's avatar
      lra: emit caller-save register spills before call insn [PR116028] · 3c67a0fa
      Surya Kumari Jangala authored
      LRA emits insns to save caller-save registers in the
      inheritance/splitting pass. In this pass, LRA builds EBBs (Extended
      Basic Block) and traverses the insns in the EBBs in reverse order from
      the last insn to the first insn. When LRA sees a write to a pseudo (that
      has been assigned a caller-save register), and there is a read following
      the write, with an intervening call insn between the write and read,
      then LRA generates a spill immediately after the write and a restore
      immediately before the read. The spill is needed because the call insn
      will clobber the caller-save register.
      
      If there is a write insn and a call insn in two separate BBs but
      belonging to the same EBB, the spill insn gets generated in the BB
      containing the write insn. If the write insn is in the entry BB, then
      the spill insn that is generated in the entry BB prevents shrink wrap
      from happening. This is because the spill insn references the stack
      pointer and hence the prolog gets generated in the entry BB itself.
      
      This patch ensures the the spill insn is generated before the call insn
      instead of after the write. This also ensures that the spill occurs
      only in the path containing the call.
      
      2024-08-01  Surya Kumari Jangala  <jskumari@linux.ibm.com>
      
      gcc:
      	PR rtl-optimization/116028
      	* lra-constraints.cc (split_reg): Spill register before call
      	insn.
      	(latest_call_insn): New variable.
      	(inherit_in_ebb): Track the latest call insn.
      
      gcc/testsuite:
      	PR rtl-optimization/116028
      	* gcc.dg/ira-shrinkwrap-prep-1.c: Remove xfail for powerpc.
      	* gcc.dg/pr10474.c: Remove xfail for powerpc.
      3c67a0fa
    • Jiawei's avatar
      RISC-V: Minimal support for Zimop extension. · c8f3fdd5
      Jiawei authored
      This patch support Zimop and Zcmop extension[1].To enable GCC to recognize
      and process Zimop and Zcmop extension correctly at compile time.
      
      https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
      
      gcc/ChangeLog:
      
      	* common/config/riscv/riscv-common.cc: New extension.
      	* config/riscv/riscv.opt: New mask.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/arch-42.c: New test.
      	* gcc.target/riscv/arch-43.c: New test.
      c8f3fdd5
    • Nathaniel Shead's avatar
      c++/modules: Handle instantiating already tsubsted template friend classes [PR115801] · 79209273
      Nathaniel Shead authored
      
      With modules it may be the case that a template friend class provided
      with a qualified name is not found by name lookup at instantiation time,
      due to the class not being exported from its module.  This causes issues
      in tsubst_friend_class which did not handle this case.
      
      This is caused by the named friend class not actually requiring
      tsubsting.  This was already worked around for the "found by name
      lookup" case (g++.dg/template/friend5.C), but it looks like there's no
      need to do name lookup at all for this particular case to work.
      
      We do need to be careful to continue to do name lookup to handle
      templates from an outer current instantiation though; this patch adds a
      new testcase for this as well.  This should not impact modules (because
      exportingness will only affect namespace lookup).
      
      	PR c++/115801
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (tsubst_friend_class): Return the type immediately when
      	no tsubsting or name lookup is required.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/tpl-friend-16_a.C: New test.
      	* g++.dg/modules/tpl-friend-16_b.C: New test.
      	* g++.dg/template/friend82.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarPatrick Palka <ppalka@redhat.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      79209273
    • Nathaniel Shead's avatar
      c++/modules: Fix merging of GM entities in partitions [PR114950] · c592310d
      Nathaniel Shead authored
      
      Currently name lookup generally seems to assume that all entities
      declared within a named module (partition) are attached to said module,
      which is not true for GM entities (e.g. via extern "C++"), and causes
      issues with deduplication.
      
      This patch fixes the issue by ensuring that module attachment of a
      declaration is consistently used to handling merging.  Handling this
      exposes some issues with deduplicating temploid friends; to resolve this
      we always create the BINDING_SLOT_PARTITION slot so that we have
      somewhere to place attached names (from any module).
      
      This doesn't yet completely handle issues with allowing otherwise
      conflicting temploid friends from different modules to co-exist in the
      same module if neither are reachable from the other via name lookup.
      
      	PR c++/114950
      
      gcc/cp/ChangeLog:
      
      	* module.cc (trees_out::decl_value): Stream bit indicating
      	imported temploid friends early.
      	(trees_in::decl_value): Use this bit with key_mergeable.
      	(trees_in::key_mergeable): Allow merging attached declarations
      	if they're imported temploid friends (which must be namespace
      	scope).
      	(module_state::read_cluster): Check for GM entities that may
      	require merging even when importing from partitions.
      	* name-lookup.cc (enum binding_slots): Adjust comment.
      	(get_fixed_binding_slot): Always create partition slot.
      	(name_lookup::search_namespace_only): Support binding vectors
      	with both partition and GM entities to dedup.
      	(walk_module_binding): Likewise.
      	(name_lookup::adl_namespace_fns): Likewise.
      	(set_module_binding): Likewise.
      	(check_module_override): Use attachment of the decl when
      	checking overrides rather than named_module_p.
      	(lookup_imported_hidden_friend): Use partition slot for finding
      	mergeable template bindings.
      	* name-lookup.h (set_module_binding): Split mod_glob_flag
      	parameter into separate global_p and partition_p params.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/tpl-friend-13_e.C: Adjust error message.
      	* g++.dg/modules/ambig-2_a.C: New test.
      	* g++.dg/modules/ambig-2_b.C: New test.
      	* g++.dg/modules/part-9_a.C: New test.
      	* g++.dg/modules/part-9_b.C: New test.
      	* g++.dg/modules/part-9_c.C: New test.
      	* g++.dg/modules/tpl-friend-15.h: New test.
      	* g++.dg/modules/tpl-friend-15_a.C: New test.
      	* g++.dg/modules/tpl-friend-15_b.C: New test.
      	* g++.dg/modules/tpl-friend-15_c.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      c592310d
    • Nathaniel Shead's avatar
      c++/modules: Clarify error message in read_enum_def · c0ad382c
      Nathaniel Shead authored
      
      This error message reads to me the wrong way around, particularly in the
      context of other errors.  Updated so that the ellipsis connect.
      
      gcc/cp/ChangeLog:
      
      	* module.cc (trees_in::read_enum_def): Clarify error.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/enum-bad-1_b.C: Update error message.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      c0ad382c
    • GCC Administrator's avatar
      Daily bump. · ea973bd4
      GCC Administrator authored
      ea973bd4
  2. Aug 07, 2024
    • Ian Lance Taylor's avatar
    • Iain Sandoe's avatar
      Darwin: Recognise -weak_framework in the driver [PR116237]. · 4cec7bc7
      Iain Sandoe authored
      
      XCode compilers recognise the weak_framework linker option in the driver
      and forward it.  This patch makes GCC adopt the same behaviour.
      
      	PR target/116237
      
      gcc/ChangeLog:
      
      	* config/darwin.h (SUBTARGET_DRIVER_SELF_SPECS): Add a spec for
      	weak_framework.
      	* config/darwin.opt: Handle weak_framework driver option.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      4cec7bc7
    • Patrick Palka's avatar
      c++: erroneous partial spec vs primary tmpl [PR116064] · d1fc9816
      Patrick Palka authored
      
      When a partial specialization is deemed erroneous at parse time, we
      currently flag the primary template as erroneous instead.  Later
      at instantiation time we check if the primary template is erroneous
      rather than the selected partial specialization, so at least we're
      consistent.
      
      But it's better not to conflate a partial specialization with the
      primary template since they're instantiated independenty.  This avoids
      rejecting the instantiation of A<int> in the below testcase.
      
      	PR c++/116064
      
      gcc/cp/ChangeLog:
      
      	* error.cc (get_current_template): If the current scope is
      	a partial specialization, return it instead of the primary
      	template.
      	* pt.cc (instantiate_class_template): Pass the partial
      	specialization if any to maybe_diagnose_erroneous_template
      	instead of the primary template.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/permissive-error2.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      d1fc9816
    • Prathamesh Kulkarni's avatar
      Partially support streaming of poly_int for offloading. · 38900247
      Prathamesh Kulkarni authored
      
      When offloading is enabled, the patch streams out host
      NUM_POLY_INT_COEFFS, and changes streaming in as follows:
      
      if (host_num_poly_int_coeffs <= NUM_POLY_INT_COEFFS)
      {
        for (i = 0; i < host_num_poly_int_coeffs; i++)
          poly_int.coeffs[i] = stream_in coeff;
        for (; i < NUM_POLY_INT_COEFFS; i++)
          poly_int.coeffs[i] = 0;
      }
      else
      {
        for (i = 0; i < NUM_POLY_INT_COEFFS; i++)
          poly_int.coeffs[i] = stream_in coeff;
      
        /* Ensure that degree of poly_int <= accel NUM_POLY_INT_COEFFS.  */
        for (; i < host_num_poly_int_coeffs; i++)
          {
            val = stream_in coeff;
            if (val != 0)
      	error ();
          }
      }
      
      gcc/ChangeLog:
      	PR ipa/96265
      	PR ipa/111937
      	* data-streamer-in.cc (streamer_read_poly_uint64): Remove code for
      	streaming, and call poly_int_read_common instead.
      	(streamer_read_poly_int64): Likewise.
      	* data-streamer.cc (host_num_poly_int_coeffs): Conditionally define
      	new variable if ACCEL_COMPILER is defined.
      	* data-streamer.h (host_num_poly_int_coeffs): Declare.
      	(poly_int_read_common): New function template.
      	(bp_unpack_poly_value): Remove code for streaming and call
      	poly_int_read_common instead.
      	* lto-streamer-in.cc (lto_input_mode_table): Stream-in host
      	NUM_POLY_INT_COEFFS into host_num_poly_int_coeffs if ACCEL_COMPILER
      	is defined.
      	* lto-streamer-out.cc (lto_write_mode_table): Stream out
      	NUM_POLY_INT_COEFFS if offloading is enabled.
      	* poly-int.h (MAX_NUM_POLY_INT_COEFFS_BITS): New macro.
      	* tree-streamer-in.cc (lto_input_ts_poly_tree_pointers): Adjust
      	streaming-in of poly_int.
      
      Signed-off-by: default avatarPrathamesh Kulkarni <prathameshk@nvidia.com>
      38900247
    • Jakub Jelinek's avatar
      Don't call clean_symbol_name in create_tmp_var_name [PR116219] · 165e3e7c
      Jakub Jelinek authored
      SRA adds fancy names like offset$D94316$_M_impl$D93629$_M_start
      where the numbers in there are DECL_UIDs if there are unnamed
      FIELD_DECLs etc.
      Because -g0 vs. -g can cause differences between the exact DECL_UID
      values (add bigger gaps in between them, corresponding decls should
      still be ordered the same based on DECL_UID) we make sure such
      decls have DECL_NAMELESS set and depending on exact options either don't
      dump such names at all or dump_fancy_name sanitizes the D123456$ parts in
      there to Dxxxx$.
      Unfortunately in tons of places we then use get_name to grab either user
      names or these SRA created names and use that as argument to
      create_tmp_var{,_name,_raw} to base other artificial temporary names based
      on that.  Those are DECL_NAMELESS too, but unfortunately create_tmp_var_name
      starting with
      https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=725494f6e4121eace43b7db1202f8ecbf52a8276
      calls clean_symbol_name which replaces the $s in there with _s and thus
      dump_fancy_name doesn't sanitize it anymore.
      
      I don't see any discussion of that commit (originally to TM branch, later
      merged) on the mailing list, but from
         DECL_NAME (new_decl)
           = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (old_decl)));
      -  SET_DECL_ASSEMBLER_NAME (new_decl, NULL_TREE);
      +  SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
      snippet elsewhere in that commit it seems create_tmp_var_name was used at
      that point also to determine function names of clones, so presumably the
      clean_symbol_name at that point was to ensure the symbol could be emitted
      into assembly, maybe in case DECL_NAME is something like C++ operators or
      whatever could have there undesirable characters.
      
      Anyway, we don't do that for years anymore, already GCC 4.5 uses for such
      purposes clone_function_name which starts of DECL_ASSEMBLER_NAME of the old
      function and appends based on supportable symbol suffix separators the
      separator and some suffix and/or number, so that part doesn't go through
      create_tmp_var_name.
      
      I don't see problems with having the $ and . etc. characters in the names
      intended just to make dumps more readable, after all, we already are using
      those in the SRA created names.  Those names shouldn't make it into the
      assembly in any way, neither debug info nor assembly labels.
      
      There is one theoretical case, where the gimplifier promotes automatic
      vars into TREE_STATIC ones and therefore those can then appear in assembly,
      just in case it would be on e.g. SRA created names and regimplified later.
      Because no cases of promotion of DECL_NAMELESS vars to static was observed in
      {x86_64,i686,powerpc64le}-linux bootstraps/regtests, the code simply uses
      C.NNN names for DECL_NAMELESS vars like it does for !DECL_NAME vars.
      
      Richi mentioned on IRC that the non-cleaned up names might make things
      harder to feed stuff back to the GIMPLE FE, but if so, I think it should be
      the dumping for GIMPLE FE purposes that cleans those up (but at that point
      it should also verify if some such cleaned up names don't collide with
      others and somehow deal with those).
      
      2024-08-07  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/116219
      	* gimple-expr.cc (remove_suffix): Formatting fixes.
      	(create_tmp_var_name): Don't call clean_symbol_name.
      	* gimplify.cc (gimplify_init_constructor): When promoting automatic
      	DECL_NAMELESS vars to static, don't preserve their DECL_NAME.
      165e3e7c
    • Tobias Burnus's avatar
      OpenMP: Constructors and destructors for "declare target" static aggregates · f1bfba3a
      Tobias Burnus authored
      
      This commit also compile-time expands (__builtin_)omp_is_initial_device for
      both Fortran and C/C++ (unless, -fno-builtin-omp_is_initial_device is used).
      But the main change is:
      
      This commit adds support for running constructors and destructors for
      static (file-scope) aggregates for C++ objects which are marked with
      "declare target" directives on OpenMP offload targets.
      
      Before this commit, space is allocated on the target for such aggregates,
      but nothing ever constructs them properly, so they end up zero-initialised.
      
      (See the new test static-aggr-constructor-destructor-3.C for a reason
      why running constructors on the target is preferable to e.g. constructing
      on the host and then copying the resulting object to the target.)
      
      2024-08-07  Julian Brown  <julian@codesourcery.com>
      	    Tobias Burnus  <tobias@baylibre.com>
      
      gcc/ChangeLog:
      
      	* builtins.def (DEF_GOMP_BUILTIN_COMPILER): Define
      	DEF_GOMP_BUILTIN_COMPILER to handle the non-prefix version.
      	* gimple-fold.cc (gimple_fold_builtin_omp_is_initial_device): New.
      	(gimple_fold_builtin): Call it.
      	* omp-builtins.def (BUILT_IN_OMP_IS_INITIAL_DEVICE): Define.
      	* tree.cc (get_file_function_name): Support names for on-target
      	constructor/destructor functions.
      
      gcc/cp/
      	* decl2.cc (tree-inline.h): Include.
      	(static_init_fini_fns): Bump to four entries. Update comment.
      	(start_objects, start_partial_init_fini_fn): Add 'omp_target'
      	parameter. Support "declare target" decls. Update forward declaration.
      	(emit_partial_init_fini_fn): Add 'host_fn' parameter. Return tree for
      	the created function. Support "declare target".
      	(OMP_SSDF_IDENTIFIER): New macro.
      	(partition_vars_for_init_fini): Support partitioning "declare target"
      	variables also.
      	(generate_ctor_or_dtor_function): Add 'omp_target' parameter. Support
      	"declare target" decls.
      	(c_parse_final_cleanups): Support constructors/destructors on OpenMP
      	offload targets.
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (gfc_option_t): Add disable_omp_is_initial_device.
      	* lang.opt (fbuiltin-): Add.
      	* options.cc (gfc_handle_option): Handle
      	-fno-builtin-omp_is_initial_device.
      	* f95-lang.cc (gfc_init_builtin_functions): Handle
      	DEF_GOMP_BUILTIN_COMPILER.
      	* trans-decl.cc (gfc_get_extern_function_decl): Add code to use
      	DEF_GOMP_BUILTIN_COMPILER for 'omp_is_initial_device'.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: New test.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C: New test.
      	* testsuite/libgomp.c++/static-aggr-constructor-destructor-3.C: New test.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host.c: New test.
      	* testsuite/libgomp.c-c++-common/target-is-initial-host-2.c: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host.f: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host.f90: New test.
      	* testsuite/libgomp.fortran/target-is-initial-host-2.f90: New test.
      
      Co-authored-by: default avatarTobias Burnus <tobias@baylibre.com>
      f1bfba3a
    • Jakub Jelinek's avatar
      c++: Implement CWG2387 - Linkage of const-qualified variable template [PR109126] · 82cd63a6
      Jakub Jelinek authored
      The following patch attempts to implement DR2387 by making variable
      templates including their specialization TREE_PUBLIC when at file
      scope and they don't have static storage class.
      
      2024-08-07  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/109126
      	* decl.cc (grokvardecl): Implement CWG 2387 - Linkage of
      	const-qualified variable template.  Set TREE_PUBLIC on variable
      	templates with const qualified types unless static is present.
      
      	* g++.dg/DRs/dr2387.C: New test.
      	* g++.dg/DRs/dr2387-aux.cc: New file.
      82cd63a6
    • Andrew Pinski's avatar
      aarch64/testsuite: Add testcases for recently fixed PRs · 2c617440
      Andrew Pinski authored
      
      The commit for PR 116258, added a x86_64 specific testcase,
      I thought it would be a good idea to add an aarch64 testcase too.
      And since it also fixed VLA vectors too so add a SVE testcase.
      
      Pushed as obvious after a test for aarch64-linux-gnu.
      
      	PR middle-end/116258
      	PR middle-end/116259
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/aarch64/pr116258.c: New test.
      	* gcc.target/aarch64/sve/pr116259-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      2c617440
    • Tobias Burnus's avatar
      libgomp.c-c++-common/target-link-2.c: Fix test on multi-device systems · aa689684
      Tobias Burnus authored
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c-c++-common/target-link-2.c: Reset variable
      	value to handle multi-device tests.
      aa689684
    • Carl Love's avatar
      rs6000, Add new overloaded vector shift builtin int128 variants · 083918a3
      Carl Love authored
      Add the signed __int128 and unsigned __int128 argument types for the
      overloaded built-ins vec_sld, vec_sldb, vec_sldw, vec_sll, vec_slo,
      vec_srdb, vec_srl, vec_sro.  For each of the new argument types add a
      testcase and update the documentation for the built-in.
      
      gcc/ChangeLog:
      	* config/rs6000/altivec.md (vs<SLDB_lr>db_<mode>): Change
      	define_insn iterator to VEC_IC.
      	* config/rs6000/rs6000-builtins.def (__builtin_altivec_vsldoi_v1ti,
      	__builtin_vsx_xxsldwi_v1ti, __builtin_altivec_vsldb_v1ti,
      	__builtin_altivec_vsrdb_v1ti): New builtin definitions.
      	* config/rs6000/rs6000-overload.def (vec_sld, vec_sldb, vec_sldw,
      	vec_sll, vec_slo, vec_srdb, vec_srl, vec_sro): New overloaded
      	definitions.
      	* doc/extend.texi (vec_sld, vec_sldb, vec_sldw, vec_sll, vec_slo,
      	vec_srdb, vec_srl, vec_sro): Add documentation for new overloaded
      	built-ins.
      
      gcc/testsuite/ChangeLog:
      	* gcc.target/powerpc/vec-shift-double-runnable-int128.c: New test
      	file.
      083918a3
    • Richard Biener's avatar
      tree-optimization/116258 - do not lower PAREN_EXPR of vectors · 5b999997
      Richard Biener authored
      The following avoids lowering of PAREN_EXPR of vectors as unsupported
      to scalars.  Instead PAREN_EXPR is like a plain move or a VIEW_CONVERT.
      
      	PR tree-optimization/116258
      	* tree-vect-generic.cc (expand_vector_operations_1): Do not
      	lower PAREN_EXPR.
      
      	* gcc.target/i386/pr116258.c: New testcase.
      5b999997
    • Roger Sayle's avatar
      testsuite: Fix recent regression of g++.dg/other/sse2-pr85572-1.C · 990a65fb
      Roger Sayle authored
      My sincere apologies for not noticing that g++.dg/other/sse2-pr85572-1.C
      was FAILing with my recent ashrv2di patch.  I'm not sure how that happened.
      Many thanks to Andrew Pinski for alerting me, and confirming that the
      changes are harmless/beneficial.  Sorry again for the inconvenience.
      
      2024-08-07  Roger Sayle  <roger@nextmovesoftware.com>
      
      gcc/testsuite/ChangeLog
      	* g++.dg/other/sse2-pr85572-1.C: Update expected output after
      	my recent patch for ashrv2di3.  Now with one less instruction.
      990a65fb
    • Simon Martin's avatar
      c++: Fix ICE on valid involving variadic constructor [PR111592] · a1999cbc
      Simon Martin authored
      We currently ICE upon the following valid code, due to the fix made through
      commit 9efe5fbd
      
      === cut here ===
      struct ignore { ignore(...) {} };
      template<class... Args>
      void InternalCompilerError(Args... args)
      { ignore{ ignore(args) ... }; }
      int main() { InternalCompilerError(0, 0); }
      === cut here ===
      
      Change 9efe5fbd avoids infinite recursion in build_over_call by returning
      error_mark_node if one invokes ignore::ignore(...) with an argument of type
      ignore, because otherwise we end up calling convert_arg_to_ellipsis for that
      argument, and recurse into build_over_call with the exact same parameters.
      
      This patch tightens the condition to only return error_mark_node if there's one
      and only one parameter to the call being processed - otherwise we won't
      infinitely recurse.
      
      Successfully tested on x86_64-pc-linux-gnu.
      
      	PR c++/111592
      
      gcc/cp/ChangeLog:
      
      	* call.cc (build_over_call): Only error out if there's a single
      	parameter of type A in a call to A::A(...).
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/variadic186.C: New test.
      a1999cbc
    • Xi Ruoyao's avatar
      vect: Fix vect_reduction_def check for odd/even widen mult [PR116142] · 2083389a
      Xi Ruoyao authored
      
      The check was implemented incorrectly, so vec_widen_smult_{even,odd}_M
      was never used.  This is not good for targets with native even/odd
      widening multiplication but not lo/hi multiplication.
      
      The fix is actually developed by Richard Biener.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/116142
      	* tree-vect-stmts.cc (supportable_widening_operation): Remove an
      	redundant and incorrect vect_reduction_def check, and fix the
      	operand of another vect_reduction_def check.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/116142
      	* gcc.target/i386/pr116142.c: New test.
      
      Co-authored-by: default avatarRichard Biener <rguenther@suse.de>
      2083389a
    • Jakub Jelinek's avatar
      c++: Fix up handling of dependent (late) attributes on function/method types [PR116175] · 9426ce98
      Jakub Jelinek authored
      When working on unsequenced/reproducible attributes, I've noticed that on
      templates for some attributes decl_attributes isn't called at all, so they
      are kept in TYPE_ATTRIBUTES without any verification/transformations and
      also without argument substitution.
      
      The following patch fixes that for FUNCTION/METHOD_TYPE attributes.
      The included testcase ICEs without the pt.cc changes.
      
      2024-08-07  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/116175
      	* pt.cc (apply_late_template_attributes): For function/method types
      	call cp_build_type_attribute_variant on the non-dependent attributes.
      	(rebuild_function_or_method_type): Add ARGS argument.  Use
      	apply_late_template_attributes rather than
      	cp_build_type_attribute_variant.
      	(maybe_rebuild_function_decl_type): Add ARGS argument, pass it to
      	rebuild_function_or_method_type.
      	(tsubst_function_decl): Adjust caller.
      	(tsubst_function_type): Adjust rebuild_function_or_method_type caller.
      
      	* g++.dg/ext/attr-format4.C: New test.
      9426ce98
    • Richard Biener's avatar
      tree-optimization/116166 - forward jump-threading going wild · 2cf89ae8
      Richard Biener authored
      Currently the forward threader isn't limited as to the search space
      it explores and with it now using path-ranger for simplifying
      conditions it runs into it became pretty slow for degenerate cases
      like compiling insn-emit.cc for RISC-V esp. when compiling for
      a host with LOGICAL_OP_NON_SHORT_CIRCUIT disabled.
      
      The following makes the forward threader honor the search space
      limit I introduced for the backward threader.  This reduces
      compile-time from minutes to seconds for the testcase in PR116166.
      
      Note this wasn't necessary before we had ranger but with ranger
      the work we do is quadatic in the length of the threading path
      we build up (the same is true for the backwards threader).
      
      	PR tree-optimization/116166
      	* tree-ssa-threadedge.h (jump_threader::thread_around_empty_blocks):
      	Add limit parameter.
      	(jump_threader::thread_through_normal_block): Likewise.
      	* tree-ssa-threadedge.cc (jump_threader::thread_around_empty_blocks):
      	Honor and decrement limit parameter.
      	(jump_threader::thread_through_normal_block): Likewise.
      	(jump_threader::thread_across_edge): Initialize limit from
      	param_max_jump_thread_paths and pass it down to workers.
      2cf89ae8
    • Kewen Lin's avatar
      testsuite, rs6000: Adjust pr78056-[1357].c and remove pr78056-[246].c · 9db55ec0
      Kewen Lin authored
      When cleaning up the remaining powerpc_{vsx,altivec}_ok test
      cases, I found some issues are related to pr78056-*.c.
      Firstly, the test points of pr78056-[246].c are no longer
      available since r9-3164 drops many HAVE_AS_* and the expected
      warning are dropped together, so this patch is to remove them.
      Secondly, pr78056-1.c and pr78056-3.c include altivec.h but
      don't use any builtins, checking powerpc_altivec is enough
      (don't need to check powerpc_vsx).  And pr78056-5.c doesn't
      require any altivec/vsx feature, so powerpc_vsx_ok can be
      removed.  Lastly, pr78056-7.c should just use powerpc_fprs
      instead of dfp_hw as it only cares about insn fcpsgn.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/pr78056-1.c: Check for powerpc_altivec rather than
      	powerpc_vsx.
      	* gcc.target/powerpc/pr78056-3.c: Likewise.
      	* gcc.target/powerpc/pr78056-5.c: Drop powerpc_vsx_ok check.
      	* gcc.target/powerpc/pr78056-7.c: Check for powerpc_fprs rather than
      	dfp_hw.
      	* gcc.target/powerpc/pr78056-2.c: Remove.
      	* gcc.target/powerpc/pr78056-4.c: Remove.
      	* gcc.target/powerpc/pr78056-6.c: Remove.
      9db55ec0
    • Kewen Lin's avatar
      testsuite, rs6000: Fix some run cases with appropriate _hw · 3ab04f1f
      Kewen Lin authored
      When cleaning up the remaining powerpc_{vsx,altivec}_ok test
      cases, I found some dg-do run test cases which should check
      for the appropriate {p8vector,vmx}_hw check instead.  This
      patch is to adjust them accordingly.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/swaps-p8-46.c: Check for p8vector_hw rather than
      	powerpc_vsx_ok.
      	* gcc.target/powerpc/ppc64-abi-2.c: Check for vmx_hw rather than
      	powerpc_altivec_ok.
      	* gcc.target/powerpc/pr96139-c.c: Likewise.
      3ab04f1f
    • Kewen Lin's avatar
      testsuite, rs6000: Replace powerpc_vsx_ok with powerpc_vsx · cdca2387
      Kewen Lin authored
      Following up the previous r15-886, this patch to clean up
      the remaining powerpc_vsx_ok which actually should use
      powerpc_vsx instead.
      
      	PR testsuite/114842
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/error-1.c: Replace powerpc_vsx_ok check with
      	powerpc_vsx.
      	* gcc.target/powerpc/warn-2.c: Likewise.
      	* gcc.target/powerpc/fold-vec-logical-ors-longlong.c: Likewise.
      	* gcc.target/powerpc/ppc-fortran/pr80108-1.f90: Replace powerpc_vsx_ok
      	check with powerpc_vsx and remove useless -mfloat128.
      	* gcc.target/powerpc/pragma_power8.c: Replace powerpc_vsx_ok check with
      	powerpc_vsx.
      cdca2387
    • Kewen Lin's avatar
      testsuite, rs6000: Replace powerpc_vsx_ok with powerpc_altivec etc. · 4ddd886f
      Kewen Lin authored
      This is a follow up patch for the previous patch adjusting
      powerpc_vsx_ok with powerpc_vsx, focusing on those test cases
      which don't really require VSX feature but used powerpc_vsx_ok
      before, they actually require some other effective target check,
      like some of them just require ALTIVEC feature, some of them
      just require hard float support, and some of them just require
      ISA 2.06 etc..
      
      By the way, ppc-fpconv-4.c is the only one missing powerpc_fprs
      among ppc-fpconv-*.c after this replacement, so I also fix it
      here.
      
      	PR testsuite/114842
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/bswap64-2.c: Replace powerpc_vsx_ok check with
      	has_arch_pwr7.
      	* gcc.target/powerpc/ppc-fpconv-2.c: Replace powerpc_vsx_ok check with
      	powerpc_fprs.
      	* gcc.target/powerpc/ppc-fpconv-6.c: Likewise.
      	* gcc.target/powerpc/ppc-pow.c: Likewise.
      	* gcc.target/powerpc/ppc-target-1.c: Likewise.
      	* gcc.target/powerpc/ppc-target-2.c: Likewise.
      	* gcc.target/powerpc/ppc-target-3.c: Likewise.
      	* gcc.target/powerpc/ppc-target-4.c: Likewise.
      	* gcc.target/powerpc/ppc-fpconv-4.c: Check for powerpc_fprs.
      	* gcc.target/powerpc/fold-vec-select-char.c: Replace powerpc_vsx_ok
      	with powerpc_altivec check and move it after dg-options line.
      	* gcc.target/powerpc/fold-vec-select-float.c: Likewise.
      	* gcc.target/powerpc/fold-vec-select-int.c: Likewise.
      	* gcc.target/powerpc/fold-vec-select-short.c: Likewise.
      	* gcc.target/powerpc/p9-novsx.c: Likewise.
      	* gcc.target/powerpc/p9-options-1.c: Likewise.
      4ddd886f
Loading