Commit Graph

193322 Commits

Author SHA1 Message Date
Javier Miranda
337c80a6bc [Ada] Ada2022: AI12-0143 Index attribute for entry families
gcc/ada/

	* snames.ads-tmpl (Name_Index): New attribute name.
	(Attribute_Id): Adding Attribute_Index as regular attribute.
	* sem_attr.adb (Attribute_22): Adding Attribute_Index as Ada
	2022 attribute.
	(Analyze_Index_Attribute): Check that 'Index appears in a
	pre-/postcondition aspect or pragma associated with an entry
	family.
	(Analyze_Attribute): Adding semantic analysis for 'Index.
	(Eval_Attribute): Register 'Index as can never be folded.
	(Resolve_Attribute): Resolve attribute 'Index.
	* sem_ch9.adb (Check_Wrong_Attribute_In_Postconditions): New
	subprogram.
	(Analyze_Requeue): Check that the requeue target shall not have
	an applicable specific or class-wide postcondition which
	includes an Index attribute reference.
	* exp_attr.adb (Expand_N_Attribute_Reference): Transform
	attribute Index into a renaming of the second formal of the
	wrapper built for an entry family that has contract cases.
	* einfo.ads (Is_Entry_Wrapper): Complete documentation.
2022-05-18 08:41:05 +00:00
Yannick Moy
3c63f73051 [Ada] Fix proof of runtime units
Update to latest version of Why3 caused some proof regressions.
Fix the proof by changing ghost code.

gcc/ada/

	* libgnat/s-imagei.adb (Set_Digits): Add assertion.
	* libgnat/s-imgboo.adb (Image_Boolean): Add assertions.
	* libgnat/s-valueu.adb (Scan_Raw_Unsigned): Add assertion.
2022-05-18 08:41:04 +00:00
Arnaud Charlet
5b0e8d6937 [Ada] Errors missed on ACATS test B650007
This ACATS test shows that we need to call Is_Immutably_Limited_Type
in Analyze_Function_Return and also that we have a latent bug in
Is_Immutably_Limited_Type which shouldn't look through private types.

gcc/ada/

	* sem_aux.adb (Is_Immutably_Limited_Type): Do not look through
	private types as per RM 7.5(8.1).
	* sem_ch6.adb (Analyze_Function_Return): Use
	Is_Immutably_Limited_Type as per RM 6.5(5.10).
2022-05-18 08:41:04 +00:00
Marc Poulhiès
9af8c27f09 [Ada] Fix the parsing for delta aggregate
In Ada 2022, delta aggregate must use parentheses not square brackets
except array delta aggregates.

gcc/ada/

	* gen_il-gen-gen_nodes.adb (Gen_IL.Gen.Gen_Nodes): Add
	Is_Homogeneous_Aggregate field for N_Delta_Aggregate nodes.
	* par-ch4.adb (P_Aggregate_Or_Paren_Expr): Minor reformatting.
	* sem_aggr.adb (Resolve_Delta_Aggregate): Reject square brackets
	for record aggregate.
	(Resolve_Record_Aggregate): Uniformise error message.
2022-05-18 08:41:04 +00:00
Arnaud Charlet
dea655ad57 [Ada] Secondary stack and a-tags
The simple use of Ada.Tags triggers a dependency on the secondary stack
mechanism, which is unwanted on small embedded targets. To avoid this
dependency, we special case a-tags.ali in ALI.Scan_ALI to not set
Sec_Stack_Used. If some other code calls one of the functions returning
a string, this code will also be marked as requiring the secondary
stack. We also remove the need to import and set __gnat_binder_ss_count
in this case by ensuring this variable defaults to 0.

gcc/ada/

	* ali.adb (Scan_ALI): Special case a-tags.ali when setting
	Sec_Stack_Used.
	* bindgen.adb (Gen_Adainit): Simplify handling of secondary
	stack related code, and only import __gnat_binder_ss_count when
	needed.
	* libgnat/s-secsta.adb (Binder_SS_Count): Default initialize to
	0.
2022-05-18 08:41:03 +00:00
Eric Botcazou
7c77ec1199 [Ada] Fix problematic underflow for Float_Type'Value
We need a couple of guards for boundary conditions in the support code.

gcc/ada/

	* libgnat/s-dourea.adb ("/"): Add guard for zero and infinite
	divisor.
	* libgnat/s-valuer.adb (Scan_Raw_Real): Add guard for very large
	exponent values.
2022-05-18 08:41:03 +00:00
Yannick Moy
ba89624e93 [Ada] Spurious error on freezing of tagged types in SPARK
SPARK RM 7.7(8) mandates that the freezing point of a tagged type must
occur within the so-called early call region of all its primitives.
This check may lead to spurious errors due to generated constructs being
considered in the search for the start of the early call region.

gcc/ada/

	* sem_elab.adb (Is_Suitable_Construct): Fix for generated
	constructs.
2022-05-18 08:41:03 +00:00
Marc Poulhiès
8e4f37024a [Ada] Rework optimization skipping pragma check in object declaration
When an object declaration is initialized with a type conversion:

 Var : Typ := Typ (Value);

we skip the check for Typ's predicate as it is already checked
during the type conversion.

This is not correct when Var's subtype and the target subtype of the
conversion do not statically match:

 Var : Typ := OtherTyp (Value);

In such case, we can't skip the check of Typ's predicate.

Fix minor typos in comment.

gcc/ada/

	* sem_ch3.adb (Analyze_Object_Declaration): Skip predicate check
	for type conversion if object's subtype and expression's subtype
	statically match.
	* exp_prag.adb (Expand_Pragma_Check): Typo fix in comment.
2022-05-18 08:41:03 +00:00
Eric Botcazou
de02cb5d72 [Ada] Fix internal error on subprogram instantiation
The compiler builds renamings for actuals of formal objects for debugging
purposes in this case, but it must not generate them for temporaries.

gcc/ada/

	* exp_dbug.ads (Build_Subprogram_Instance_Renamings): Fix typo.
	* exp_dbug.adb (Build_Subprogram_Instance_Renamings): Build the
	renaming only for actuals of formal objects.
2022-05-18 08:41:01 +00:00
Gary Dismukes
df61c5dc3a [Ada] Overriding error on type derived from discriminated untagged private type
When a derived type DT has an untagged private parent type PT with a
discriminant, where the full type of PT is tagged, and DT inherits a
function F with an anonymous access result that designates the type, the
compiler wrongly reports an error saying that DT must be declared
abstract or F overridden. A test is added to exclude checking the
abstract overriding rules that should only apply to inherited
subprograms of tagged derived types.

gcc/ada/

	* sem_ch3.adb (Check_Abstract_Overriding): If the type is
	derived from an untagged type, then don't perform any of the
	abstract overriding error checks.
2022-05-18 08:41:01 +00:00
Piotr Trojanek
16b8ba101f [Ada] Prevent overflow in computation of aggregate size
When computing size of a static aggregate to decide if it should be
transformed into assignments and loops we could have an overflow check.
This is mostly harmless, because colossal aggregates will likely crash
the application anyway, no matter how we transform them.

This was not detected because compiler was built with -gnatg switch that
suppresses overflow checks (they are only enabled by an explicit -gnato
switch).

gcc/ada/

	* exp_aggr.adb (Component_Count): Calculate size as an Uint and
	only then check if it is in the range of Int, as otherwise the
	multiplication of Int values can overflow.
2022-05-18 08:41:01 +00:00
Eric Botcazou
8b49556e4e [Ada] Fast implementation of floating-point mathematical functions
This adds a package renaming unit to the GNAT hierarchy so as to expose
the underlying implementation of floating-point mathematical functions,
thus also making it possible to use their vector implementation, if any.

The change also contains a small improvement to the Hide_Public_Entities
mechanism in Sem_Ch7 that makes it possible to clear the Is_Public flag
within instances of generic packages that do not have a body.

gcc/ada/

	* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-gfmafu$(objext).
	(SIMD_PATH_TARGET_PAIRS): New variable.
	(TRASYM_DWARF_COMMON_OBJS): Minor tweak.
	(x86-64/Linux): Use SIMD_PATH_TARGET_PAIRS.
	(x32/Linux): Likewise.
	* doc/gnat_rm/the_gnat_library.rst (Generic_Fast_Math_Functions):
	New entry.
	* gnat_rm.texi: Regenerate.
	* impunit.adb (Non_Imp_File_Names_95): Add g-gfmafu.
	* sem_ch7.adb (Has_Referencer): Do not set In_Nested_Instance for
	instances of generic packages that do not have a body.
	* libgnat/a-nalofl__simd.ads: New SIMD-enabled version.
	* libgnat/a-nuaufl__simd.ads: Likewise.
	* libgnat/g-gfmafu.ads: New package renaming unit.
2022-05-18 08:41:00 +00:00
Arnaud Charlet
54cf6609e0 [Ada] Freezing too strict in instances
Should_Freeze_Type is relaxed to only take the relevant case into
account (entities denoted by generic actual parameters as per
13.14(5/3), as well as profile of any subprograms named as per
13.14(10.2/4)), instead of being overly conservative wrt instances and
as a result, wrongly rejecting some legal code.

In practice this means we only need to worry about profile of
subprograms named as part of instances.

gcc/ada/

	* freeze.adb (Should_Freeze_Type): Fix handling of freezing in
	instances.
2022-05-18 08:40:59 +00:00
Marc Poulhiès
5488c78c83 [Ada] Fix incorrect freezing with generic child unit
The Analyze_Associations.Check_Generic_Parent function was using an
incorrect node as the instanciation node for the actual, possibly
leading to incorrect freeze node being created (and later crashing in
gigi). Using Get_Unit_Instantiation_Node fixes the issue.

gcc/ada/

	* sem_ch12.adb (Check_Generic_Parent): Use
	Get_Unit_Instantiation_Node instead of Next.
2022-05-18 08:40:59 +00:00
Alexandre Oliva
bf7143f736 [Ada] Ada.Numerics.Aux.*: Mention more Intrinsic and less C Math Library
Since we import the elemental math functions as intrinsics, it's not
accurate to state we're drawing them in from the C math library.

gcc/ada/

	* libgnat/a-nagefl.ads: Replace mentions of C/unix math library
	with intrinsics.
	* libgnat/a-nallfl.ads: Likewise.  State compatibility
	requirements.
	* libgnat/a-nalofl.ads: Likewise.
	* libgnat/a-nuaufl.ads: Likewise.
2022-05-18 08:40:59 +00:00
Eric Botcazou
700cd7d673 [Ada] Small performance tweak in recent change
This avoids a useless walk of the prefix chain in instances.

gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Move final test on
	In_Instance to outer condition.
2022-05-18 08:40:58 +00:00
Doug Rupp
1ef3f0911c [Ada] New port arm-qnx
The QNX system specs for ARM and AARCH64 are identical. It makes more
sense to have it named for the base architecture.

gcc/ada/

	* Makefile.rtl: Rename system-qnx-aarch64.ads to
	system-qnx-arm.ads.
	(AARCH64 QNX section): Modify to handle both arm and arch64.
	* tracebak.c (__QNX__): Add new __ARMEL__ section.
	* sigtramp-arm-qnx.c: New file.
	* libgnat/system-qnx-aarch64.ads: Renamed to ...
	* libgnat/system-qnx-arm.ads: this.
2022-05-18 08:40:58 +00:00
liuhongt
9d1336d977 Enhance final_value_replacement_loop to handle bitwise induction.
This patch will enable below optimization:

 {
-  int bit;
-  long long unsigned int _1;
-  long long unsigned int _2;
-
   <bb 2> [local count: 46707768]:
-
-  <bb 3> [local count: 1027034057]:
-  # tmp_11 = PHI <tmp_8(3), tmp_6(D)(2)>
-  # bit_13 = PHI <bit_9(3), 63(2)>
-  _1 = 1 << bit_13;
-  _2 = ~_1;
-  tmp_8 = _2 & tmp_11;
-  bit_9 = bit_13 + -3;
-  if (bit_9 != -3(OVF))
-    goto <bb 3>; [95.65%]
-  else
-    goto <bb 4>; [4.35%]
-
-  <bb 4> [local count: 46707768]:
-  return tmp_8;
+  tmp_12 = tmp_6(D) & 7905747460161236406;
+  return tmp_12;

 }

gcc/ChangeLog:

	PR middle-end/103462
	* match.pd (bitwise_induction_p): New match.
	* tree-scalar-evolution.cc (gimple_bitwise_induction_p):
	Declare.
	(analyze_and_compute_bitwise_induction_effect): New function.
	(enum bit_op_kind): New enum.
	(final_value_replacement_loop): Enhanced to handle bitwise
	induction.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr103462-1.c: New test.
	* gcc.target/i386/pr103462-2.c: New test.
	* gcc.target/i386/pr103462-3.c: New test.
	* gcc.target/i386/pr103462-4.c: New test.
	* gcc.target/i386/pr103462-5.c: New test.
	* gcc.target/i386/pr103462-6.c: New test.
2022-05-18 15:46:21 +08:00
Haochen Gui
a174dc1a7f This patch adds a combine pattern for "CA minus one". The SImode "CA minus one" can be converted to DImode as CA only has two values (0 or 1).
gcc/
	PR target/95737
	* config/rs6000/rs6000.md (*subfsi3_carry_in_xx_64): New.

gcc/testsuite/
	PR target/95737
	* gcc.target/powerpc/pr95737.c: New.
2022-05-18 13:21:29 +08:00
liuhongt
102237c9f2 recognize bzhi pattern when there's zero_extendsidi.
backend has

16550(define_insn "*bmi2_bzhi_<mode>3_2"
16551  [(set (match_operand:SWI48 0 "register_operand" "=r")
16552        (and:SWI48
16553          (plus:SWI48
16554            (ashift:SWI48 (const_int 1)
16555                          (match_operand:QI 2 "register_operand" "r"))
16556            (const_int -1))
16557          (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
16558   (clobber (reg:CC FLAGS_REG))]
16559  "TARGET_BMI2"
16560  "bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}"
16561  [(set_attr "type" "bitmanip")
16562   (set_attr "prefix" "vex")
16563   (set_attr "mode" "<MODE>")])

But there's extra zero_extend in pattern match.

424Failed to match this instruction:
425(parallel [
426        (set (reg:DI 90)
427            (zero_extend:DI (and:SI (plus:SI (ashift:SI (const_int 1 [0x1])
428                            (subreg:QI (reg:SI 98) 0))
429                        (const_int -1 [0xffffffffffffffff]))
430                    (subreg:SI (reg:DI 95) 0))))
431        (clobber (reg:CC 17 flags))
432    ])

Add new define_insn for it.

gcc/ChangeLog:

	PR target/104375
	* config/i386/i386.md (*bmi2_bzhi_zero_extendsidi_4): New
	define_insn.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr104375.c: New test.
2022-05-18 10:56:35 +08:00
liuhongt
850a13d754 Expand __builtin_memcmp_eq with ptest for OImode.
gcc/ChangeLog:

	PR target/104610
	* config/i386/i386-expand.cc (ix86_expand_branch): Use ptest
	for QImode when code is EQ or NE.
	* config/i386/i386.md (cbranchoi4): New expander.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr104610.c: New test.
2022-05-18 10:47:28 +08:00
Peter Bergner
c6e36f05fb rs6000: Prefer assigning the MMA vector operands to altivec registers [PR105556]
When optimizing the DGEMM kernel in OpenBLAS to use MMA, the MMA code
uses all 8 accumulators, which overlap all vs0-vs31 vector registers.
Current trunk assigns one of the normal vector inputs to one of the MMA
instructions, which forces us to spill one of the accumulators to memory,
leading to poor performance.  The solution here is to replace the "wa"
constraints for the vector input operands in the MMA instruction patterns
with "v,?wa" so that we prefer using the altivec registers vs32-vs63
over the vs0-vs31 registers.

2022-05-17  Peter Bergner  <bergner@linux.ibm.com>
	    Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
	PR target/105556
	* config/rs6000/mma.md (mma_<vv>, mma_<avv>, mma_<pv>, mma_<apv>,
	mma_<vvi4i4i8>, mma_<avvi4i4i8>, mma_<vvi4i4i2>, mma_<avvi4i4i2>,
	mma_<vvi4i4>, mma_<avvi4i4>, mma_<pvi4i2>, mma_<apvi4i2>,
	mma_<vvi4i4i4>, mma_<avvi4i4i4>): Replace "wa" constraints with "v,?wa".
	Update other operands accordingly.
2022-05-17 21:10:27 -05:00
GCC Administrator
3d9439b1bb Daily bump. 2022-05-18 00:16:36 +00:00
Ian Lance Taylor
1bfb823e2a compiler: load LHS subexpressions of op= assignment only once
Fixes golang/go#52811

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405617
2022-05-17 15:48:43 -07:00
Jason Merrill
2b0c837772 c++: constexpr ref to array of array [PR102307]
The problem here is that first check_initializer calls
build_aggr_init_full_exprs, which does overload resolution, but then in the
case of failed constexpr throws away the result and does it again in
build_functional_cast.  But in the first overload resolution,
reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
tf_error is set, so we know we're committed.  But the second pass gets
confused by the CONSTRUCTORs with non-init-list types.

Fixed by avoiding a second pass: instead, pass the call from build_aggr_init
to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
to change the object argument because it will be replaced later in
simplify_aggr_init_expr.

	PR c++/102307

gcc/cp/ChangeLog:

	* decl.cc (check_initializer): Use build_cplus_new in case of
	constexpr failure.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/constexpr-array2.C: New test.
2022-05-17 18:09:24 -04:00
Marek Polacek
2c05a2d1a8 c: use CONST_DECL for enumerators in TYPE_VALUES
The C and C++ FEs differ in TYPE_VALUES for an enum type: an entry in
the list in the C++ FE has a CONST_DECL in the TREE_VALUE, but the C FE
has only the numerical value of the CONST_DECL there.  This has caused
me some trouble in my PR105497 patch.  Using a CONST_DECL is preferable
because a CONST_DECL can track more information (e.g., attributes), and
you can always get the value simply by looking at its DECL_INITIAL.

This turned out to be a trivial change.  One place in godump.cc had to be
adjusted.  I'm not changing the CONST_DECL check in c_do_switch_warnings
because I'll be changing it soon in my next patch.  I didn't see any other
checks that this patch makes redundant.

gcc/c/ChangeLog:

	* c-decl.cc (finish_enum): Store the CONST_DECL into TREE_VALUE, not
	its value.

gcc/ChangeLog:

	* godump.cc (go_output_typedef): Use the DECL_INITIAL of the TREE_VALUE.
2022-05-17 18:03:54 -04:00
Pat Haugen
2ee68beee7 Fix register count when not splitting Complex IEEE 128-bit args.
For ABI_V4, we do not split complex args. This created a problem because
even though an arg would be passed in two VSX regs, we were only advancing the
function arg counter by one VSX register. Fixed with this patch.

	PR target/99685

gcc/
	* config/rs6000/rs6000-call.cc (rs6000_function_arg_advance_1): Bump
	register count when not splitting IEEE 128-bit Complex.
2022-05-17 15:53:24 -05:00
Tobias Burnus
47554478a1 OpenMP: Skip target-nesting warning for reverse offload
gcc/ChangeLog:

	* omp-low.cc (check_omp_nesting_restrictions): Skip warning for
	target inside target if inner is reverse offload.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/target-device-ancestor-5.c: New test.
2022-05-17 22:09:16 +02:00
Jonathan Wakely
ddb1427def libstdc++: Relax memory ordering for default memory resource object
Currently pmr::set_default_resource and pmr::get_default_resource both
use sequentially consistent memory ordering. This is overkill. The
standard only requires that a call to set_default_resource synchronizes
with subsequent calls to set_default_resource and get_default_resource.

Using acquire-release for the setter and acquire for the getter is
sufficient to meet the requirement.

Reviewed-by: Thomas Rodgers  <trodgers@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++17/memory_resource.cc (set_default_resource): Use
	memory_order_acq_rel.
	(get_default_resource): Use memory_order_acquire.
2022-05-17 20:53:40 +01:00
Jonathan Wakely
5c2d703e6d libstdc++: Add attributes to functions in <memory_resource>
Add attributes to the accessors for the global memory resource objects,
to allow the compiler to eliminate redundant calls to them. For example,
multiple calls to std::pmr::new_delete_resource() will always return the
same object, and so the compiler can replace them with a single call.

Ideally we would like adjacent calls to std::pmr::get_default_resource()
to be combined into a single call by the CSE pass. The 'pure' attribute
would permit that. However, the standard requires that calls to
std::pmr::set_default_resource() synchronize with subsequent calls to
std::pmr::get_default_resource().  With 'pure' the DCE pass might
eliminate seemingly redundant calls to std::pmr::get_default_resource().
That might be unsafe, because the caller might be relying on the
associated synchronization. We could use a hypothetical attribute that
allows CSE but not DCE, but we don't have one. So it can't be 'pure'.

Also add [[nodiscard]] to equality operators.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (new_delete_resource): Add
	nodiscard, returns_nonnull and const attributes.
	(null_memory_resource): Likewise.
	(set_default_resource, get_default_resource): Add returns_nonnull
	attribute.
	(memory_resource::is_equal): Add nodiscard attribute.
	(operator==, operator!=): Likewise.
2022-05-17 20:51:04 +01:00
Jonathan Wakely
5f1ce85135 libstdc++: Add attributes to <system_error> and related
Add the const attribute to std::future_category() and
std::iostream_category(), to match the existing attributes on
std::generic_category() and std::system_category().

Also add [[nodiscard]] to those functions and to the comparison
operators for std::error_code and std::error_condition, and to
std::make_error_code and std::make_error_condition overloads.

libstdc++-v3/ChangeLog:

	* include/bits/ios_base.h (io_category): Add const and nodiscard
	attributes.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/future (future_category): Add const and nodiscard.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/system_error (generic_category system_category):
	Add nodiscard. Replace _GLIBCXX_CONST with C++11 attribute.
	(error_code::value, error_code::category, error_code::operator bool)
	(error_condition::value, error_condition::category)
	(error_condition::operator bool, make_error_code)
	(make_error_condition, operator==, operator!=, operator<=>): Add
	nodiscard.
2022-05-17 20:50:31 +01:00
Tobias Burnus
c9852156dd Revert 'Use more ARRAY_SIZE.' for mkoffload
Revert commit r13-472-gca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d partially;
namely for {gcn,nvptx}/mkoffload.cc, only.

The patch changed 'sizeof(...)/sizeof(...[0])' to the 'ARRAY_SIZE' macro,
which is in principle a good idea – except that in the two mkoffload.cc,
the change happened inside a string that is used to generate plain C code.

With offlading to nvptx or gcn, the mkoffload genenates then the C file
and compilation of the latter fails with
"warning: implicit declaration of function 'ARRAY_SIZE'" followed by
"error: initializer element is not constant"

gcc/
	* config/gcn/mkoffload.cc (process_obj): Revert: Use ARRAY_SIZE.
	* config/nvptx/mkoffload.cc (process): Likewise.
2022-05-17 20:54:32 +02:00
Andrew MacLeod
b7501739f3 Add side effect infrastructure.
Replace the non-null procesing with a generic side effect implementation that
can handle arbitrary side effects.

	* Makefile.in (OBJS): Add gimple-range-side-effect.o.
	* gimple-range-cache.cc (non_null_ref::non_null_ref): Delete.
	(non_null_ref::~non_null_ref): Delete.
	(non_null_ref::set_nonnull): Delete.
	(non_null_ref::non_null_deref_p): Delete.
	(non_null_ref::process_name): Delete.
	(ranger_cache::ranger_cache): Initialize m_exit object.
	(ranger_cache::fill_block_cache): Use m_exit object intead of nonnull.
	(ranger_cache::range_from_dom): Use side_effect class and m_exit object.
	(ranger_cache::update_to_nonnull): Delete.
	(non_null_loadstore): Delete.
	(ranger_cache::block_apply_nonnull): Delete.
	(ranger_cache::apply_side_effects): New.
	* gimple-range-cache.h (class non_null_ref): Delete.
	(non_null_ref::adjust_range): Delete.
	(class ranger_cache): Adjust prototypes, add side effect manager.
	* gimple-range-path.cc (path_range_query::range_defined_in_block): Use
	side effect manager for queries.
	(path_range_query::adjust_for_non_null_uses): Ditto.
	* gimple-range-path.h (class path_range_query): Delete non_null_ref.
	* gimple-range-side-effect.cc: New.
	* gimple-range-side-effect.h: New.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Update contructor.
	(gimple_ranger::range_of_expr): Check def block for override value.
	(gimple_ranger::range_on_entry): Don't scan dominators for non-null.
	(gimple_ranger::range_on_edge): Check for outgoing side-effects.
	(gimple_ranger::register_side_effects): Call apply_side_effects.
	(enable_ranger): Update contructor.
	* gimple-range.h (class gimple_ranger): Update prototype.
	(enable_ranger): Update prototype.
	* tree-vrp.cc (execute_ranger_vrp): Invoke without immediate-use flag.
2022-05-17 14:38:03 -04:00
Nathan Sidwell
451894cadc demangler: Structured Bindings
C++ Structured bindings have a mangling that has yet to be formally
documented.  However, it's been around for a while and shows up for
module support.

	include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_STRUCTURED_BINDING.
	libiberty/
	* cp-demangle.c (d_make_comp): Adjust.
	(d_unqualified_name): Add 'DC' support.
	(d_count_template_scopes): Adjust.
	(d_print_comp_inner): Add structured binding.
	* testsuite/demangle-expected: Add testcases.
2022-05-17 11:10:03 -07:00
Giuliano Belinassi
7a3f38a966 PR105169 Fix references to discarded sections
When -fpatchable-function-entry= is enabled, certain C++ codes fails to
link because of generated references to discarded sections in
__patchable_function_entry section. This commit fixes this problem by
puting those references in a COMDAT section.

2022-05-06  Giuliano Belinassi  <gbelinassi@suse.de>

gcc/ChangeLog
	PR c++/105169
	* targhooks.cc (default_print_patchable_function_entry_1): Handle COMDAT case.
	* varasm.cc (switch_to_comdat_section): New
	(handle_vtv_comdat_section): Call switch_to_comdat_section.
	* varasm.h: Declare switch_to_comdat_section.

gcc/testsuite/ChangeLog
2022-05-06  Giuliano Belinassi  <gbelinassi@suse.de>

	PR c++/105169
	* g++.dg/modules/pr105169.h: New file.
	* g++.dg/modules/pr105169_a.C: New test.
	* g++.dg/modules/pr105169_b.C: New file.
2022-05-17 14:34:21 -03:00
Richard Biener
941efd87e2 Do not clear bb->aux in duplicate_loop_body_to_header_edge
duplicate_loop_body_to_header_edge clears bb->aux which is not wanted
by a new use in loop unswitching.  The clearing was introduced with
r0-69110-g6580ee7781f903 and it seems accidentially so.

2022-05-17  Richard Biener  <rguenther@suse.de>

	* cfgloopmanip.cc (duplicate_loop_body_to_header_edge): Do
	not clear bb->aux of the copied blocks.
2022-05-17 17:53:46 +02:00
Andrew MacLeod
6101a276c3 Check for equivalence after merging relations.
When registering a relation, we need to merge with any existing relation
before checking if it was an equivalence... otherwise it was not being
handled properly.

	gcc/
	PR tree-optimization/105458
	* value-relation.cc (path_oracle::register_relation): Merge, then check
	for equivalence.

	gcc/testsuite/
	* gcc.dg/pr105458.c: New.
2022-05-17 11:43:32 -04:00
Uros Bizjak
61a6923e89 i386: Fix ICE in final_scan_insn_1 [PR105624]
Apparently const_int_operand and other const*_operand predicates
do need constraints.  Revert the offending patch that caused ICE.

2022-05-17  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/105624
	Revert:

	* config/i386/i386.md: Remove constraints when used with
	const_int_operand, const0_operand, const_1_operand, constm1_operand,
	const8_operand, const128_operand, const248_operand, const123_operand,
	const2367_operand, const1248_operand, const359_operand,
	const_4_or_8_to_11_operand, const48_operand, const_0_to_1_operand,
	const_0_to_3_operand, const_0_to_4_operand, const_0_to_5_operand,
	const_0_to_7_operand, const_0_to_15_operand, const_0_to_31_operand,
	const_0_to_63_operand, const_0_to_127_operand, const_0_to_255_operand,
	const_0_to_255_mul_8_operand, const_1_to_31_operand,
	const_1_to_63_operand, const_2_to_3_operand, const_4_to_5_operand,
	const_4_to_7_operand, const_6_to_7_operand, const_8_to_9_operand,
	const_8_to_11_operand, const_8_to_15_operand, const_10_to_11_operand,
	const_12_to_13_operand, const_12_to_15_operand, const_14_to_15_operand,
	const_16_to_19_operand, const_16_to_31_operand, const_20_to_23_operand,
	const_24_to_27_operand and const_28_to_31_operand.
	* config/i386/mmx.md: Ditto.
	* config/i386/sse.md: Ditto.
	* config/i386/subst.md: Ditto.
	* config/i386/sync.md: Ditto.

gcc/testsuite/ChangeLog:

	PR target/105624
	* gcc.target/i386/pr105624.c: New test.
2022-05-17 17:37:59 +02:00
Jakub Jelinek
741478ed3e libgomp: Clarify that omp_display_env is fully implemented
OpenMP 5.2 added
"When called from within a target region the effect is unspecified."
restriction to omp_display_env, so it is ok not to support it in
target regions (worst case we could add an empty implementation
or one with __builtin_trap in there).

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi (OpenMP 5.1): Remove "Not inside target regions"
	comment for omp_display_env feature.
2022-05-17 16:58:26 +02:00
Thomas Schwinge
cd4a0ddc12 Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'
gcc/
	* diagnostic.cc: Don't advise to call 'abort' instead of
	'internal_error'.
	* system.h: Advise to call 'internal_error' instead of 'abort' or
	'fancy_abort'.

Suggested-by: Richard Biener <richard.guenther@gmail.com>
2022-05-17 16:27:32 +02:00
Frederik Harwath
0f00ebf0d6 graphite: Fix minor mistakes in comments
gcc/ChangeLog:

	* graphite-sese-to-poly.cc (build_poly_sr_1): Fix a typo and
	a reference to a variable which does not exist.
	* graphite-isl-ast-to-gimple.cc (gsi_insert_earliest): Fix typo
	in comment.
2022-05-17 16:02:01 +02:00
Frederik Harwath
0cca1c22b0 graphite: Rename isl_id_for_ssa_name
The SSA names for which this function gets used are always SCoP
parameters and hence "isl_id_for_parameter" is a better name.  It also
explains the prefix "P_" for those names in the ISL representation.

gcc/ChangeLog:

	* graphite-sese-to-poly.cc (isl_id_for_ssa_name): Rename to ...
	(isl_id_for_parameter): ... this new function name.
	(build_scop_context): Adjust function use.
2022-05-17 16:00:57 +02:00
Tobias Burnus
61fe7b7d46 libgomp.texi: Document OpenMP context selectors
libgomp/
	* libgomp.texi (Offload-Target Specifics): New chapter; add section
	to document OpenMP context selectors.
2022-05-17 15:54:24 +02:00
Tobias Burnus
ebe5dace8c gcn/t-omp-device: Add 'amdgcn' as 'arch' [PR105602]
Improve cross-compiler handling.

gcc/ChangeLog:

	PR target/105602
	* config/gcn/t-omp-device (arch): Add 'amdgcn' besides existing 'gcn'.
	* config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa): Likewise.
2022-05-17 15:54:23 +02:00
Jakub Jelinek
2c16eb3157 openmp: Add support for inoutset depend-kind
This patch adds support for inoutset depend-kind in depend
clauses.  It is very similar to the in depend-kind in that
a task with a dependency with that depend-kind is dependent
on all previously created sibling tasks with matching address
unless they have the same depend-kind.
In the in depend-kind case everything is dependent except
for in -> in dependency, for inoutset everything is
dependent except for inoutset -> inoutset dependency.
mutexinoutset is also similar (everything is dependent except
for mutexinoutset -> mutexinoutset dependency), but there is
also the additional restriction that only one task with
mutexinoutset for each address can be scheduled at once (i.e.
mutual exclusitivty).  For now we support mutexinoutset
the same as inout/out, but the inoutset support is full.

In order not to bump the ABI for dependencies each time
(we've bumped it already once, the old ABI supports only
inout/out and in depend-kind, the new ABI supports
inout/out, mutexinoutset, in and depobj), this patch arranges
for inoutset to be at least for the time being always handled
as if it was specified through depobj even when it is not.
So it uses the new ABI for that and inoutset are represented
like depobj - pointer to a pair of pointers where the first one
will be the actual address of the object mentioned in depend
clause and second pointer will be (void *) GOMP_DEPEND_INOUTSET.

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree-core.h (enum omp_clause_depend_kind): Add
	OMP_CLAUSE_DEPEND_INOUTSET.
	* tree-pretty-print.cc (dump_omp_clause): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
	* gimplify.cc (gimplify_omp_depend): Likewise.
	* omp-low.cc (lower_depend_clauses): Likewise.
gcc/c-family/
	* c-omp.cc (c_finish_omp_depobj): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/c/
	* c-parser.cc (c_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(c_parser_omp_depobj): Likewise.
gcc/cp/
	* parser.cc (cp_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(cp_parser_omp_depobj): Likewise.
	* cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/testsuite/
	* c-c++-common/gomp/all-memory-1.c (boo): Add test with
	inoutset depend-kind.
	* c-c++-common/gomp/all-memory-2.c (boo): Likewise.
	* c-c++-common/gomp/depobj-1.c (f1): Likewise.
	(f2): Adjusted expected diagnostics.
	* g++.dg/gomp/depobj-1.C (f4): Adjust expected diagnostics.
include/
	* gomp-constants.h (GOMP_DEPEND_INOUTSET): Define.
libgomp/
	* libgomp.h (struct gomp_task_depend_entry): Change is_in type
	from bool to unsigned char.
	* task.c (gomp_task_handle_depend): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where
	task->depend[i].is_in && task->depend[i].is_in == ent->is_in
	rather than just task->depend[i].is_in && ent->is_in.  Remember
	whether GOMP_DEPEND_IN loop is needed and guard the loop with that
	conditional.
	(gomp_task_maybe_wait_for_dependencies): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where elem.is_in && elem.is_in == ent->is_in
	rather than just elem.is_in && ent->is_in.
	* testsuite/libgomp.c-c++-common/depend-1.c (test): Add task with
	inoutset depend-kind.
	* testsuite/libgomp.c-c++-common/depend-2.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-3.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-inoutset-1.c: New test.
2022-05-17 15:40:27 +02:00
Jonathan Wakely
1815462a6e libstdc++: Skip tests that fail for the versioned namespace
Most tests for the contents of header synopses need to be supressed for
the versioned namespace build, because redeclaring the entities in std
fails when they were originally declared in std::__8.

I added these tests recently without the suppression, so they fail.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/expected/synopsis.cc: Skip for versioned
	namespace.
	* testsuite/27_io/headers/iosfwd/synopsis.cc: Likewise.
2022-05-17 11:42:34 +01:00
Jonathan Wakely
357d6fcd41 libstdc++: Stop defining C++0x compat symbols for versioned namespace
The src/c++11/compatibility*-c++0x.cc files define symbols that need to
be exported for ancient versions of libstdc++.so.6 due to changes
between C++0x and the final C++11 standard. Those symbols are not needed
in the libstdc++.so.8 library, and we can skip building them entirely.

This also fixes the build failure I introduced last week when making the
versioned namespace config not use the _V2 namespace for compat symbols.

libstdc++-v3/ChangeLog:

	* src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources):
	Do not build the compatibility*-c++0x.cc objects.
	* src/Makefile.in: Regenerate.
	* src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]:
	Refuse to build for the versioned namespace.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/compatibility-condvar.cc: Likewise.
	* src/c++11/compatibility-thread-c++0x.cc: Likewise.
	* src/c++11/chrono.cc (system_clock, steady_clock):
	Use macros to define in inline namespace _V2, matching the
	declarations in <system_error>.
	* src/c++11/system_error.cc (system_category, generic_category):
	Likewise.
2022-05-17 11:42:34 +01:00
Tobias Burnus
472aecb789 libgomp.texi: Add OpenMP 5.2 implementation status
libgomp/
	* libgomp.texi (OpenMP Implementation Status): Add 5.2 table.
2022-05-17 12:31:35 +02:00
Jakub Jelinek
254cbf7266 i386: Fix up V2DI and V1TI inequality comparisons [PR105613]
The recent r13-458 change to introduce vec_cmpeqv1tiv1ti and
add TARGET_SSE2 support to vec_cmpeqv2div2di works nicely for
equality comparisons, but as the testcase shows doesn't work
for inequality comparisons.
For EQ if we perform comparison with twice as many half-sized elemenets,
the result should be ~0 when both halves are ~0 only (both halves need
to be equal for the whole to be equal), otherwise 0, so AND is the
correct operation for it.
But for NE, the result should be ~0 when either of the halves is ~0
(if either half is not equal, the whole is not equal) and so the right
operation for NE is IOR, not AND.

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

	PR target/105613
	* config/i386/sse.md (vec_cmpeqv2div2di, vec_cmpeqv1tiv1ti): Use
	andv4si3 only for EQ, for NE use iorv4si3 instead.

	* gcc.c-torture/execute/pr105613.c: New test.
2022-05-17 12:10:30 +02:00
Tobias Burnus
4f94c38a92 OpenMP: Add omp_all_memory support to Fortran
Fortran part to the C/C++/backend implementation
r13-337-g7f78783dbedca0183d193e475262ca3c489fd365

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist): Handle omp_all_memory.
	* openmp.cc (gfc_match_omp_variable_list, gfc_match_omp_depend_sink,
	gfc_match_omp_clauses, resolve_omp_clauses): Likewise.
	* trans-openmp.cc (gfc_trans_omp_clauses, gfc_trans_omp_depobj):
	Likewise.
	* resolve.cc (resolve_symbol): Reject it as symbol.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1): Set omp_all_memory to 'Y'.
	* testsuite/libgomp.fortran/depend-5.f90: New test.
	* testsuite/libgomp.fortran/depend-6.f90: New test.
	* testsuite/libgomp.fortran/depend-7.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/all-memory-1.f90: New test.
	* gfortran.dg/gomp/all-memory-2.f90: New test.
	* gfortran.dg/gomp/all-memory-3.f90: New test.
2022-05-17 11:01:04 +02:00