platform/upstream/gcc.git
2 years agoFortran: error recovery simplifying PACK with invalid arguments [PR106049]
Harald Anlauf [Tue, 5 Jul 2022 20:20:05 +0000 (22:20 +0200)]
Fortran: error recovery simplifying PACK with invalid arguments [PR106049]

gcc/fortran/ChangeLog:

PR fortran/106049
* simplify.cc (is_constant_array_expr): A non-zero-sized constant
array shall have a non-empty constructor.  When the constructor is
empty or missing, treat as non-constant.

gcc/testsuite/ChangeLog:

PR fortran/106049
* gfortran.dg/pack_simplify_1.f90: New test.

2 years agoSet nonzero bits from bitwise and operator in range-ops.
Aldy Hernandez [Tue, 12 Jul 2022 08:16:03 +0000 (10:16 +0200)]
Set nonzero bits from bitwise and operator in range-ops.

Now that nonzero bits are first class citizens in the range, we can
keep better track of them in range-ops, especially the bitwise and
operator.

This patch sets the nonzero mask for the trivial case.  In doing so,
I've removed some old dead code that was an attempt to keep better
track of masks.

I'm sure there are tons of optimizations throughout range-ops that
could be implemented, especially the op1_range methods, but those
always make my head hurt.  I'll leave them to the smarter hackers
out there.

I've removed the restriction that nonzero bits can't be queried from
legacy.  This was causing special casing all over the place, and
it's not like we can generate incorrect code.  We just silently
drop nonzero bits to -1 in some of the legacy code.  The end result
is that VRP1, and other users of legacy, may not benefit from these
improvements.

Tested and benchmarked on x86-64 Linux.

gcc/ChangeLog:

* range-op.cc (unsigned_singleton_p): Remove.
(operator_bitwise_and::remove_impossible_ranges): Remove.
(operator_bitwise_and::fold_range): Set nonzero bits.  *
* value-range.cc (irange::get_nonzero_bits): Remove
legacy_mode_p assert.
(irange::dump_bitmasks): Remove legacy_mode_p check.

2 years agolto-plugin: implement LDPT_GET_API_VERSION
Martin Liska [Mon, 16 May 2022 12:01:52 +0000 (14:01 +0200)]
lto-plugin: implement LDPT_GET_API_VERSION

include/ChangeLog:

* plugin-api.h (enum linker_api_version): New enum.
(ld_plugin_get_api_version): New.
(enum ld_plugin_tag): Add LDPT_GET_API_VERSION.
(struct ld_plugin_tv): Add tv_get_api_version.

lto-plugin/ChangeLog:

* lto-plugin.c (negotiate_api_version): New.
(onload): Negotiate API version.
* Makefile.am: Add -DBASE_VERSION.
* Makefile.in: Regenerate.

2 years agoAdd internal functions for iround etc. [PR106253]
Richard Sandiford [Tue, 12 Jul 2022 13:09:44 +0000 (14:09 +0100)]
Add internal functions for iround etc. [PR106253]

The PR is about the aarch64 port using an ACLE built-in function
to vectorise a scalar function call, even though the ECF_* flags for
the ACLE function didn't match the ECF_* flags for the scalar call.

To some extent that kind of difference is inevitable, since the
ACLE intrinsics are supposed to follow the behaviour of the
underlying instruction as closely as possible.  Also, using
target-specific builtins has the drawback of limiting further
gimple optimisation, since the gimple optimisers won't know what
the function does.

We handle several other maths functions, including round, floor
and ceil, by defining directly-mapped internal functions that
are linked to the associated built-in functions.  This has two
main advantages:

- it means that, internally, we are not restricted to the set of
  scalar types that happen to have associated C/C++ functions

- the functions (and thus the underlying optabs) extend naturally
  to vectors

This patch takes the same approach for the remaining functions
handled by aarch64_builtin_vectorized_function.

gcc/
PR target/106253
* predict.h (insn_optimization_type): Declare.
* predict.cc (insn_optimization_type): New function.
* internal-fn.def (IFN_ICEIL, IFN_IFLOOR, IFN_IRINT, IFN_IROUND)
(IFN_LCEIL, IFN_LFLOOR, IFN_LRINT, IFN_LROUND, IFN_LLCEIL)
(IFN_LLFLOOR, IFN_LLRINT, IFN_LLROUND): New internal functions.
* internal-fn.cc (unary_convert_direct): New macro.
(expand_convert_optab_fn): New function.
(expand_unary_convert_optab_fn): New macro.
(direct_unary_convert_optab_supported_p): Likewise.
* optabs.cc (expand_sfix_optab): Pass insn_optimization_type to
convert_optab_handler.
* config/aarch64/aarch64-protos.h
(aarch64_builtin_vectorized_function): Delete.
* config/aarch64/aarch64-builtins.cc
(aarch64_builtin_vectorized_function): Delete.
* config/aarch64/aarch64.cc
(TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Delete.
* config/i386/i386.cc (ix86_optab_supported_p): Handle lround_optab.
* config/i386/i386.md (lround<X87MODEF:mode><SWI248x:mode>2): Remove
optimize_insn_for_size_p test.

gcc/testsuite/
PR target/106253
* gcc.target/aarch64/vect_unary_1.c: Add tests for iroundf,
llround, iceilf, llceil, ifloorf, llfloor, irintf and llrint.
* gfortran.dg/vect/pr106253.f: New test.

2 years agoRemove create_lcssa_for_virtual_phi and uses
Richard Biener [Tue, 12 Jul 2022 12:37:51 +0000 (14:37 +0200)]
Remove create_lcssa_for_virtual_phi and uses

The following expands the comment in vect_do_peeling as to why we
do not need create_lcssa_for_virtual_phi and removes that function.

That's the last bit I have queued for the vectorizer virtual LCSSA
cleanup.

* tree-vect-loop-manip.cc (create_lcssa_for_virtual_phi):
Remove.
(vect_do_peeling): Do not call it, adjust comment.

2 years ago[Ada] Fix inconsistent comment about expansion of exception declarations
Piotr Trojanek [Thu, 30 Jun 2022 10:40:39 +0000 (12:40 +0200)]
[Ada] Fix inconsistent comment about expansion of exception declarations

Code cleanup.

gcc/ada/

* exp_ch11.adb (Expand_N_Exception_Declaration): Sync comment
with declaration in System.Standard_Library.

2 years ago[Ada] Fix 0-sized secondary stack allocations
Marc Poulhiès [Thu, 30 Jun 2022 07:50:02 +0000 (09:50 +0200)]
[Ada] Fix 0-sized secondary stack allocations

The Has_Enough_Free_Memory was not correctly reporting a completely full
chunk in the case of a 0-sized allocation.

gcc/ada/

* libgnat/s-secsta.adb (Has_Enough_Free_Memory): Check for full
chunk before computing the available size.

2 years ago[Ada] Use right implementation type for nonbinary-modulus ops
Steve Baird [Thu, 30 Jun 2022 00:21:03 +0000 (17:21 -0700)]
[Ada] Use right implementation type for nonbinary-modulus ops

If the flag Opt.Expand_Nonbinary_Modular_Ops is set (which occurs if
-gnateg is specified) then we implement predefined operations for a
modular type whose modulus is not a power of two by converting the
operands to some other type (either a signed integer type or a modular
type with a power-of-two modulus), doing the operation in that
representation, and converting back.  If the bounds of the chosen type
are too narrow, then problems with intermediate overflow can result. But
there are performance advantages to choosing narrower bounds (and to
prefering an unsigned choice over a signed choice of the same size) when
multiple safe choices are available.

gcc/ada/

* exp_ch4.adb (Expand_Nonbinary_Modular_Op.Expand_Modular_Op):
Reimplement choice of which predefined type to use for the
implementation of a predefined operation of a modular type with
a non-power-of-two modulus.

2 years ago[Ada] Spurious use_type clause warning
Justin Squirek [Wed, 15 Jun 2022 01:53:49 +0000 (01:53 +0000)]
[Ada] Spurious use_type clause warning

This patch corrects an error in the compiler whereby a spurious
redundant use_type_clause warning gets issued when the clause appears in
the context_clause of a package preceding a with_clause for a package
with an identical use_clause in its specification.

gcc/ada/

* einfo.ads: Modify documentation for In_Use flag to include
scope stack manipulation.
* sem_ch8.adb (Use_One_Type): Add condition to return when
attempting to detect redundant use_type_clauses in child units
in certain cases.

2 years ago[Ada] Extend No_Dependence restriction to code generation
Eric Botcazou [Tue, 28 Jun 2022 16:51:30 +0000 (18:51 +0200)]
[Ada] Extend No_Dependence restriction to code generation

This makes it possible to report violations of the No_Dependence restriction
during code generation, in other words outside of the Ada front-end proper.
These violations are supposed to be only for child units of System, so the
implementation is restricted to these cases.

gcc/ada/

* restrict.ads (type ND_Entry): Add System_Child component.
(Check_Restriction_No_Dependence_On_System): Declare.
* restrict.adb (Global_Restriction_No_Tasking): Move around.
(Violation_Of_No_Dependence): New procedure.
(Check_Restriction_No_Dependence): Call Violation_Of_No_Dependence
to report a violation.
(Check_Restriction_No_Dependence_On_System): New procedure.
(Set_Restriction_No_Dependenc): Set System_Child component if the
unit is a child of System.
* snames.ads-tmpl (Name_Arith_64): New package name.
(Name_Arith_128): Likewise.
(Name_Memory): Likewise.
(Name_Stack_Checking): Likewise.
* fe.h (Check_Restriction_No_Dependence_On_System): Declare.

2 years ago[Ada] Ada 2020: Allow declarative items mixed with statements
Bob Duff [Wed, 29 Jun 2022 21:06:47 +0000 (17:06 -0400)]
[Ada] Ada 2020: Allow declarative items mixed with statements

This patch implements a syntactic language extension that allows
declarative items to appear in a sequence of statements.  For example:

    for X in S'Range loop
        Item : Character renames S (X);
        Item := Transform (Item);
    end loop;

Previously, declare/begin/end was required, which is just noise.

gcc/ada/

* par.adb (P_Declarative_Items): New function to parse a
sequence of declarative items.
(P_Sequence_Of_Statements): Add Handled flag, to indicate
whether to wrap the result in a block statement.
* par-ch3.adb (P_Declarative_Item): Rename P_Declarative_Items
to be P_Declarative_Item, because it really only parses a single
declarative item, and to avoid conflict with the new
P_Declarative_Items. Add In_Statements.  We keep the old
error-recovery mechanisms in place when In_Statements is False.
When True, we don't want to complain about statements, because
we are parsing a sequence of statements.
(P_Identifier_Declarations): If In_Statements, and we see what
looks like a statement, we no longer give an error. We return to
P_Sequence_Of_Statements with Done = True, so it can parse the
statement.
* par-ch5.adb (P_Sequence_Of_Statements): Call
P_Declarative_Items to parse declarative items that appear in
the statement list.  Remove error handling code that complained
about such items.  Check some errors conservatively.  Wrap the
result in a block statement when necessary.
* par-ch11.adb (P_Handled_Sequence_Of_Statements): Pass
Handled => True to P_Sequence_Of_Statements.
* types.ads (No, Present): New functions for querying
Source_Ptrs (equal, not equal No_Location).

2 years ago[Ada] Don't check for misspelling of Not_A_Restriction_Id
Piotr Trojanek [Fri, 24 Jun 2022 07:07:51 +0000 (09:07 +0200)]
[Ada] Don't check for misspelling of Not_A_Restriction_Id

When looking for a misspelling of a restriction identifier we should
ignore the Not_A_Restriction_Id literal, because it doesn't represent
any restriction.

gcc/ada/

* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Fix range of iteration.

2 years ago[Ada] Fix confusing error expression on an unknown restriction
Piotr Trojanek [Thu, 23 Jun 2022 11:09:51 +0000 (13:09 +0200)]
[Ada] Fix confusing error expression on an unknown restriction

When pragma Restriction is used with an unknown restriction identifier,
it is better to not process the restriction expression, as it will
likely produce confusing error message.

In particular, an odd message appeared when there was a typo in the
restriction identifier whose expression requires special processing
(e.g.  No_Dependence_On instead of No_Dependence).

gcc/ada/

* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Do not process expression of unknown restrictions.

2 years ago[Ada] Make it clear that gnatmake passes the ball to gprbuild if -P is set
Vasiliy Fofanov [Tue, 28 Jun 2022 15:50:38 +0000 (17:50 +0200)]
[Ada] Make it clear that gnatmake passes the ball to gprbuild if -P is set

Also move -P switch description to the top of the switches list.

gcc/ada/

* makeusg.adb,
doc/gnat_ugn/building_executable_programs_with_gnat.rst: Move -P
to the top of switches list and make it clear that gnatmake
passes the ball to gprbuild if -P is set.
* gnat_ugn.texi: Regenerate.

2 years ago[Ada] Suppress warning in g-socthi__vxworks.adb
Bob Duff [Tue, 28 Jun 2022 12:28:12 +0000 (08:28 -0400)]
[Ada] Suppress warning in g-socthi__vxworks.adb

Follow-on to previous change, which missed the vxworks version of this
package.

gcc/ada/

* libgnat/g-socthi__vxworks.adb (C_Connect): Suppress new warning.

2 years ago[Ada] Simplify rewriting of attributes into Boolean literals
Piotr Trojanek [Tue, 11 Jan 2022 19:41:13 +0000 (20:41 +0100)]
[Ada] Simplify rewriting of attributes into Boolean literals

Code cleanup; semantics is unaffected.

gcc/ada/

* sem_attr.adb (Set_Boolean_Result): Simplify using
Boolean_Literals.

2 years ago[Ada] Ignore switches for controlling frontend warnings in GNATprove mode
Yannick Moy [Wed, 8 Jun 2022 09:58:43 +0000 (11:58 +0200)]
[Ada] Ignore switches for controlling frontend warnings in GNATprove mode

In the special mode for GNATprove, ignore switches controlling frontend
warnings, like already done for the control of style checks warnings.
Also remove special handling of warning mode in Errout to make up for
the previous division of control between -gnatw (GNAT) and --warnings
(GNATprove).

gcc/ada/

* errout.adb (Record_Compilation_Errors): Remove global
variable.
(Compilation_Errors): Simplify.
(Initialize): Inline Reset_Warnings.
(Reset_Warnings): Remove.
* errout.ads (Reset_Warnings): Remove.
(Compilation_Errors): Update comment.
* gnat1drv.adb (Adjust_Global_Switches): Ignore all frontend
warnings in GNATprove mode, except regarding elaboration and
suspicious contracts.

2 years ago[Ada] Do not create large objects for indefinite protected types
Eric Botcazou [Mon, 27 Jun 2022 13:26:34 +0000 (15:26 +0200)]
[Ada] Do not create large objects for indefinite protected types

This plugs a small loophole in the Needs_Secondary_Stack predicate for
some protected types and record types containing protected components.

gcc/ada/

* sem_util.adb (Caller_Known_Size_Record): Make entry assertion
more robust and add guard for null argument.  For protected
types, invoke Caller_Known_Size_Record on
Corresponding_Record_Type.
(Needs_Secondary_Stack): Likewise.

2 years ago[Ada] Vxworks7* - Makefile.rtl rtp vs rtp-smp cleanup - remove unused files
Doug Rupp [Fri, 17 Jun 2022 18:39:46 +0000 (11:39 -0700)]
[Ada] Vxworks7* - Makefile.rtl rtp vs rtp-smp cleanup - remove unused files

Only smp runtimes are built for vxworks7*, even though the -smp suffix
is removed during install. This change removes unused system packages
for rtp runtimes.

gcc/ada/

* libgnat/system-vxworks7-ppc-rtp.ads: Remove
* libgnat/system-vxworks7-x86-rtp.ads: Likewise.

2 years ago[Ada] Fix spurious warning on unreferenced internal generic instance
Piotr Trojanek [Mon, 27 Jun 2022 11:09:10 +0000 (13:09 +0200)]
[Ada] Fix spurious warning on unreferenced internal generic instance

This patch removes a spurious warning, saying that an internal entity of
a generic formal package is unreferenced. The immediate cause of this
warning is that the internal entity is explicitly flagged as coming from
source.

The explicit flagging was added decades ago to fix a missing
cross-reference in the ALI file. Apparently these days the
cross-references work fine without this flag.

gcc/ada/

* sem_ch12.adb (Analyze_Package_Instantiation): Remove dubious
call to Set_Comes_From_Source.

2 years ago[Ada] Refine heuristics for unreachable-code warnings
Bob Duff [Fri, 24 Jun 2022 18:25:48 +0000 (14:25 -0400)]
[Ada] Refine heuristics for unreachable-code warnings

This patch refines the heuristics for when we warn about unreachable
code, to avoid common false alarms.

gcc/ada/

* sem_ch5.adb (Check_Unreachable_Code): Refine heuristics.
* sem_util.ads, sem_util.adb (Is_Static_Constant_Name): Remove
this; instead we have a new function Is_Simple_Case in
Sem_Ch5.Check_Unreachable_Code.

2 years ago[Ada] Remove out-of-range warning in unreachable code
Bob Duff [Thu, 23 Jun 2022 16:29:22 +0000 (12:29 -0400)]
[Ada] Remove out-of-range warning in unreachable code

This patch removes a warning in examples like this:

    if cond then
       return; -- or other jump
    end if;
    X := ...; -- where the value is out of range

where cond is known at compile time. It could, for example, be a generic
formal parameter that is known to be True in some instances.

As a side effect, this patch adds new warnings about unreachable code.

gcc/ada/

* gnatls.adb (Output_License_Information): Remove pragma
No_Return; call sites deal with Exit_Program.
* libgnat/g-socthi.adb (C_Connect): Suppress warning about
unreachable code.
* sem_ch5.adb (Check_Unreachable_Code): Special-case if
statements with static conditions.  If we remove unreachable
code (including the return statement) from a function, add
"raise Program_Error", so we won't warn about missing returns.
Remove Original_Node in test for N_Raise_Statement; it's not
needed.  Remove test for CodePeer_Mode; if Operating_Mode =
Generate_Code, then CodePeer_Mode can't be True.  Misc cleanup.
Do not reuse Nxt variable for unrelated purpose (the usage in
the Kill_Dead_Code loop is entirely local to the loop).
* sem_ch6.adb: Add check for Is_Transfer. Misc cleanup.
* sem_prag.adb: Minor.
* sem_res.adb: Minor.
* sem_util.adb: Minor cleanup.
(Is_Trivial_Boolean): Move to nonnested place, so it can be
called from elsewhere.
(Is_Static_Constant_Boolean): New function.
* sem_util.ads (Is_Trivial_Boolean): Export.
(Is_Static_Constant_Boolean): New function.

2 years ago[Ada] Add one more leading underscore to couple of exported symbols
Eric Botcazou [Fri, 24 Jun 2022 10:16:21 +0000 (12:16 +0200)]
[Ada] Add one more leading underscore to couple of exported symbols

For the sake of consistency with other runtime units.

gcc/ada/

* libgnat/s-stchop.ads: Use a double underscore prefix for symbols.

2 years ago[Ada] Proper freezing for dispatching expression functions.
Ed Schonberg [Tue, 7 Jun 2022 20:22:04 +0000 (13:22 -0700)]
[Ada] Proper freezing for dispatching expression functions.

In the case of an expression function that is a primitive function of a
tagged type, freezing the tagged type needs to freeze the function (and
its return expression). A bug in this area could result in incorrect
behavior both at compile time and at run time. At compile time, freezing
rule violations could go undetected so that an illegal program could be
incorrectly accepted. At run time, a dispatching call to the primitive
function could end up dispatching through a not-yet-initialized slot in
the dispatch table, typically (although not always) resulting in a
segmentation fault.

gcc/ada/

* freeze.adb (Check_Expression_Function.Find_Constant): Add a
check that a type that is referenced as the prefix of an
attribute is fully declared.
(Freeze_And_Append): Do not freeze the profile when freezing an
expression function.
(Freeze_Entity): When a tagged type is frozen, also freeze any
primitive operations of the type that are expression functions.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not prevent
freezing associated with an expression function body if the
function is a dispatching op.

2 years ago[Ada] Warn on unset objects in packages with no bodies
Piotr Trojanek [Tue, 21 Jun 2022 08:17:57 +0000 (10:17 +0200)]
[Ada] Warn on unset objects in packages with no bodies

Fix an inconsistency, where GNAT was warning about references to unset
objects inside generic packages with no bodies but not inside ordinary
packages with no bodies.

gcc/ada/

* sem_ch7.adb (Analyze_Package_Declaration): Check references to
unset objects.

gcc/testsuite/

* gnat.dg/specs/discr5.ads: Expect new warnings.
* gnat.dg/specs/empty_variants.ads: Likewise.
* gnat.dg/specs/pack13.ads: Likewise.

2 years ago[Ada] Accept aspect Yield on subprogram bodies acting as specs
Piotr Trojanek [Tue, 11 Jan 2022 21:25:13 +0000 (22:25 +0100)]
[Ada] Accept aspect Yield on subprogram bodies acting as specs

A small fix for the aspect Yield defined in AI12-0279 for Ada 2022, to
accept aspect given for a subprogram body which acts as its own spec.

For example:

   procedure Switch with Yield => True is
   begin
      ...
   end Switch;

gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Yield): Look at the entity kind,
not at the declaration kind.

2 years ago[Ada] Annotate libraries with returning annotation
Joffrey Huguet [Mon, 13 Jun 2022 09:44:51 +0000 (11:44 +0200)]
[Ada] Annotate libraries with returning annotation

This patch annotates SPARK-annotated libraries with returning
annotations (Always_Return, Might_Not_Return) to remove the warnings
raised by GNATprove about missing annotations.

gcc/ada/

* libgnarl/a-reatim.ads, libgnat/a-cfdlli.ads,
libgnat/a-cfhama.ads, libgnat/a-cfhase.ads,
libgnat/a-cfinse.ads, libgnat/a-cfinve.ads,
libgnat/a-cforma.ads, libgnat/a-cforse.ads,
libgnat/a-chahan.ads, libgnat/a-cofove.ads,
libgnat/a-cofuma.ads, libgnat/a-cofuse.ads,
libgnat/a-cofuve.ads, libgnat/a-nbnbin.ads,
libgnat/a-nbnbre.ads, libgnat/a-ngelfu.ads,
libgnat/a-nlelfu.ads, libgnat/a-nllefu.ads,
libgnat/a-nselfu.ads, libgnat/a-nuelfu.ads,
libgnat/a-strbou.ads, libgnat/a-strfix.ads,
libgnat/a-strmap.ads, libgnat/a-strunb.ads,
libgnat/a-strunb__shared.ads,  libgnat/a-strsea.ads,
libgnat/a-textio.ads, libgnat/a-tideio.ads,
libgnat/a-tienio.ads, libgnat/a-tifiio.ads,
libgnat/a-tiflio.ads, libgnat/a-tiinio.ads,
libgnat/a-timoio.ads, libgnat/i-c.ads, libgnat/interfac.ads,
libgnat/interfac__2020.ads, libgnat/s-atacco.ads,
libgnat/s-stoele.ads: Annotate packages and subprograms with
returning annotations.

2 years ago[Ada] Fix buffer overrun for small string concatenation at -O0
Eric Botcazou [Tue, 21 Jun 2022 20:17:13 +0000 (22:17 +0200)]
[Ada] Fix buffer overrun for small string concatenation at -O0

The concatenation routines may read too much data on the source side when
the destination buffer is larger than the final result.  This change makes
sure that this does not happen any more and also removes obsolete stuff.

gcc/ada/

* rtsfind.ads (RE_Id): Remove RE_Str_Concat_Bounds_N values.
(RE_Unit_Table): Remove RE_Str_Concat_Bounds_N entries.
* libgnat/s-conca2.ads (Str_Concat_2): Adjust head comment.
(Str_Concat_Bounds_2): Delete.
* libgnat/s-conca2.adb (Str_Concat_2): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_2): Delete.
* libgnat/s-conca3.ads (Str_Concat_3): Adjust head comment.
(Str_Concat_Bounds_3): Delete.
* libgnat/s-conca3.adb (Str_Concat_3): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_3): Delete.
* libgnat/s-conca4.ads (Str_Concat_4): Adjust head comment.
(Str_Concat_Bounds_4): Delete.
* libgnat/s-conca4.adb (Str_Concat_4): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_4): Delete.
* libgnat/s-conca5.ads (Str_Concat_5): Adjust head comment.
(Str_Concat_Bounds_5): Delete.
* libgnat/s-conca5.adb (Str_Concat_5): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_5): Delete.
* libgnat/s-conca6.ads (Str_Concat_6): Adjust head comment.
(Str_Concat_Bounds_6): Delete.
* libgnat/s-conca6.adb (Str_Concat_6): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_6): Delete.
* libgnat/s-conca7.ads (Str_Concat_7): Adjust head comment.
(Str_Concat_Bounds_7): Delete.
* libgnat/s-conca7.adb (Str_Concat_7): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_7): Delete.
* libgnat/s-conca8.ads (Str_Concat_8): Adjust head comment.
(Str_Concat_Bounds_8): Delete.
* libgnat/s-conca8.adb (Str_Concat_8): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_8): Delete.
* libgnat/s-conca9.ads (Str_Concat_9): Adjust head comment.
(Str_Concat_Bounds_9): Delete.
* libgnat/s-conca9.adb (Str_Concat_9): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_9): Delete.

2 years ago[Ada] Avoid namespace pollution for Next and Previous
Bob Duff [Tue, 21 Jun 2022 18:32:37 +0000 (14:32 -0400)]
[Ada] Avoid namespace pollution for Next and Previous

This patch renames Next and Previous in a-convec.ads and other
containers to be _Next and _Previous, to avoid namespace pollution.  The
compiler now uses the leading-underscore names to look them up.

The scanner is changed to allow this.

gcc/ada/

* exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Use _Next and
_Previous in the optimized expansion of "for ... of".  No longer
need to check parameter profiles for these, because the
leading-underscore names are unique.
* libgnat/a-convec.ads (_Next, _Previous): Renamings of Next and
Previous, to avoid namespace pollution.
* libgnat/a-cbdlli.ads, libgnat/a-cbhama.ads,
libgnat/a-cbhase.ads, libgnat/a-cbmutr.ads,
libgnat/a-cborma.ads, libgnat/a-cborse.ads,
libgnat/a-cdlili.ads, libgnat/a-cidlli.ads,
libgnat/a-cihama.ads, libgnat/a-cihase.ads,
libgnat/a-cimutr.ads, libgnat/a-ciorma.ads,
libgnat/a-ciorse.ads, libgnat/a-cobove.ads,
libgnat/a-cohama.ads, libgnat/a-cohase.ads,
libgnat/a-coinve.ads, libgnat/a-comutr.ads,
libgnat/a-coorma.ads, libgnat/a-coorse.ads: Likewise.  Also,
remove duplicated comments -- refer to one comment about _Next,
_Previous, Pseudo_Reference in libgnat/a-convec.ads. DRY.
* scng.adb (Scan): Allow leading underscores in identifiers in
the run-time library.
* snames.ads-tmpl (Name_uNext, Name_uPrevious): New names with
leading underscores.

2 years ago[Ada] Warn about unreachable code after calls with No_Return
Piotr Trojanek [Fri, 3 Jun 2022 13:18:24 +0000 (15:18 +0200)]
[Ada] Warn about unreachable code after calls with No_Return

GNAT was already warning about unreachable code after raise/goto/exit
statements, but not after calls to procedures with No_Return. Now this
warning is extended.

Also, previously the warning was suppressed for unreachable RETURN after
RAISE statements. Now this suppression is narrowed to functions, because
only in function such a RETURN statement might be indeed needed (where
it is the only RETURN statement of a function).

gcc/ada/

* sem_ch5.adb (Check_Unreachable_Code): Extend suppression to
calls with No_Return aspect, but narrow it to functions.
* sem_res.adb (Resolve_Call): Warn about unreachable code after
calls with No_Return.

2 years ago[Ada] Clean up scanner
Bob Duff [Tue, 21 Jun 2022 13:50:06 +0000 (09:50 -0400)]
[Ada] Clean up scanner

This patch removes some obsolete code in the scanner and related files,
and corrects some comments. Tok_Special is used only by the
preprocessor, and uses only the two characters '#' and '$'.

It might be simpler to have a single flag indicating we're scanning for
preprocessing, instead of the Special_Characters array and the
End_Of_Line_Is_Token flag, but that's for another day.

gcc/ada/

* scans.ads: Fix obsolete comments about Tok_Special, and give
Special_Character a predicate assuring it is one of the two
characters used in preprocessing.
* scng.ads: Clean up comments.
* scng.adb: Clean up handling of Tok_Special.  Remove comment
about '@' (target_name), which doesn't seem very helpful.
Set_Special_Character will now blow up if given anything other
than '#' and '$', because of the predicate on Special_Character;
it's not clear why it used to say "when others => null;".
Remove Comment_Is_Token, which is not used.
* scn.ads: Remove commented-out use clause.  Remove redundant
comment.
* ali-util.adb: Use "is null" for do-nothing procedures.
* gprep.adb (Post_Scan): Use "is null".

2 years ago[Ada] Ignore exceptions in task termination handlers
Bob Duff [Mon, 20 Jun 2022 17:59:03 +0000 (13:59 -0400)]
[Ada] Ignore exceptions in task termination handlers

This patch fixes a bug in which if the environment task has a specific
termination handler, and that handler raises an exception, the handler
is called recursively, causing infinite recursion. The RM requires such
exceptions to be ignored.

gcc/ada/

* libgnarl/s-solita.adb (Task_Termination_Handler_T): Ignore all
exceptions propagated by Specific_Handler.
* libgnarl/s-tassta.adb, libgnarl/s-taskin.ads: Minor.

2 years ago[Ada] Fix missing Overflow and Range checks
Marc Poulhiès [Fri, 17 Jun 2022 14:07:35 +0000 (16:07 +0200)]
[Ada] Fix missing Overflow and Range checks

While doing Preanalysis (as is the case during ghost code handling),
some range and/or overflow checks can be saved (see Saved_Checks in
checks.adb) and later one omitted as they would be redundant (see
Find_Check in checks.adb). In the case of ghost code, the node being
Preanalyzed is a temporary copy that is discarded, so its corresponding
check is not expanded later. The node that gets expanded later is not
having any checks expanded as it is wrongly assumed it has already been
done before.

As is already the case in Preanalyze_And_Resolve, this change suppresses
all checks during Preanalyze except for GNATprove mode.

gcc/ada/

* sem.adb (Preanalyze): Suppress checks when not in GNATprove
mode.
* sem_res.adb (Preanalyze_And_Resolve): Add cross reference in
comment to above procedure.
* sinfo.ads: Typo fix in comment.

2 years ago[Ada] Add new unbounded and indefinite formal doubly linked list
Julien Bortolussi [Thu, 19 May 2022 13:49:03 +0000 (15:49 +0200)]
[Ada] Add new unbounded and indefinite formal doubly linked list

Before this patch, the only formal doubly linked lists were bounded and
definite. This means that it is necessary to provide their maximum
length or capacity at instantiation and that they can only be used with
definite element types.

The formal lists added by this patch are unbounded and indefinite.
Their length grows dynamically until Count_Type'Last. This makes them
easier to use but requires the use of dynamic allocation and controlled
types.

gcc/ada/

* libgnat/a-cfidll.adb, libgnat/a-cfidll.ads: Implementation
files of the formal unbounded indefinite list.
* Makefile.rtl, impunit.adb: Take into account the add of the
new files.

2 years ago[Ada] Remove excessive guard in detection of access-to-variable objects
Piotr Trojanek [Mon, 30 Aug 2021 10:03:52 +0000 (12:03 +0200)]
[Ada] Remove excessive guard in detection of access-to-variable objects

It is safe to call Is_Access_Variable without calling
Is_Access_Object_Type before. Compiler cleanup only; semantics is
unaffected.

gcc/ada/

* sem_util.adb (Is_Variable): Remove excessive guard.

2 years agoaarch64: Remove redundant builtins code
Richard Sandiford [Tue, 12 Jul 2022 11:59:25 +0000 (12:59 +0100)]
aarch64: Remove redundant builtins code

aarch64_builtin_vectorized_function handles some built-in functions
that already have equivalent internal functions.  This seems to be
redundant now, since the target builtins that it chooses are mapped
to the same optab patterns as the internal functions.

gcc/
* config/aarch64/aarch64-builtins.cc
(aarch64_builtin_vectorized_function): Remove handling of
floor, ceil, trunc, round, nearbyint, sqrt, clz and ctz.

gcc/testsuite/
* gcc.target/aarch64/vect_unary_1.c: New test.

2 years agoi386 testsuite: cope with --enable-default-pie
Alexandre Oliva [Tue, 12 Jul 2022 11:52:24 +0000 (08:52 -0300)]
i386 testsuite: cope with --enable-default-pie

Running the testsuite on a toolchain build with --enable-default-pie
had some unexpected fails.  Adjust the tests to tolerate the effects
of this configuration option on x86_64-linux-gnu and i686-linux-gnu.

The cet-sjlj* tests get offsets before the base symbol name with PIC
or PIE.  A single pattern covering both alternatives somehow triggered
two matches rather than the single expected match, thus my narrowing
the '.*' to not skip line breaks, but that was not enough.  Still
puzzled, I separated the patterns into nonpic and !nonpic, and we get
the expected matchcounts this way.

Tests for -mfentry require an mfentry effective target, which excludes
32-bit x86 with PIC or PIE enabled, that's why the patterns that
accept the PIC sym@RELOC annotations only cover x86_64.  mvc7 is
getting regexps extended to cover PIC reloc annotatios and all of the
named variants, and tightened to avoid unexpected '.' matches.

The pr24414 test stores in an unadorned named variable in an old-style
asm statement, to check that such asm statements get an implicit
memory clobber.  Rewriting the asm into a GCC extended asm with the
variable as an output would remove the regression it checks against.
Problem is, the literal reference to the variable is not PIC, so it's
rejected by the elf64 linker with an error, and flagged with a warning
by the elf32 one.  We could presumably make the variable references
PIC-friendly with #ifdefs, but I doubt that's worth the trouble.  I'm
just arranging for the test to be skipped if PIC or PIE are enabled by
default.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/cet-sjlj-6a.c: Cope with --enable-default-pie.
* gcc.target/i386/cet-sjlj-6b.c: Likewise.
* gcc.target/i386/fentryname3.c: Likewise.
* gcc.target/i386/mvc7.c: Likewise.
* gcc.target/i386/pr24414.c: Likewise.
* gcc.target/i386/pr93492-3.c: Likewise.
* gcc.target/i386/pr93492-5.c: Likewise.
* gcc.target/i386/pr98482-1.c: Likewise.

2 years agolibgomp: Add tailing \n to gomp_debug
Tobias Burnus [Tue, 12 Jul 2022 09:10:50 +0000 (11:10 +0200)]
libgomp: Add tailing \n to gomp_debug

Contrary to gomp_{error,warning,fatal}, no tailing '\n' is added with
gomp_debug; only affected was a 'requires'-related output.

libgomp/ChangeLog:

* target.c (gomp_target_init): Added tailing '\n' to gomp_debug.

2 years agolibstdc++: Prefer const T to std::add_const_t<T>
Jonathan Wakely [Thu, 7 Jul 2022 11:27:08 +0000 (12:27 +0100)]
libstdc++: Prefer const T to std::add_const_t<T>

For any typedef-name or template parameter, T, add_const_t<T> is
equivalent to T const, so we can avoid instantiating the std::add_const
class template and just say T const (or const T).

This isn't true for a non-typedef like int&, where int& const would be
ill-formed, but we shouldn't be using add_const_t<int&> anyway, because
we know what that type is.

The only place we need to continue using std::add_const is in the
std::bind implementation where it's used as a template template
parameter to be applied as a metafunction elsewhere.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (__iter_to_alloc_t): Replace
add_const_t with const-qualifier.
* include/bits/utility.h (tuple_element<N, cv T>): Likewise for
all cv-qualifiers.
* include/std/type_traits (add_const, add_volatile): Replace
typedef-declaration with using-declaration.
(add_cv): Replace add_const and add_volatile with cv-qualifiers.
* include/std/variant (variant_alternative<N, cv T>): Replace
add_const_t, add_volatile_t and add_cv_t etc. with cv-qualifiers.

2 years agoXFAIL 'offloading_enabled' diagnostics issue in 'libgomp.oacc-c-c++-common/reduction...
Thomas Schwinge [Tue, 12 Jul 2022 06:17:37 +0000 (08:17 +0200)]
XFAIL 'offloading_enabled' diagnostics issue in 'libgomp.oacc-c-c++-common/reduction-5.c' [PR101551]

Fix-up for recent commit 06b2a2abe26554c6f9365676683d67368cbba206
"Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases".
Supposedly it's the same issue as in
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101551#c2>, where I'd
noted that:

| [...] with an offloading-enabled build of GCC we're losing
| "note: in expansion of macro '[...]'" diagnostics.
| (Effectively '-ftrack-macro-expansion=0'?)

PR middle-end/101551
libgomp/
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: XFAIL
'offloading_enabled' diagnostics issue.

2 years agoDaily bump.
GCC Administrator [Tue, 12 Jul 2022 00:16:27 +0000 (00:16 +0000)]
Daily bump.

2 years agolibsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
Martin Liska [Mon, 11 Jul 2022 20:03:14 +0000 (22:03 +0200)]
libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream

9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36

2 years agoAvoid calling range_from_dom when dominator is already resolved.
Andrew MacLeod [Fri, 8 Jul 2022 17:30:49 +0000 (13:30 -0400)]
Avoid calling range_from_dom when dominator is already resolved.

range_from_dom makes a recursive call to resolve the immediate dominator
when there are multiple incoming edges to a block.  This is not necessary
when the dominator already has an on-entry cache value.

PR tree-optimization/106234
* gimple-range-cache.cc (ranger_cache::range_from_dom): Check dominator
cache value before recursively resolving it.

2 years agoImproved Scalar-To-Vector (STV) support for TImode to V1TImode on x86_64.
Roger Sayle [Mon, 11 Jul 2022 15:04:46 +0000 (16:04 +0100)]
Improved Scalar-To-Vector (STV) support for TImode to V1TImode on x86_64.

This patch upgrades x86_64's scalar-to-vector (STV) pass to more
aggressively transform 128-bit scalar TImode operations into vector
V1TImode operations performed on SSE registers.  TImode functionality
already exists in STV, but only for move operations.  This change
brings support for logical operations (AND, IOR, XOR, NOT and ANDN)
and comparisons.

The effect of these changes are conveniently demonstrated by the new
sse4_1-stv-5.c test case:

__int128 a[16];
__int128 b[16];
__int128 c[16];

void foo()
{
  for (unsigned int i=0; i<16; i++)
    a[i] = b[i] & ~c[i];
}

which when currently compiled on mainline wtih -O2 -msse4 produces:

foo:    xorl    %eax, %eax
.L2:    movq    c(%rax), %rsi
        movq    c+8(%rax), %rdi
        addq    $16, %rax
        notq    %rsi
        notq    %rdi
        andq    b-16(%rax), %rsi
        andq    b-8(%rax), %rdi
        movq    %rsi, a-16(%rax)
        movq    %rdi, a-8(%rax)
        cmpq    $256, %rax
        jne     .L2
        ret

but with this patch now produces:

foo:    xorl    %eax, %eax
.L2:    movdqa  c(%rax), %xmm0
        pandn   b(%rax), %xmm0
        addq    $16, %rax
        movaps  %xmm0, a-16(%rax)
        cmpq    $256, %rax
        jne     .L2
        ret

Technically, the STV pass is implemented by three C++ classes, a common
abstract base class "scalar_chain" that contains common functionality,
and two derived classes: general_scalar_chain (which handles SI and
DI modes) and timode_scalar_chain (which handles TI modes).  As
mentioned previously, because only TI mode moves were handled the
two worker classes behaved significantly differently.  These changes
bring the functionality of these two classes closer together, which
is reflected by refactoring more shared code from general_scalar_chain
to the parent scalar_chain and reusing it from timode_scalar_chain.
There still remain significant differences (and simplifications) so
the existing division of classes (as specializations) continues to
make sense.

2022-07-11  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386-features.h (scalar_chain): Add fields
insns_conv, n_sse_to_integer and n_integer_to_sse to this
parent class, moved from general_scalar_chain.
(scalar_chain::convert_compare): Protected method moved
from general_scalar_chain.
(mark_dual_mode_def): Make protected, not private virtual.
(scalar_chain:convert_op): New private virtual method.

(general_scalar_chain::general_scalar_chain): Simplify constructor.
(general_scalar_chain::~general_scalar_chain): Delete destructor.
(general_scalar_chain): Move insns_conv, n_sse_to_integer and
n_integer_to_sse fields to parent class, scalar_chain.
(general_scalar_chain::mark_dual_mode_def): Delete prototype.
(general_scalar_chain::convert_compare): Delete prototype.

(timode_scalar_chain::compute_convert_gain): Remove simplistic
implementation, convert to a method prototype.
(timode_scalar_chain::mark_dual_mode_def): Delete prototype.
(timode_scalar_chain::convert_op): Prototype new virtual method.

* config/i386/i386-features.cc (scalar_chain::scalar_chain):
Allocate insns_conv and initialize n_sse_to_integer and
n_integer_to_sse fields in constructor.
(scalar_chain::scalar_chain): Free insns_conv in destructor.

(general_scalar_chain::general_scalar_chain): Delete
constructor, now defined in the class declaration.
(general_scalar_chain::~general_scalar_chain): Delete destructor.

(scalar_chain::mark_dual_mode_def): Renamed from
general_scalar_chain::mark_dual_mode_def.
(timode_scalar_chain::mark_dual_mode_def): Delete.
(scalar_chain::convert_compare): Renamed from
general_scalar_chain::convert_compare.

(timode_scalar_chain::compute_convert_gain): New method to
determine the gain from converting a TImode chain to V1TImode.
(timode_scalar_chain::convert_op): New method to convert an
operand from TImode to V1TImode.

(timode_scalar_chain::convert_insn) <case REG>: Only PUT_MODE
on REG_EQUAL notes that were originally TImode (not CONST_INT).
Handle AND, ANDN, XOR, IOR, NOT and COMPARE.
(timode_mem_p): Helper predicate to check where operand is
memory reference with sufficient alignment for TImode STV.
(timode_scalar_to_vector_candidate_p): Use convertible_comparison_p
to check whether COMPARE is convertible.  Handle SET_DESTs that
that are REG_P or MEM_P and SET_SRCs that are REG, CONST_INT,
CONST_WIDE_INT, MEM, AND, ANDN, IOR, XOR or NOT.

gcc/testsuite/ChangeLog
* gcc.target/i386/sse4_1-stv-2.c: New test case, pand.
* gcc.target/i386/sse4_1-stv-3.c: New test case, por.
* gcc.target/i386/sse4_1-stv-4.c: New test case, pxor.
* gcc.target/i386/sse4_1-stv-5.c: New test case, pandn.
* gcc.target/i386/sse4_1-stv-6.c: New test case, ptest.

2 years agovect: Restore optab_vector argument [PR106250]
Richard Sandiford [Mon, 11 Jul 2022 14:59:00 +0000 (15:59 +0100)]
vect: Restore optab_vector argument [PR106250]

In g:76c3041b856cb0 I'd removed a "C ? optab_vector : optab_mixed_sign"
argument from a call to directly_supported_p, thinking that the argument
only existed because of the condition (which I was removing).  But the
difference between the scalar and vector forms matters for shifts,
so we do still need the argument.

gcc/
PR tree-optimization/106250
* tree-vect-loop.cc (vectorizable_reduction): Reinstate final
argument to directly_supported_p.

2 years agoc-family: Fix option check in handle_pragma_diagnostic [PR106252]
Lewis Hyatt [Mon, 11 Jul 2022 12:12:33 +0000 (08:12 -0400)]
c-family: Fix option check in handle_pragma_diagnostic [PR106252]

In r13-1544, handle_pragma_diagnostic was refactored to support processing
early pragmas. During that process the part looking up option arguments was
inadvertenly moved too early, prior to checking the option was valid, causing
PR106252. Fixed by moving the check back where it goes.

gcc/c-family/ChangeLog:

PR preprocessor/106252
* c-pragma.cc (handle_pragma_diagnostic_impl): Don't look up the
option argument prior to verifying the option was found.

2 years agoMore update-ssa speedup
Richard Biener [Mon, 11 Jul 2022 10:17:40 +0000 (12:17 +0200)]
More update-ssa speedup

When working on a smaller region like a loop version copy the main
time spent is now dominance fast query recompute which does a full
function DFS walk.  The dominance queries within the region of
interest should be O(log n) without fast queries and we should do
on the order of O(n) of them which overall means reasonable
complexity.

For the artificial testcase I'm looking at this shaves off
considerable time again.

* tree-into-ssa.cc (update_ssa): Do not forcefully
re-compute dominance fast queries for TODO_update_ssa_no_phi.

2 years agotree-optimization/106228 - fixup last change
Richard Biener [Mon, 11 Jul 2022 10:07:05 +0000 (12:07 +0200)]
tree-optimization/106228 - fixup last change

The following fixes the last commit to honor the case we are not
vectorizing a loop.

PR tree-optimization/106228
* tree-vect-data-refs.cc (vect_setup_realignment): Adjust
VUSE compute for the non-loop case.

2 years agoMore update-ssa speedup
Richard Biener [Thu, 7 Jul 2022 13:23:28 +0000 (15:23 +0200)]
More update-ssa speedup

When we do TODO_update_ssa_no_phi we already avoid computing
dominance frontiers for all blocks - it is worth to also avoid
walking all dominated blocks in the update domwalk and restrict
the walk to the SEME region with the affected blocks.  We can
do that by walking the CFG in reverse from blocks_to_update to
the common immediate dominator, marking blocks in the region
and telling the domwalk to STOP when leaving it.

For an artificial testcase with N adjacent loops with one
unswitching opportunity that takes the incremental SSA updating
off the -ftime-report radar:

 tree loop unswitching              :  11.25 (  3%)   0.09 (  5%)  11.53 (  3%)    36M (  9%)
 `- tree SSA incremental            :  35.74 (  9%)   0.07 (  4%)  36.65 (  9%)  2734k (  1%)

improves to

 tree loop unswitching              :  10.21 (  3%)   0.05 (  3%)  11.50 (  3%)    36M (  9%)
 `- tree SSA incremental            :   0.66 (  0%)   0.02 (  1%)   0.49 (  0%)  2734k (  1%)

for less localized updates the SEME region isn't likely constrained
enough so I've restricted the extra work to TODO_update_ssa_no_phi
callers.

* tree-into-ssa.cc (rewrite_mode::REWRITE_UPDATE_REGION): New.
(rewrite_update_dom_walker::rewrite_update_dom_walker): Update.
(rewrite_update_dom_walker::m_in_region_flag): New.
(rewrite_update_dom_walker::before_dom_children): If the region
to update is marked, STOP at exits.
(rewrite_blocks): For REWRITE_UPDATE_REGION mark the region
to be updated.
(dump_update_ssa): Use bitmap_empty_p.
(update_ssa): Likewise.  Use REWRITE_UPDATE_REGION when
TODO_update_ssa_no_phi.
* tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Account
pending update_ssa to the caller.

2 years agoEnhance '_Pragma' diagnostics verification in OMP C/C++ test cases
Thomas Schwinge [Mon, 11 Jul 2022 07:33:19 +0000 (09:33 +0200)]
Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases

Follow-up to recent commit 0587cef3d7962a8b0f44779589ba2920dd3d71e5
"c: Fix location for _Pragma tokens [PR97498]".

gcc/testsuite/
* c-c++-common/gomp/pragma-3.c: Enhance '_Pragma' diagnostics
verification.
* c-c++-common/gomp/pragma-5.c: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Enhance
'_Pragma' diagnostics verification.

2 years agotarget/105459 - allow delayed target option node fixup
Richard Biener [Fri, 1 Jul 2022 12:11:35 +0000 (14:11 +0200)]
target/105459 - allow delayed target option node fixup

The following avoids the need to massage the target optimization
node at WPA time when we fixup the optimization node, copying
FP related flags from callee to caller.  The target is already
set up to fixup, but that only works when not switching between
functions.  After fixing that the fixup is then done at LTRANS
time when materializing the function.

2022-07-01  Richard Biener  <rguenthert@suse.de>

PR target/105459
* config/i386/i386-options.cc (ix86_set_current_function):
Rebuild the target optimization node whenever necessary,
not only when the optimization node didn't change.

* gcc.dg/lto/pr105459_0.c: New testcase.

2 years agotree-optimization/106228 - fix vect_setup_realignment virtual SSA handling
Richard Biener [Mon, 11 Jul 2022 07:23:50 +0000 (09:23 +0200)]
tree-optimization/106228 - fix vect_setup_realignment virtual SSA handling

The following adds missing assignment of a virtual use operand to a
created load to vect_setup_realignment which shows as bootstrap
failure on powerpc64-linux and extra testsuite fails for targets
when misaligned loads are not supported or not optimal.

PR tree-optimization/106228
* tree-vect-data-refs.cc (vect_setup_realignment): Properly
set a VUSE operand on the emitted load.

2 years agoImplement global ranges for all vrange types (SSA_NAME_RANGE_INFO).
Aldy Hernandez [Fri, 10 Jun 2022 13:11:06 +0000 (15:11 +0200)]
Implement global ranges for all vrange types (SSA_NAME_RANGE_INFO).

Currently SSA_NAME_RANGE_INFO only handles integer ranges, and loses
half the precision in the process because its use of legacy
value_range's.  This patch rewrites all the SSA_NAME_RANGE_INFO
(nonzero bits included) to use the recently contributed
vrange_storage.  With it, we'll be able to efficiently save any ranges
supported by ranger in GC memory.  Presently this will only be
irange's, but shortly we'll add floating ranges and others to the mix.

As per the discussion with the trailing_wide_ints adjustments and
vrange_storage, we'll be able to save integer ranges with a maximum of
5 sub-ranges.  This could be adjusted later if more sub-ranges are
needed (unlikely).

Since this is a behavior changing patch, I would like to take a few
days for discussion, and commit early next week if all goes well.

A few notes.

First, we get rid of the SSA_NAME_ANTI_RANGE_P bit in the SSA_NAME
since we store full resolution ranges.  Perhaps it could be re-used
for something else.

The range_info_def struct is gone in favor of an opaque type handled
by vrange_storage.  It currently supports irange, but will support
frange, prange, etc, in due time.

From the looks of it, set_range_info was an update operation despite
its name, as we improved the nonzero bits with each call, even though
we clobbered the ranges.  Presumably this was because doing a proper
intersect of ranges lost information with the anti-range hack.  We no
longer have this limitation so now we formalize both set_range_info
and set_nonzero_bits to an update operation.  After all, we should
never be losing information, but enhancing it whenever possible.  This
means, that if folks' finger-memory is not offended, as a follow-up,
I'd like to rename set_nonzero_bits and set_range_info to update_*.

I have kept the same global API we had in tree-ssanames.h, with the
caveat that all set operations are now update as discussed above.

There is a 2% performance penalty for evrp and a 3% penalty for VRP
that is coincidentally in line with a previous improvement of the same
amount in the vrange abstraction patchset.  Interestingly, this
penalty is mostly due to the wide int to tree dance we keep doing with
irange and legacy.  In a first draft of this patch where I was
streaming trees directly, there was actually a small improvement
instead.  I hope to get some of the gain back when we move irange's to
wide-ints, though I'm not in a hurry ;-).

Tested and benchmarked on x86-64 Linux.  Tested on ppc64le Linux.

Comments welcome.

gcc/ChangeLog:

* gimple-range.cc (gimple_ranger::export_global_ranges): Remove
verification against legacy value_range.
(gimple_ranger::register_inferred_ranges): Same.
(gimple_ranger::export_global_ranges): Rename update_global_range
to set_range_info.
* tree-core.h (struct range_info_def): Remove.
(struct irange_storage_slot): New.
(struct tree_base): Remove SSA_NAME_ANTI_RANGE_P documentation.
(struct tree_ssa_name): Add vrange_storage support.
* tree-ssanames.cc (range_info_p): New.
(range_info_fits_p): New.
(range_info_alloc): New.
(range_info_free): New.
(range_info_get_range): New.
(range_info_set_range): New.
(set_range_info_raw): Remove.
(set_range_info): Adjust to use vrange_storage.
(set_nonzero_bits): Same.
(get_nonzero_bits): Same.
(duplicate_ssa_name_range_info): Remove overload taking
value_range_kind.
Rewrite tree overload to use vrange_storage.
(duplicate_ssa_name_fn): Adjust to use vrange_storage.
* tree-ssanames.h (struct range_info_def): Remove.
(set_range_info): Adjust prototype to take vrange.
* tree-vrp.cc (vrp_asserts::remove_range_assertions): Call
duplicate_ssa_name_range_info.
* tree.h (SSA_NAME_ANTI_RANGE_P): Remove.
(SSA_NAME_RANGE_TYPE): Remove.
* value-query.cc (get_ssa_name_range_info): Adjust to use
vrange_storage.
(update_global_range): Remove.
(get_range_global): Remove as_a<irange>.
* value-query.h (update_global_range): Remove.
* tree-ssa-dom.cc (set_global_ranges_from_unreachable_edges):
Rename update_global_range to set_range_info.
* value-range-storage.cc (vrange_storage::alloc_slot): Remove
gcc_unreachable.

2 years agoDaily bump.
GCC Administrator [Mon, 11 Jul 2022 00:16:25 +0000 (00:16 +0000)]
Daily bump.

2 years agoc: Fix location for _Pragma tokens [PR97498]
Lewis Hyatt [Sat, 9 Jul 2022 20:12:21 +0000 (16:12 -0400)]
c: Fix location for _Pragma tokens [PR97498]

The handling of #pragma GCC diagnostic uses input_location, which is not always
as precise as needed; in particular the relative location of some tokens and a
_Pragma directive will crucially determine whether a given diagnostic is enabled
or suppressed in the desired way. PR97498 shows how the C frontend ends up with
input_location pointing to the beginning of the line containing a _Pragma()
directive, resulting in the wrong behavior if the diagnostic to be modified
pertains to some tokens found earlier on the same line. This patch fixes that by
addressing two issues:

    a) libcpp was not assigning a valid location to the CPP_PRAGMA token
    generated by the _Pragma directive.
    b) C frontend was not setting input_location to something reasonable.

With this change, the C frontend is able to change input_location to point to
the _Pragma token as needed.

This is just a two-line fix (one for each of a) and b)), the testsuite changes
were needed only because the location on the tested warnings has been somewhat
improved, so the tests need to look for the new locations.

gcc/c/ChangeLog:

PR preprocessor/97498
* c-parser.cc (c_parser_pragma): Set input_location to the
location of the pragma, rather than the start of the line.

libcpp/ChangeLog:

PR preprocessor/97498
* directives.cc (destringize_and_run): Override the location of
the CPP_PRAGMA token from a _Pragma directive to the location of
the expansion point, as is done for the tokens lexed from it.

gcc/testsuite/ChangeLog:

PR preprocessor/97498
* c-c++-common/pr97498.c: New test.
* c-c++-common/gomp/pragma-3.c: Adapt for improved warning locations.
* c-c++-common/gomp/pragma-5.c: Likewise.
* gcc.dg/pragma-message.c: Likewise.

libgomp/ChangeLog:

* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Adapt for
improved warning locations.
* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Likewise.

2 years agotestsuite: Require int128 for gcc.dg/pr106063.c
Dimitar Dimitrov [Sun, 10 Jul 2022 08:15:39 +0000 (11:15 +0300)]
testsuite: Require int128 for gcc.dg/pr106063.c

Require effective target int128 for gcc.dg/pr106063.c.

PR tree-optimization/106063

gcc/testsuite/ChangeLog:

* gcc.dg/pr106063.c: Require effective target int128.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 years agoCleanups to irange::nonzero bit code.
Aldy Hernandez [Sat, 9 Jul 2022 15:43:47 +0000 (17:43 +0200)]
Cleanups to irange::nonzero bit code.

In discussions with Andrew we realized varying_p() was returning true
for a range of the entire domain with a non-empty nonzero mask.  This
is confusing as varying_p() should only return true when absolutely no
information is available.  A nonzero mask that has any cleared bits is
extra information and must return false for varying_p().  This patch
fixes this oversight.  Now a range of the entire domain with nonzero
bits, is internally set to VR_RANGE (with the appropriate end points
set).  VR_VARYING ranges must have a null nonzero mask.

Also, the union and intersect code were not quite right in the presence of
nonzero masks.  Sometimes we would drop masks to -1 unnecessarily.  I
was trying to be too smart in avoiding extra work when the mask was
NULL, but there's also an implicit mask in the range that must be
taken into account.  For example, [0,0] may have no nonzero bits set
explicitly, but the mask is really 0x0.  This will all be simpler when
we drop trees, because the nonzero bits will always be set, even if
-1.

Finally, I've added unit tests to the nonzero mask code.  This should
help us maintain sanity going forward.

There should be no visible changes, as the main consumer of this code
is the SSA_NAME_RANGE_INFO patchset which has yet to be committed.

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range.cc (irange::operator=): Call verify_range.
(irange::irange_set): Normalize kind after everything else has
been set.
(irange::irange_set_anti_range): Same.
(irange::set): Same.
(irange::verify_range): Disallow nonzero masks for VARYING.
(irange::irange_union): Call verify_range.
Handle nonzero masks better.
(irange::irange_intersect): Same.
(irange::set_nonzero_bits): Calculate mask if either range has an
explicit mask.
(irange::intersect_nonzero_bits): Same.
(irange::union_nonzero_bits): Same.
(range_tests_nonzero_bits): New.
(range_tests): Call range_tests_nonzero_bits.
* value-range.h (class irange): Remove set_nonzero_bits method
with trees.
(irange::varying_compatible_p): Set nonzero mask.

2 years agoloongarch: avoid unnecessary sign-extend after 32-bit division
Xi Ruoyao [Wed, 6 Jul 2022 15:22:29 +0000 (23:22 +0800)]
loongarch: avoid unnecessary sign-extend after 32-bit division

Like add.w/sub.w/mul.w, div.w/mod.w/div.wu/mod.wu also sign-extend the
output on LA64.  But, LoongArch v1.00 mandates that the inputs of 32-bit
division to be sign-extended so we have to expand 32-bit division into
RTL sequences.

We defined div.w/mod.w/div.wu/mod.wu as a (DI, DI) -> SI instruction.
This definition does not indicate the fact that these instructions will
store the result as sign-extended value in a 64-bit GR.  Then the
compiler would emit unnecessary sign-extend operations.  For example:

    int div(int a, int b) { return a / b; }

was compiled to:

    div.w  $r4, $r4, $r5
    slli.w $r4, $r4, 0    # this is unnecessary
    jr     $r1

To remove this unnecessary operation, we change the division
instructions to (DI, DI) -> DI and describe the sign-extend behavior
explicitly in the RTL template.  In the expander for 32-bit division we
then use simplify_gen_subreg to extract the lower 32 bits.

gcc/ChangeLog:

* config/loongarch/loongarch.md (<any_div>di3_fake): Describe
the sign-extend of result in the RTL template.
(<any_div><mode>3): Adjust for <any_div>di3_fake change.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/div-4.c: New test.

2 years agoloongarch: add alternatives for idiv insns to improve code generation
Xi Ruoyao [Wed, 6 Jul 2022 05:45:55 +0000 (13:45 +0800)]
loongarch: add alternatives for idiv insns to improve code generation

Currently in the description of LoongArch integer division instructions,
the output is marked as earlyclobbered ('&').  It's necessary when
loongarch_check_zero_div_p() because clobbering operand 2 (divisor) will
make the checking for zero divisor impossible.

But, for -mno-check-zero-division (the default of GCC >= 12.2 for
optimized code), the output is not earlyclobbered at all.  And, the
read of operand 1 only occurs before clobbering the output.  So we make
three alternatives for an idiv instruction:

* (=r,r,r): For -mno-check-zero-division.
* (=&r,r,r): For -mcheck-zero-division.
* (=&r,0,r): For -mcheck-zero-division, to explicitly allow patterns
  like "div.d $a0, $a0, $a1".

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_check_zero_div_p):
Remove static, for use in the machine description file.
* config/loongarch/loongarch-protos.h:
(loongarch_check_zero_div_p): Add prototype.
* config/loongarch/loongarch.md (enabled): New attr.
(*<optab><mode>3): Add (=r,r,r) and (=&r,0,r) alternatives for
idiv.  Conditionally enable the alternatives using
loongarch_check_zero_div_p.
(<optab>di3_fake): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/div-1.c: New test.
* gcc.target/loongarch/div-2.c: New test.
* gcc.target/loongarch/div-3.c: New test.

2 years agoloongarch: fix mulsidi3_64bit instruction
Xi Ruoyao [Fri, 8 Jul 2022 13:09:25 +0000 (21:09 +0800)]
loongarch: fix mulsidi3_64bit instruction

(mult (sign_extend:DI rj:SI) (sign_extend:DI rk:SI)) should be
"mulw.d.w", not "mul.d".

gcc/ChangeLog:

* config/loongarch/loongarch.md (mulsidi3_64bit): Use mulw.d.w
instead of mul.d.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/mulw_d_w.c: New test.
* gcc.c-torture/execute/mul-sext.c: New test.

2 years agoDaily bump.
GCC Administrator [Sun, 10 Jul 2022 00:16:23 +0000 (00:16 +0000)]
Daily bump.

2 years agoSet VR_VARYING in irange::irange_single_pair_union.
Aldy Hernandez [Sat, 9 Jul 2022 15:43:44 +0000 (17:43 +0200)]
Set VR_VARYING in irange::irange_single_pair_union.

The fast union operation is sometimes setting a range of the entire
domain, but leaving the kind bit as VR_RANGE instead of downgrading it
to VR_VARYING.

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range.cc (irange::irange_single_pair_union): Set
VR_VARYING when appropriate.

2 years ago[PATCH v3] c: Extend the -Wpadded message with actual padding size
Vit Kabele [Sat, 9 Jul 2022 17:06:43 +0000 (13:06 -0400)]
[PATCH v3] c: Extend the -Wpadded message with actual padding size

gcc/ChangeLog:

* stor-layout.cc (finalize_record_size): Extend warning message.

gcc/testsuite/ChangeLog:

* c-c++-common/Wpadded.c: New test.

2 years ago[PATCH] match.pd: Add new bitwise arithmetic pattern [PR98304]
Sam Feifer [Sat, 9 Jul 2022 16:08:01 +0000 (12:08 -0400)]
[PATCH] match.pd: Add new bitwise arithmetic pattern [PR98304]

PR tree-optimization/98304

gcc:

* match.pd (n - (((n > C1) ? n : C1) & -C2)): New simplification.

gcc/testsuite:

* gcc.c-torture/execute/pr98304-2.c: New test.
* gcc.dg/pr98304-1.c: New test.

2 years ago[RFA] Improve initialization of objects when the initializer has trailing zeros.
Jeff Law [Sat, 9 Jul 2022 15:11:00 +0000 (11:11 -0400)]
[RFA] Improve initialization of objects when the initializer has trailing zeros.

gcc/

* expr.cc (store_expr): Identify trailing NULs in a STRING_CST
initializer and use clear_storage rather than copying the
NULs to the destination array.

2 years agolibstdc++: Remove obsolete comment in <string> header
François Dumont [Sat, 9 Jul 2022 12:18:15 +0000 (14:18 +0200)]
libstdc++: Remove obsolete comment in <string> header

The comment is obsolete because char_traits.h do not include stl_algobase.h
anymore and stl_algobase.h is included directly from <string> a few lines
below.

libstdc++-v3/ChangeLog:

* include/std/string: Remove obsolete comment about char_traits.h including
stl_algobase.h.

2 years agoImprove preservation of FLAGS_REG mode in i386.md's peephole2s.
Roger Sayle [Sat, 9 Jul 2022 08:07:18 +0000 (09:07 +0100)]
Improve preservation of FLAGS_REG mode in i386.md's peephole2s.

The patch tweaks several peephole2s in i386.md that propagate the flags
register, but take its mode from the SET_SRC rather than preserve the
mode of the original SET_DEST.  This encounters problems when the
SET_SRC is a VOIDmode CONST_INT.  Fixed by using match_operand with a
flags_reg_operand predicate.

2022-07-09  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386.md (define_peephole2): Use match_operand of
flags_reg_operand to capture and preserve the mode of FLAGS_REG.
(define_peephole2): Likewise.
(define_peephole2): Likewise...

2 years agoSupport *testdi_not_doubleword during STV pass on x86.
Roger Sayle [Sat, 9 Jul 2022 08:02:14 +0000 (09:02 +0100)]
Support *testdi_not_doubleword during STV pass on x86.

This patch fixes the current two FAILs of pr65105-5.c on x86 when
compiled with -m32.  These (temporary) breakages were fallout from my
patches to improve/upgrade (scalar) double word comparisons.
On mainline, the i386 backend currently represents a critical comparison
using (compare (and (not reg1) reg2) (const_int 0)) which isn't/wasn't
recognized by the STV pass' convertible_comparison_p.  This simple STV
patch adds support for this pattern (*testdi_not_doubleword) and
generates the vector pandn and ptest instructions expected in the
existing (failing) test case.

2022-07-09  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386-features.cc (convert_compare): Add support
for *testdi_not_doubleword pattern, "(compare (and (not ...)))"
by generating a pandn followed by ptest.
(convertible_comparison_p): Recognize both *cmpdi_doubleword and
recent *testdi_not_doubleword comparison patterns.

2 years ago[PATCH][s390]: Fix the usage of store_bit_field in the backend.
Tamar Christina [Sat, 9 Jul 2022 01:54:44 +0000 (21:54 -0400)]
[PATCH][s390]: Fix the usage of store_bit_field in the backend.

Hi All,

I seem to have broken the s390 bootstrap because I added a new parameter to the
store_bit_field function to indicate whether the value the field of is being set
is currently undefined.

If it's undefined we use a subreg instead.  In this case the value of false
restores the old behavior.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

* config/s390/s390.cc (s390_expand_atomic): Pass false to store_bit_field to
indicate that the value is not undefined.

2 years agoFix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only...
Andrew Pinski [Thu, 7 Jul 2022 22:06:19 +0000 (22:06 +0000)]
Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars

The problem here is that when we mark the ssa name that was referenced in the now removed
dead store (to a write only static variable), the inline-asm would also be removed
even though it was defining another ssa name. This fixes the problem by checking
to make sure that the statement was only defining one ssa name.

Committed as approved after a bootstrapped and tested on x86_64 with no regressions.

PR tree-optimization/106087

gcc/ChangeLog:

* tree-ssa-dce.cc (simple_dce_from_worklist): Check
to make sure the statement is only defining one operand.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/inline-asm-1.c: New test.

2 years agoDaily bump.
GCC Administrator [Sat, 9 Jul 2022 00:16:54 +0000 (00:16 +0000)]
Daily bump.

2 years agolibbacktrace: check for sys/link.h
Ian Lance Taylor [Fri, 8 Jul 2022 17:28:24 +0000 (10:28 -0700)]
libbacktrace: check for sys/link.h

QNX uses sys/link.h rather than link.h for dl_iterate_phdr

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/86

* configure.ac: Check for sys/link.h.  Use either link.h or
sys/link.h when checking for dl_iterate_phdr.
* elf.c: Include sys/link.h if available.
* configure, config.h.in: Regenerate.

2 years agotestsuite: Fix tree-ssa/alias-access-path-13.c on 32bit platforms (PR 106216)
Martin Jambor [Fri, 8 Jul 2022 16:12:26 +0000 (18:12 +0200)]
testsuite: Fix tree-ssa/alias-access-path-13.c on 32bit platforms (PR 106216)

For gcc.dg/tree-ssa/alias-access-path-13.c to work, SRA must think of
accesses to foo.inn.val and to foo itself as different ones, i.e. they
need to have different offset and size, which on 32bit platforms they
do not.  Fixed by replacing a dummy long int field of the union with a
struct of two integers.

Tested by:
  make -k check-gcc RUNTESTFLAGS="tree-ssa.exp=alias-access-path-13.c" and
  make -k check-gcc RUNTESTFLAGS="--target_board=unix'{-m32}' tree-ssa.exp=alias-access-path-13.c"
on an x86_64-linux, also with patched SRA to verify it still tests the
original intent.

gcc/testsuite/ChangeLog:

2022-07-08  Martin Jambor  <mjambor@suse.cz>

PR testsuite/106216
* gcc.dg/tree-ssa/alias-access-path-13.c (union foo): Replace a long
int field with a struct that is larger than an int also on 32bit
platforms.

2 years agodiagnostics: Make line-ending logic consistent with libcpp [PR91733]
Lewis Hyatt [Thu, 7 Jul 2022 17:59:27 +0000 (13:59 -0400)]
diagnostics: Make line-ending logic consistent with libcpp [PR91733]

libcpp recognizes a lone \r as a valid line ending, so the infrastructure
for retrieving source lines to be output in diagnostics needs to do the
same. This patch fixes file_cache_slot::get_next_line() accordingly so that
diagnostics display the correct part of the source when \r line endings are in
use.

gcc/ChangeLog:

PR preprocessor/91733
* input.cc (find_end_of_line): New helper function.
(file_cache_slot::get_next_line): Recognize \r as a line ending.
* diagnostic-show-locus.cc (test_escaping_bytes_1): Adapt selftest
since \r will now be interpreted as a line-ending.

gcc/testsuite/ChangeLog:

PR preprocessor/91733
* c-c++-common/pr91733.c: New test.

2 years agosanitizer: Fix hwasan related option conflicts [PR106132]
Martin Liska [Wed, 29 Jun 2022 08:26:52 +0000 (10:26 +0200)]
sanitizer: Fix hwasan related option conflicts [PR106132]

Split report_conflicting_sanitizer_options(..., SANITIZE_ADDRESS | SANITIZE_HWADDRESS)
call into 2 calls as we don't have any option that would be
address+hwaddress (that conflicts) as well.

PR sanitizer/106132

gcc/ChangeLog:

* opts.cc (finish_options): Use 2 calls to
report_conflicting_sanitizer_options.

gcc/testsuite/ChangeLog:

* c-c++-common/hwasan/arguments-3.c: Cover new ICE.

2 years agotree-optimization/106226 - move vectorizer virtual SSA update
Richard Biener [Fri, 8 Jul 2022 08:41:59 +0000 (10:41 +0200)]
tree-optimization/106226 - move vectorizer virtual SSA update

When we knowingly have broken virtual SSA form we need to update
it before we eventually perform slpeel manual updating which will
call delete_update_ssa.  Currently that's done on-demand but
communicating whether it's a known unavoidable case is broken
there.  The following makes that a synchronous operation but
instead of actually performing the update we instead recod the
need, clear the update SSA sub-state and force virtual renaming
at the very end of the vectorization pass.

PR tree-optimization/106226
* tree-vect-loop-manip.cc (vect_do_peeling): Assert that
no SSA update is needed.  Move virtual SSA update ...
* tree-vectorizer.cc (pass_vectorize::execute): ... here,
via forced virtual renaming when TODO_update_ssa_only_virtuals
is queued.
(vect_transform_loops): Return TODO_update_ssa_only_virtuals
when virtual SSA update is required.
(try_vectorize_loop_1): Adjust.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Allow
virtual renaming if the ABI forces an aggregate return
but the original call did not have a virtual definition.

* gfortran.dg/pr106226.f: New testcase.

2 years agolto-dump: Do not print output file
Martin Liska [Mon, 4 Jul 2022 14:32:51 +0000 (16:32 +0200)]
lto-dump: Do not print output file

Right now the following is printed:

lto-dump
.file "<artificial>"
.ident "GCC: (GNU) 13.0.0 20220707 (experimental)"
.section .note.GNU-stack,"",@progbits

After the patch we print -help and do not emit any assembly output:

lto-dump
Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...

LTO dump tool command line options.

  -list [options]           Dump the symbol list.
    -demangle               Dump the demangled output.
    -defined-only           Dump only the defined symbols.
...

gcc/lto/ChangeLog:

* lto-dump.cc (lto_main): Exit in the function
as we don't want any LTO bytecode processing.

gcc/ChangeLog:

* toplev.cc (init_asm_output): Do not init asm_out_file.

2 years agomiddle-end: don't lower past veclower [PR106063]
Tamar Christina [Fri, 8 Jul 2022 07:30:22 +0000 (08:30 +0100)]
middle-end: don't lower past veclower [PR106063]

Hi All,

My previous patch can cause a problem if the pattern matches after veclower
as it may replace the construct with a vector sequence which the target may not
directly support.

As such don't perform the rewriting if after veclower unless the target supports
the operation.  If before veclower do the rewriting as well if the target didn't
support the original operation either.

gcc/ChangeLog:

PR tree-optimization/106063
* match.pd: Do not apply pattern after veclower is not supported.

gcc/testsuite/ChangeLog:

PR tree-optimization/106063
* gcc.dg/pr106063.c: New test.

2 years agoFix one issue in OpenMP 'requires' directive diagnostics
Thomas Schwinge [Thu, 7 Jul 2022 13:11:03 +0000 (15:11 +0200)]
Fix one issue in OpenMP 'requires' directive diagnostics

Fix-up for recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".

gcc/
* lto-cgraph.cc (input_offload_tables) <LTO_symtab_edge>: Correct
'fn2' computation.
libgomp/
* testsuite/libgomp.c-c++-common/requires-1.c: Add 'dg-note's.
* testsuite/libgomp.c-c++-common/requires-2.c: Likewise.
* testsuite/libgomp.c-c++-common/requires-3.c: Likewise.
* testsuite/libgomp.c-c++-common/requires-7.c: Likewise.
* testsuite/libgomp.fortran/requires-1.f90: Likewise.

2 years agomiddle-end: Use subregs to expand COMPLEX_EXPR to set the lowpart.
Tamar Christina [Fri, 8 Jul 2022 06:37:20 +0000 (07:37 +0100)]
middle-end: Use subregs to expand COMPLEX_EXPR to set the lowpart.

When lowering COMPLEX_EXPR we currently emit two VEC_EXTRACTs.  One for the
lowpart and one for the highpart.

The problem with this is that in RTL the lvalue of the RTX is the only thing
tying the two instructions together.

This means that e.g. combine is unable to try to combine the two instructions
for setting the lowpart and highpart.

For ISAs that have bit extract instructions we can eliminate one of the extracts
if, and only if we're setting the entire complex number.

This change changes the expand code when we're setting the entire complex number
to generate a subreg for the lowpart instead of a vec_extract.

This allows us to optimize sequences such as:

_Complex int f(int a, int b) {
    _Complex int t = a + b * 1i;
    return t;
}

from:

f:
bfi     x2, x0, 0, 32
bfi     x2, x1, 32, 32
mov     x0, x2
ret

into:

f:
bfi x0, x1, 32, 32
ret

I have also confirmed the codegen for x86_64 did not change.

gcc/ChangeLog:

* expmed.cc (store_bit_field_1): Add parameter that indicates if value is
still undefined and if so emit a subreg move instead.
(store_integral_bit_field): Likewise.
(store_bit_field): Likewise.
* expr.h (write_complex_part): Likewise.
* expmed.h (store_bit_field): Add new parameter.
* builtins.cc (expand_ifn_atomic_compare_exchange_into_call): Use new
parameter.
(expand_ifn_atomic_compare_exchange): Likewise.
* calls.cc (store_unaligned_arguments_into_pseudos): Likewise.
* emit-rtl.cc (validate_subreg): Likewise.
* expr.cc (emit_group_store): Likewise.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(clear_storage_hints): Likewise.
(write_complex_part):  Likewise.
(emit_move_complex_parts): Likewise.
(expand_assignment): Likewise.
(store_expr): Likewise.
(store_field): Likewise.
(expand_expr_real_2): Likewise.
* ifcvt.cc (noce_emit_move_insn): Likewise.
* internal-fn.cc (expand_arith_set_overflow): Likewise.
(expand_arith_overflow_result_store): Likewise.
(expand_addsub_overflow): Likewise.
(expand_neg_overflow): Likewise.
(expand_mul_overflow): Likewise.
(expand_arith_overflow): Likewise.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/complex-init.C: New test.

2 years agoi386: Handle memory operand for direct call to cvtps2pd in unpack
Haochen Jiang [Tue, 5 Jul 2022 06:12:18 +0000 (14:12 +0800)]
i386: Handle memory operand for direct call to cvtps2pd in unpack

gcc/ChangeLog:

PR target/106180
* config/i386/sse.md (sse2_cvtps2pd<mask_name>_1):
Rename from *sse2_cvtps2pd<mask_name>_1.
(vec_unpacks_lo_v4sf): Add handler for memory operand.

gcc/testsuite/ChangeLog:

PR target/106180
* g++.target/i386/pr106180-1.C: New test.

2 years agoLoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame-...
Lulu Cheng [Thu, 7 Jul 2022 10:07:28 +0000 (18:07 +0800)]
LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

Under the LA architecture, when the stack is dropped too far, the process
of dropping the stack is divided into two steps.
step1: After dropping the stack, save callee saved registers on the stack.
step2: The rest of it.

The stack drop operation is optimized when frame->total_size minus
frame->sp_fp_offset is an integer multiple of 4096, can reduce the number
of instructions required to drop the stack. However, this optimization is
not effective because of the original calculation method

The following case:
int main()
{
     char buf[1024 * 12];
     printf ("%p\n", buf);
     return 0;
}

As you can see from the generated assembler, the old GCC has two more
instructions than the new GCC, lines 14 and line 24.

   new                                        old
 10 main:                       | 11 main:
 11   addi.d  $r3,$r3,-16       | 12   lu12i.w $r13,-12288>>12
 12   lu12i.w $r13,-12288>>12   | 13   addi.d  $r3,$r3,-2032
 13   lu12i.w $r5,-12288>>12    | 14   ori $r13,$r13,2016
 14   lu12i.w $r12,12288>>12    | 15   lu12i.w $r5,-12288>>12
 15   st.d  $r1,$r3,8           | 16   lu12i.w $r12,12288>>12
 16   add.d $r12,$r12,$r5       | 17   st.d  $r1,$r3,2024
 17   add.d $r3,$r3,$r13        | 18   add.d $r12,$r12,$r5
 18   add.d $r5,$r12,$r3        | 19   add.d $r3,$r3,$r13
 19   la.local  $r4,.LC0        | 20   add.d $r5,$r12,$r3
 20   bl  %plt(printf)          | 21   la.local  $r4,.LC0
 21   lu12i.w $r13,12288>>12    | 22   bl  %plt(printf)
 22   add.d $r3,$r3,$r13        | 23   lu12i.w $r13,8192>>12
 23   ld.d  $r1,$r3,8           | 24   ori $r13,$r13,2080
 24   or  $r4,$r0,$r0           | 25   add.d $r3,$r3,$r13
 25   addi.d  $r3,$r3,16        | 26   ld.d  $r1,$r3,2024
 26   jr  $r1                   | 27   or  $r4,$r0,$r0
        | 28   addi.d  $r3,$r3,2032
  | 29   jr  $r1
gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_compute_frame_info):
Modify fp_sp_offset and gp_sp_offset's calculation method,
when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD
or UNITS_PER_FP_REG.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/prolog-opt.c: New test.

2 years agoDaily bump.
GCC Administrator [Fri, 8 Jul 2022 00:16:22 +0000 (00:16 +0000)]
Daily bump.

2 years agolibbacktrace: don't exit Mach-O dyld library loop on one failure
Ian Lance Taylor [Thu, 7 Jul 2022 23:54:05 +0000 (16:54 -0700)]
libbacktrace: don't exit Mach-O dyld library loop on one failure

* macho.c (backtrace_initialize) [HAVE_MACH_O_DYLD_H]: Don't exit
loop if we can't find debug info for one shared library.

2 years agolibbacktrace: don't let "make clean" remove allocfail.sh
Ian Lance Taylor [Thu, 7 Jul 2022 23:13:57 +0000 (16:13 -0700)]
libbacktrace: don't let "make clean" remove allocfail.sh

For https://github.com/ianlancetaylor/libbacktrace/issues/81
* Makefile.am (MAKETESTS): New variable split out of TESTS.
(CLEANFILES): Replace TESTS with BUILDTESTS and MAKETESTS.
* Makefile.in: Regenerate.

2 years agoc++: generic targs and identity substitution [PR105956]
Patrick Palka [Thu, 7 Jul 2022 20:46:29 +0000 (16:46 -0400)]
c++: generic targs and identity substitution [PR105956]

In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic
DECL_TI_ARGS corresponds to an identity mapping of the given arguments,
and hence its safe to always elide such substitution.  But this PR
demonstrates that such a substitution isn't always the identity mapping,
in particular when there's an ARGUMENT_PACK_SELECT argument, which gets
handled specially during substitution:

  * when substituting an APS into a template parameter, we strip the
    APS to its underlying argument;
  * and when substituting an APS into a pack expansion, we strip the
    APS to its underlying argument pack.

In this testcase, when expanding the pack expansion pattern (idx + Ns)...
with Ns={0,1}, we specialize idx twice, first with Ns=APS<0,{0,1}> and
then Ns=APS<1,{0,1}>.  The DECL_TI_ARGS of idx are the generic template
arguments of the enclosing class template impl, so before r13-1045,
we'd substitute into its DECL_TI_ARGS which gave Ns={0,1} as desired.
But after r13-1045, we elide this substitution and end up attempting to
hash the original Ns argument, an APS, which ICEs.

So this patch reverts that part of r13-1045.  I considered using
preserve_args in this case instead, but that'd break the static_assert
in the testcase because preserve_args always strips APS to its
underlying argument, but here we want to strip it to its underlying
argument pack, so we'd incorrectly end up forming the specializations
impl<0>::idx and impl<1>::idx instead of impl<0,1>::idx.

Although we can't elide the substitution into DECL_TI_ARGS in light of
ARGUMENT_PACK_SELECT, it should still be safe to elide template argument
coercion in the case of a non-template decl, which this patch preserves.

It's unfortunate that we need to remove this optimization just because
it doesn't hold for one special tree code.  So this patch implements a
heuristic in tsubst_template_args to avoid allocating a new TREE_VEC if
the substituted elements are identical to those of a level from ARGS, as
well as a similar heuristic for tsubst_argument_pack.  It turns out that
about 40% of all calls to tsubst_template_args benefit from this, and it
reduces memory usage by about 4% for e.g. range-v3's zip.cpp (relative to
r13-1045) which more than makes up for the reversion.

PR c++/105956

gcc/cp/ChangeLog:

* pt.cc (template_arg_to_parm): Define.
(tsubst_argument_pack): Try to reuse the corresponding
ARGUMENT_PACK from 'args' when substituting into a generic
ARGUMENT_PACK for a variadic template parameter.
(tsubst_template_args): Move variable declarations closer to
their first use.  Replace 'orig_t' with 'r'.  Rename 'need_new'
to 'const_subst_p'.  Heuristically detect if the substituted
elements are identical to that of a level from 'args' and avoid
allocating a new TREE_VEC if so.  Add sanity check for the
length of the new TREE_VEC, and remove dead ARGUMENT_PACK_P test.
(tsubst_decl) <case TYPE_DECL, case VAR_DECL>: Revert
r13-1045-gcb7fd1ea85feea change for avoiding substitution into
DECL_TI_ARGS, but still avoid coercion in this case.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic183.C: New test.

2 years agoanalyzer: use label_text for superedge::get_description
David Malcolm [Thu, 7 Jul 2022 19:50:26 +0000 (15:50 -0400)]
analyzer: use label_text for superedge::get_description

gcc/analyzer/ChangeLog:
* checker-path.cc (start_cfg_edge_event::get_desc): Update for
superedge::get_description returning a label_text.
* engine.cc (feasibility_state::maybe_update_for_edge): Likewise.
* supergraph.cc (superedge::dump): Likewise.
(superedge::get_description): Convert return type from char * to
label_text.
* supergraph.h (superedge::get_description): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agoConvert label_text to C++11 move semantics
David Malcolm [Thu, 7 Jul 2022 19:50:26 +0000 (15:50 -0400)]
Convert label_text to C++11 move semantics

libcpp's class label_text stores a char * for a string and a flag saying
whether it owns the buffer.  I added this class before we could use
C++11, and so to avoid lots of copying it required an explicit call
to label_text::maybe_free to potentially free the buffer.

Now that we can use C++11, this patch removes label_text::maybe_free in
favor of doing the cleanup in the destructor, and using C++ move
semantics to avoid any copying.  This allows lots of messy cleanup code
to be eliminated in favor of implicit destruction (mostly in the
analyzer).

No functional change intended.

gcc/analyzer/ChangeLog:
* call-info.cc (call_info::print): Update for removal of
label_text::maybe_free in favor of automatic memory management.
* checker-path.cc (checker_event::dump): Likewise.
(checker_event::prepare_for_emission): Likewise.
(state_change_event::get_desc): Likewise.
(superedge_event::should_filter_p): Likewise.
(start_cfg_edge_event::get_desc): Likewise.
(warning_event::get_desc): Likewise.
(checker_path::dump): Likewise.
(checker_path::debug): Likewise.
* diagnostic-manager.cc
(diagnostic_manager::prune_for_sm_diagnostic): Likewise.
(diagnostic_manager::prune_interproc_events): Likewise.
* program-state.cc (sm_state_map::to_json): Likewise.
* region.cc (region::to_json): Likewise.
* sm-malloc.cc (inform_nonnull_attribute): Likewise.
* store.cc (binding_map::to_json): Likewise.
(store::to_json): Likewise.
* svalue.cc (svalue::to_json): Likewise.

gcc/c-family/ChangeLog:
* c-format.cc (range_label_for_format_type_mismatch::get_text):
Update for removal of label_text::maybe_free in favor of automatic
memory management.

gcc/ChangeLog:
* diagnostic-format-json.cc (json_from_location_range): Update for
removal of label_text::maybe_free in favor of automatic memory
management.
* diagnostic-format-sarif.cc
(sarif_builder::make_location_object): Likewise.
* diagnostic-show-locus.cc (struct pod_label_text): New.
(class line_label): Convert m_text from label_text to pod_label_text.
(layout::print_any_labels): Move "text" to the line_label.
* tree-diagnostic-path.cc (path_label::get_text): Update for
removal of label_text::maybe_free in favor of automatic memory
management.
(event_range::print): Likewise.
(default_tree_diagnostic_path_printer): Likewise.
(default_tree_make_json_for_path): Likewise.

libcpp/ChangeLog:
* include/line-map.h: Include <utility>.
(class label_text): Delete maybe_free method in favor of a
destructor.  Add move ctor and assignment operator.  Add deletion
of the copy ctor and copy-assignment operator.  Rename field
m_caller_owned to m_owned.  Add std::move where necessary; add
moved_from member function.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agoanalyzer: fix false positives from -Wanalyzer-tainted-divisor [PR106225]
David Malcolm [Thu, 7 Jul 2022 19:50:26 +0000 (15:50 -0400)]
analyzer: fix false positives from -Wanalyzer-tainted-divisor [PR106225]

gcc/analyzer/ChangeLog:
PR analyzer/106225
* sm-taint.cc (taint_state_machine::on_stmt): Move handling of
assignments from division to...
(taint_state_machine::check_for_tainted_divisor): ...this new
function.  Reject warning when the divisor is known to be non-zero.
* sm.cc: Include "analyzer/program-state.h".
(sm_context::get_old_region_model): New.
* sm.h (sm_context::get_old_region_model): New decl.

gcc/testsuite/ChangeLog:
PR analyzer/106225
* gcc.dg/analyzer/taint-divisor-1.c: Add test coverage for various
correct and incorrect checks against zero.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agolibstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074]
Jonathan Wakely [Thu, 7 Jul 2022 12:40:20 +0000 (13:40 +0100)]
libstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074]

The front-end bug that prevented this constexpr loop from working has
been fixed since GCC 12.1 so we can remove the workaround.

libstdc++-v3/ChangeLog:

PR c++/89074
* include/bits/char_traits.h (__gnu_cxx::char_traits::move):
Remove workaround for front-end bug.

2 years agostatistics.cc: Add check to see if fn is not NULL in get_function_name.
Prathamesh Kulkarni [Thu, 7 Jul 2022 16:33:35 +0000 (22:03 +0530)]
statistics.cc: Add check to see if fn is not NULL in get_function_name.

gcc/ChangeLog:

* statistics.cc (get_function_name): Add check to see if fn is not NULL.

2 years agoc++: -Woverloaded-virtual and dtors [PR87729]
Jason Merrill [Thu, 7 Jul 2022 14:12:04 +0000 (10:12 -0400)]
c++: -Woverloaded-virtual and dtors [PR87729]

My earlier patch broke out of the loop over base members when we found a
match, but that caused trouble for dtors, which can have multiple for which
same_signature_p is true.  But as the function comment says, we know this
doesn't apply to [cd]tors, so skip them.

PR c++/87729

gcc/cp/ChangeLog:

* class.cc (warn_hidden): Ignore [cd]tors.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Woverloaded-virt3.C: New test.

2 years agolto-plugin: use locking only for selected targets
Martin Liska [Thu, 7 Jul 2022 10:15:28 +0000 (12:15 +0200)]
lto-plugin: use locking only for selected targets

For now, support locking only for linux targets that are different from
riscv* where the target depends on libatomic (and fails during
bootstrap).

PR lto/106170

lto-plugin/ChangeLog:

* configure.ac: Configure HAVE_PTHREAD_LOCKING.
* lto-plugin.c (LOCK_SECTION): New.
(UNLOCK_SECTION): New.
(claim_file_handler): Use the newly added macros.
(onload): Likewise.
* config.h.in: Regenerate.
* configure: Regenerate.

2 years agoSpeedup update-ssa some more
Richard Biener [Thu, 7 Jul 2022 10:59:47 +0000 (12:59 +0200)]
Speedup update-ssa some more

The following avoids copying an sbitmap and one traversal by avoiding
to re-allocate old_ssa_names when not necessary.  In addition this
actually checks what the comment before PHI insert iterating promises,
that the old_ssa_names set does not grow.

* tree-into-ssa.cc (iterating_old_ssa_names): New.
(add_new_name_mapping): Grow {new,old}_ssa_names separately
and only when actually needed.  Assert we are not growing
the old_ssa_names set when iterating over it.
(update_ssa): Remove old_ssa_names copying and empty_p
query, note we are iterating over it and expect no set changes.

2 years agoFix Intel MIC 'mkoffload' for OpenMP 'requires'
Thomas Schwinge [Tue, 5 Jul 2022 10:21:33 +0000 (12:21 +0200)]
Fix Intel MIC 'mkoffload' for OpenMP 'requires'

Similar to how the other 'mkoffload's got changed in
recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".

This also means finally switching Intel MIC 'mkoffload' to
'GOMP_offload_register_ver', 'GOMP_offload_unregister_ver',
making 'GOMP_offload_register', 'GOMP_offload_unregister'
legacy entry points.

gcc/
* config/i386/intelmic-mkoffload.cc (generate_host_descr_file)
(prepare_target_image, main): Handle OpenMP 'requires'.
(generate_host_descr_file): Switch to 'GOMP_offload_register_ver',
'GOMP_offload_unregister_ver'.
libgomp/
* target.c (GOMP_offload_register, GOMP_offload_unregister):
Denote as legacy entry points.
* testsuite/lib/libgomp.exp
(check_effective_target_offload_target_any): New proc.
* testsuite/libgomp.c-c++-common/requires-1.c: Enable for
'offload_target_any'.
* testsuite/libgomp.c-c++-common/requires-3.c: Likewise.
* testsuite/libgomp.c-c++-common/requires-7.c: Likewise.
* testsuite/libgomp.fortran/requires-1.f90: Likewise.

2 years agoEnhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c'...
Thomas Schwinge [Thu, 7 Jul 2022 07:45:42 +0000 (09:45 +0200)]
Enhance 'libgomp.c-c++-common/requires-4.c', 'libgomp.c-c++-common/requires-5.c' testing

These should compile and link and execute in all configurations; host-fallback
execution, which we may actually verify.

Follow-up to recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".

libgomp/
* testsuite/libgomp.c-c++-common/requires-4.c: Enhance testing.
* testsuite/libgomp.c-c++-common/requires-5.c: Likewise.

2 years agoAdjust 'libgomp.c-c++-common/requires-3.c'
Thomas Schwinge [Thu, 7 Jul 2022 07:59:45 +0000 (09:59 +0200)]
Adjust 'libgomp.c-c++-common/requires-3.c'

As documented, this one does "Check diagnostic by device-compiler's lto1".
Indeed there are none when compiling with '-foffload=disable' with an
offloading-enabled compiler, so we should use 'offload_target_[...]', as
used in other similar test cases.

Follow-up to recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".

libgomp/
* testsuite/libgomp.c-c++-common/requires-3.c: Adjust.

2 years agotarget/106219 - proprly mark builtins pure via ix86_add_new_builtins
Richard Biener [Thu, 7 Jul 2022 08:46:01 +0000 (10:46 +0200)]
target/106219 - proprly mark builtins pure via ix86_add_new_builtins

The target optimize pragma path to initialize extra target specific
builtins missed handling of the pure_p flag which in turn causes
extra clobber side-effects of gather builtins leading to unexpected
issues downhill.

PR target/106219
* config/i386/i386-builtins.cc (ix86_add_new_builtins): Properly
set DECL_PURE_P.

* g++.dg/pr106219.C: New testcase.

2 years agotestsuite: Fix incorrect -mfloat128-type option
Jonathan Wakely [Wed, 6 Jul 2022 18:11:05 +0000 (19:11 +0100)]
testsuite: Fix incorrect -mfloat128-type option

This test currently fails with an error about -mfloat128-type being an
invalid option, which is not what it's supposed to be testing:

XFAIL: gcc.target/powerpc/ppc-fortran/pr80108-1.f90   -O  (test for excess errors)
Excess errors:
xgcc: error: unrecognized command-line option '-mfloat128-type'; did you mean '-mfloat128'?

With this change we get the error that the comment says it expects:

XFAIL: gcc.target/powerpc/ppc-fortran/pr80108-1.f90   -O  (test for excess errors)
Excess errors:
f951: Error: power9 target option is incompatible with '-mcpu=<xxx>' for <xxx> less than power9
f951: Error: '-mfloat128' requires VSX support
f951: Error: '-m64' requires a PowerPC64 cpu

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/ppc-fortran/pr80108-1.f90: Change
-mfloat128-type to -mfloat128.

2 years agoSpeed up LC SSA rewrite more
Richard Biener [Thu, 7 Jul 2022 07:29:55 +0000 (09:29 +0200)]
Speed up LC SSA rewrite more

In many cases loops have only one exit or a variable is only live
across one of the exits.  In this case we know that all uses
outside of the loop will be dominated by the single LC PHI node
we insert.  If that holds for all variables requiring LC SSA PHIs
then we can simplify the update_ssa process, avoiding the
(iterated) dominance frontier computations.

* tree-ssa-loop-manip.cc (add_exit_phis_var): Return the
number of LC PHIs inserted.
(add_exit_phis): Return whether any variable required
multiple LC PHI nodes.
(rewrite_into_loop_closed_ssa_1): Use TODO_update_ssa_no_phi
when possible.