Skip to content
Snippets Groups Projects
  1. Jul 16, 2023
  2. Jul 15, 2023
  3. Jul 14, 2023
    • Uros Bizjak's avatar
      cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] · bef95ba0
      Uros Bizjak authored
      cprop1 pass does not consider paradoxical subreg and for (insn 22) claims
      that it equals 8 elements of HImodeby setting REG_EQUAL note:
      
      (insn 21 19 22 4 (set (reg:V4QI 98)
              (mem/u/c:V4QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0  S4 A32])) "pr110206.c":12:42 1530 {*movv4qi_internal}
           (expr_list:REG_EQUAL (const_vector:V4QI [
                      (const_int -52 [0xffffffffffffffcc]) repeated x4
                  ])
              (nil)))
      (insn 22 21 23 4 (set (reg:V8HI 100)
              (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI (reg:V4QI 98) 0)
                      (parallel [
                              (const_int 0 [0])
                              (const_int 1 [0x1])
                              (const_int 2 [0x2])
                              (const_int 3 [0x3])
                              (const_int 4 [0x4])
                              (const_int 5 [0x5])
                              (const_int 6 [0x6])
                              (const_int 7 [0x7])
                          ])))) "pr110206.c":12:42 7471 {sse4_1_zero_extendv8qiv8hi2}
           (expr_list:REG_EQUAL (const_vector:V8HI [
                      (const_int 204 [0xcc]) repeated x8
                  ])
              (expr_list:REG_DEAD (reg:V4QI 98)
                  (nil))))
      
      We rely on the "undefined" vals to have a specific value (from the earlier
      REG_EQUAL note) but actual code generation doesn't ensure this (it doesn't
      need to).  That said, the issue isn't the constant folding per-se but that
      we do not actually constant fold but register an equality that doesn't hold.
      
      	PR target/110206
      
      gcc/ChangeLog:
      
      	* fwprop.cc (contains_paradoxical_subreg_p): Move to ...
      	* rtlanal.cc (contains_paradoxical_subreg_p): ... here.
      	* rtlanal.h (contains_paradoxical_subreg_p): Add prototype.
      	* cprop.cc (try_replace_reg): Do not set REG_EQUAL note
      	when the original source contains a paradoxical subreg.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr110206.c: New test.
      
      (cherry picked from commit 1815e313)
      bef95ba0
    • Harald Anlauf's avatar
      Fortran: formal symbol attributes for intrinsic procedures [PR110288] · 447dd292
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/110288
      	* symbol.cc (gfc_copy_formal_args_intr): When deriving the formal
      	argument attributes from the actual ones for intrinsic procedure
      	calls, take special care of CHARACTER arguments that we do not
      	wrongly treat them formally as deferred-length.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/110288
      	* gfortran.dg/findloc_10.f90: New test.
      
      (cherry picked from commit 3b2c523a)
      447dd292
    • Oleg Endo's avatar
      SH: Fix PR101469 peephole bug · ef4b6d29
      Oleg Endo authored
      gcc/ChangeLog:
      
      	PR target/101469
      	* config/sh/sh.md (peephole2): Handle case where eliminated reg
      	is also	used by the address of the following memory operand.
      ef4b6d29
    • GCC Administrator's avatar
      Daily bump. · e365ddcd
      GCC Administrator authored
      e365ddcd
  4. Jul 13, 2023
  5. Jul 12, 2023
    • Jonathan Wakely's avatar
      libstdc++: Check conversion from filesystem::path to wide strings [PR95048] · db179779
      Jonathan Wakely authored
      The testcase added for this bug only checks conversion from wide strings
      on construction, but the fix also covered conversion to wide strings via
      path::wstring(). Add checks for that, and u16string() and u32string().
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/95048
      	* testsuite/27_io/filesystem/path/construct/95048.cc: Check
      	conversions to wide strings.
      	* testsuite/experimental/filesystem/path/construct/95048.cc:
      	Likewise.
      
      (cherry picked from commit d6384ad1)
      db179779
    • Mo, Zewei's avatar
      Initial Granite Rapids D Support · 037907c1
      Mo, Zewei authored
      gcc/ChangeLog:
      
      	* common/config/i386/cpuinfo.h
      	(get_intel_cpu): Handle Granite Rapids D.
      	* common/config/i386/i386-common.cc:
      	(processor_alias_table): Add graniterapids-d.
      	* common/config/i386/i386-cpuinfo.h
      	(enum processor_subtypes): Add INTEL_COREI7_GRANITERAPIDS_D.
      	* config.gcc: Add -march=graniterapids-d.
      	* config/i386/driver-i386.cc (host_detect_local_cpu):
      	Handle graniterapids-d.
      	* config/i386/i386.h: (PTA_GRANITERAPIDS_D): New.
      	* doc/extend.texi: Add graniterapids-d.
      	* doc/invoke.texi: Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.target/i386/mv16.C: Add graniterapids-d.
      	* gcc.target/i386/funcspec-56.inc: Handle new march.
      037907c1
    • GCC Administrator's avatar
      Daily bump. · c1584003
      GCC Administrator authored
      c1584003
  6. Jul 11, 2023
  7. Jul 10, 2023
    • Xi Ruoyao's avatar
      vect: Fix vectorized BIT_FIELD_REF for signed bit-fields [PR110557] · 1e6a948c
      Xi Ruoyao authored
      If a bit-field is signed and it's wider than the output type, we must
      ensure the extracted result sign-extended.  But this was not handled
      correctly.
      
      For example:
      
          int x : 8;
          long y : 55;
          bool z : 1;
      
      The vectorized extraction of y was:
      
          vect__ifc__49.29_110 =
            MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.27_108];
          vect_patt_38.30_112 =
            vect__ifc__49.29_110 & { 9223372036854775552, 9223372036854775552 };
          vect_patt_39.31_113 = vect_patt_38.30_112 >> 8;
          vect_patt_40.32_114 =
            VIEW_CONVERT_EXPR<vector(2) long int>(vect_patt_39.31_113);
      
      This is obviously incorrect.  This pach has implemented it as:
      
          vect__ifc__25.16_62 =
            MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.14_60];
          vect_patt_31.17_63 =
            VIEW_CONVERT_EXPR<vector(2) long int>(vect__ifc__25.16_62);
          vect_patt_32.18_64 = vect_patt_31.17_63 << 1;
          vect_patt_33.19_65 = vect_patt_32.18_64 >> 9;
      
      gcc/ChangeLog:
      
      	PR tree-optimization/110557
      	* tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern):
      	Ensure the output sign-extended if necessary.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/110557
      	* g++.dg/vect/pr110557.cc: New test.
      
      (cherry picked from commit 63ae6bc6)
      1e6a948c
    • GCC Administrator's avatar
      Daily bump. · f9781fcf
      GCC Administrator authored
      f9781fcf
  8. Jul 09, 2023
  9. Jul 08, 2023
  10. Jul 07, 2023
    • Iain Buclaw's avatar
      d: Fix PR 108842: Cannot use enum array with -fno-druntime · acd679a7
      Iain Buclaw authored
      Restrict the generating of CONST_DECLs for D manifest constants to just
      scalars without pointers.  It shouldn't happen that a reference to a
      manifest constant has not been expanded within a function body during
      codegen, but it has been found to occur in older versions of the D
      front-end (PR98277), so if the decl of a non-scalar constant is
      requested, just return its initializer as an expression.
      
      	PR d/108842
      
      gcc/d/ChangeLog:
      
      	* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
      	manifest constants.
      	(get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
      	constants.
      	* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
      
      gcc/testsuite/ChangeLog:
      
      	* gdc.dg/pr98277.d: Add more tests.
      	* gdc.dg/pr108842.d: New test.
      
      (cherry picked from commit f934c575)
      acd679a7
    • Richard Biener's avatar
      tree-optimization/110556 - tail merging still pre-tuples · 45e950b5
      Richard Biener authored
      The stmt comparison function for GIMPLE_ASSIGNs for tail merging
      still looks like it deals with pre-tuples IL.  The following
      attempts to fix this, not only comparing the first operand (sic!)
      of stmts but all of them plus also compare the operation code.
      
      	PR tree-optimization/110556
      	* tree-ssa-tail-merge.cc (gimple_equal_p): Check
      	assign code and all operands of non-stores.
      
      	* gcc.dg/torture/pr110556.c: New testcase.
      
      (cherry picked from commit 7b16686e)
      45e950b5
    • Richard Biener's avatar
      tree-optimization/110515 - wrong code with LIM + PRE · 0d20f9db
      Richard Biener authored
      In this PR we face the issue that LIM speculates a load when
      hoisting it out of the loop (since it knows it cannot trap).
      Unfortunately this exposes undefined behavior when the load
      accesses memory with the wrong dynamic type.  This later
      makes PRE use that representation instead of the original
      which accesses the same memory location but using a different
      dynamic type leading to a wrong disambiguation of that
      original access against another and thus a wrong-code transform.
      
      Fortunately there already is code in PRE dealing with a similar
      situation for code hoisting but that left a small gap which
      when fixed also fixes the wrong-code transform in this bug even
      if it doesn't address the underlying issue of LIM speculating
      that load.
      
      The upside is this fix is trivially safe to backport and chances
      of code generation regressions are very low.
      
      	PR tree-optimization/110515
      	* tree-ssa-pre.cc (compute_avail): Make code dealing
      	with hoisting loads with different alias-sets more
      	robust.
      
      	* g++.dg/opt/pr110515.C: New testcase.
      
      (cherry picked from commit 9f4f8334)
      0d20f9db
    • Richard Biener's avatar
      tree-optimization/110392 - ICE with predicate analysis · 980666fb
      Richard Biener authored
      Feeding not optimized IL can result in predicate normalization
      to simplify things so a predicate can get true or false.  The
      following re-orders the early exit in that case to come after
      simplification and normalization to take care of that.
      
      	PR tree-optimization/110392
      	* gimple-predicate-analysis.cc (uninit_analysis::is_use_guarded):
      	Do early exits on true/false predicate only after normalization.
      
      (cherry picked from commit ab6eac20)
      980666fb
    • Richard Biener's avatar
      tree-optimization/110381 - preserve SLP permutation with in-order reductions · 32c7f05f
      Richard Biener authored
      The following fixes a bug that manifests itself during fold-left
      reduction transform in picking not the last scalar def to replace
      and thus double-counting some elements.  But the underlying issue
      is that we merge a load permutation into the in-order reduction
      which is of course wrong.
      
      Now, reduction analysis has not yet been performend when optimizing
      permutations so we have to resort to check that ourselves.
      
      	PR tree-optimization/110381
      	* tree-vect-slp.cc (vect_optimize_slp_pass::start_choosing_layouts):
      	Materialize permutes before fold-left reductions.
      
      	* gcc.dg/vect/pr110381.c: New testcase.
      
      (cherry picked from commit 53d6f57c)
      32c7f05f
    • Li Xu's avatar
      RISC-V: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR target/110560] · 857d763e
      Li Xu authored
      This patch fixes this issue happens on GCC-13.
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
      
      This patch should be backported to GCC-13.
      GCC-14 has rewritten this function, so there is no issue.
      
      gcc/ChangeLog:
      
      	PR target/110560
      	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
      857d763e
    • Viljar Indus's avatar
      ada: Fix expanding container aggregates · 30748425
      Viljar Indus authored
      Ensure that that container aggregate expressions are expanded as
      such and not as records even if the type of the expression is a
      record.
      
      gcc/ada/
      
      	* exp_aggr.adb (Expand_N_Aggregate): Ensure that container
      	aggregate expressions do not get expanded as records but instead
      	as container aggregates.
      30748425
    • Eric Botcazou's avatar
      ada: Fix internal error on aggregate within container aggregate · b5cddeb1
      Eric Botcazou authored
      This just applies the same fix to Expand_Array_Aggregate as the one that was
      recently applied to Convert_To_Assignments.
      
      gcc/ada/
      
      	* exp_aggr.adb (Convert_To_Assignments): Tweak comment.
      	(Expand_Array_Aggregate): Do not delay the expansion if the parent
      	node is a container aggregate.
      b5cddeb1
    • Marc Poulhiès's avatar
      ada: Fix crash on vector initialization · 0fb227b9
      Marc Poulhiès authored
      Initializing a vector using
      
       Vec : V.Vector := [Some_Type'(Some_Abstract_Type with F => 0)];
      
      may crash the compiler. The expander marks the N_Extension_Aggregate for
      delayed expansion which never happens and incorrectly ends up in gigi.
      
      The delayed expansion is needed for nested aggregates, which the
      original code is testing for, but container aggregates are handled
      differently.
      
      Such assignments to container aggregates are later transformed into
      procedure calls to the procedures named in the Aggregate aspect
      definition, for which the delayed expansion is not required/expected.
      
      gcc/ada/
      
      	* exp_aggr.adb (Convert_To_Assignments): Do not mark node for
      	delayed expansion if parent type has the Aggregate aspect.
      	* sem_util.adb (Is_Container_Aggregate): Move...
      	* sem_util.ads (Is_Container_Aggregate): ... here and make it
      	public.
      0fb227b9
    • GCC Administrator's avatar
      Daily bump. · 4a158c09
      GCC Administrator authored
      4a158c09
  11. Jul 06, 2023
  12. Jul 05, 2023
    • Michael Meissner's avatar
      Fix power10 fusion bug with prefixed loads, PR target/105325 · 68aa17cf
      Michael Meissner authored
      
      This changes fixes PR target/105325.  PR target/105325 is a bug where an
      invalid lwa instruction is generated due to power10 fusion of a load
      instruction to a GPR and an compare immediate instruction with the immediate
      being -1, 0, or 1.
      
      In some cases, when the load instruction is done, the GCC compiler would
      generate a load instruction with an offset that was too large to fit into the
      normal load instruction.
      
      In particular, loads from the stack might originally have a small offset, so
      that the load is not a prefixed load.  However, after the stack is set up, and
      register allocation has been done, the offset now is large enough that we would
      have to use a prefixed load instruction.
      
      The support for prefixed loads did not consider that patterns with a fused load
      and compare might have a prefixed address.  Without this support, the proper
      prefixed load won't be generated.
      
      In the original code, when the split2 pass is run after reload has finished the
      ds_form_mem_operand predicate that was used for lwa and ld no longer returns
      true.  When the pattern was created, ds_form_mem_operand recognized the insn as
      being valid since the offset was small.  But after register allocation,
      ds_form_mem_operand did not return true.  Because it didn't return true, the
      insn could not be split.  Since the insn was not split and the prefix support
      did not indicate a prefixed instruction was used, the wrong load is generated.
      
      The solution involves:
      
          1)	Don't use ds_form_mem_operand for ld and lwa, always use
      	non_update_memory_operand.
      
          2)	Delete ds_form_mem_operand since it is no longer used.
      
          3)	Use the "YZ" constraints for ld/lwa instead of "m".
      
          4)	If we don't need to sign extend the lwa, convert it to lwz, and use
      	cmpwi instead of cmpdi.  Adjust the insn name to reflect the code
      	generate.
      
          5)	Insure that the insn using lwa will be recognized as having a prefixed
      	operand (and hence the insn length will be 16 bytes instead of 8
      	bytes).
      
      	5a) Set the prefixed and maybe_prefix attributes to know that
      	    fused_load_cmpi are also load insns;
      
      	5b) In the case where we are just setting CC and not using the memory
      	    afterward, set the clobber to use a DI register, and put an
      	    explicit sign_extend operation in the split;
      
      	5c) Set the sign_extend attribute to "yes" for lwa.
      
      	5d) 5a-5c are the things that prefixed_load_p in rs6000.cc checks to
      	    ensure that lwa is treated as a ds-form instruction and not as
      	    a d-form instruction (i.e. lwz).
      
          6)	Add a new test case for this case.
      
          7)	Adjust the insn counts in fusion-p10-ldcmpi.c.  Because we are no
      	longer using ds_form_mem_operand, the ld and lwa instructions will fuse
      	x-form (reg+reg) addresses in addition ds-form (reg+offset or reg).
      
      2023-06-23   Michael Meissner  <meissner@linux.ibm.com>
      
      gcc/
      
      	PR target/105325
      	* config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): Fix problems that
      	allowed prefixed lwa to be generated.
      	* config/rs6000/fusion.md: Regenerate.
      	* config/rs6000/predicates.md (ds_form_mem_operand): Delete.
      	* config/rs6000/rs6000.md (prefixed attribute): Add support for load
      	plus compare immediate fused insns.
      	(maybe_prefixed): Likewise.
      
      gcc/testsuite/
      
      	PR target/105325
      	* g++.target/powerpc/pr105325.C: New test.
      	* gcc.target/powerpc/fusion-p10-ldcmpi.c: Update insn counts.
      
      	(cherry picked from commit 370de148)
      
      Co-Authored-By: default avatarAaron Sawdey <acsawdey@linux.ibm.com>
      68aa17cf
    • Segher Boessenkool's avatar
      rs6000: genfusion: Rewrite load/compare code · 5906d8f9
      Segher Boessenkool authored
      This makes the code more readable, more digestible, more maintainable,
      more extensible.  That kind of thing.  It does that by pulling things
      apart a bit, but also making what stays together more cohesive lumps.
      
      The original function was a bunch of loops and early-outs, and then
      quite a bit of stuff done per iteration, with the iterations essentially
      independent of each other.  This patch moves the stuff done for one
      iteration to a new _one function.
      
      The second big thing is the stuff printed to the .md file is done in
      "here documents" now, which is a lot more readable than having to quote
      and escape and double-escape pieces of text.  Whitespace inside the
      here-document is significant (will be printed as-is), which is a bit
      awkward sometimes, or might take some getting used to, but it is also
      one of the benefits of using them.
      
      Local variables are declared at first use (or close to first use).
      There also shouldn't be many at all, often you can write easier to
      read and manage code by omitting to name something that is hard to name
      in the first place.
      
      Finally some things are done in more typical, more modern, and tighter
      Perl style, for example REs in "if"s or "qw" for lists of constants.
      
      2023-06-06  Segher Boessenkool  <segher@kernel.crashing.org>
      
      	* config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): New, rewritten and
      	split out from...
      	(gen_ld_cmpi_p10): ... this.
      
      (cherry picked from commit 19e5bf1d)
      5906d8f9
    • Richard Biener's avatar
      tree-optimization/110228 - avoid undefs in ifcombine more thoroughly · 79b6a487
      Richard Biener authored
      The following replaces the simplistic gimple_uses_undefined_value_p
      with the conservative mark_ssa_maybe_undefs approach as already
      used by LIM and IVOPTs.  This is to avoid exposing an unconditional
      uninitialized read on a path from entry by if-combine.
      
      	PR tree-optimization/110228
      	* tree-ssa-ifcombine.cc (pass_tree_ifcombine::execute):
      	Mark SSA may-undefs.
      	(bb_no_side_effects_p): Check stmt uses for undefs.
      
      	* gcc.dg/torture/pr110228.c: New testcase.
      	* gcc.dg/uninit-pr101912.c: Un-XFAIL.
      
      (cherry picked from commit b083203f)
      79b6a487
    • GCC Administrator's avatar
      Daily bump. · c7d995df
      GCC Administrator authored
      c7d995df
  13. Jul 04, 2023
  14. Jul 03, 2023
    • Eric Botcazou's avatar
      Fix couple of endianness issues in fold_ctor_reference · d4a9d4c2
      Eric Botcazou authored
      fold_ctor_reference attempts to use a recursive local processing in order
      to call native_encode_expr on the leaf nodes of the constructor, before
      falling back to calling native_encode_initializer if this fails.
      
      There are a couple of issues related to endianness present in it:
        1) it does not specifically handle integral bit-fields; now these are left
      justified on big-endian platforms so cannot be treated like ordinary fields.
        2) it does not check that the constructor uses the native storage order.
      
      gcc/
      	* gimple-fold.cc (fold_array_ctor_reference): Fix head comment.
      	(fold_nonarray_ctor_reference): Likewise.  Specifically deal
      	with integral bit-fields.
      	(fold_ctor_reference): Make sure that the constructor uses the
      	native storage order.
      
      gcc/testsuite/
      	* gcc.c-torture/execute/20230630-1.c: New test.
      	* gcc.c-torture/execute/20230630-2.c: Likewise.
      	* gcc.c-torture/execute/20230630-3.c: Likewise
      	* gcc.c-torture/execute/20230630-4.c: Likewise
      d4a9d4c2
    • Iain Sandoe's avatar
      Darwin, Objective-C: Support -fconstant-cfstrings [PR108743]. · 12897414
      Iain Sandoe authored
      
      This support the -fconstant-cfstrings option as used by clang (and
      expect by some build scripts) as an alias to the target-specific
      -mconstant-cfstrings.
      
      The documentation is also updated to reflect that the 'f' option is
      only available on Darwin, and to add the 'm' option to the Darwin
      section of the invocation text.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      
      	PR target/108743
      
      gcc/ChangeLog:
      
      	* config/darwin.opt: Add fconstant-cfstrings alias to
      	mconstant-cfstrings.
      	* doc/invoke.texi: Amend invocation descriptions to reflect
      	that the fconstant-cfstrings is a target-option alias and to
      	add the missing mconstant-cfstrings option description to the
      	Darwin section.
      
      (cherry picked from commit cdd4b3c0)
      12897414
Loading