Commit Graph

186672 Commits

Author SHA1 Message Date
Gary Dismukes 06a5fb60eb [Ada] Removal of various ??? comments plus related code changes
gcc/ada/

	* checks.adb: Remove calls of Set_Do_Tag_Check (N, False).
	* einfo.ads: Remove hanging unneeded ??? comment ("this real description
	was clobbered").
	* exp_util.ads (Insert_Actions_After): Remove ??? from spec comment.
	* gen_il-fields.ads (Opt_Field_Enum): Remove literals
	Do_Accessibility_Check and Do_Tag_Check.
	* gen_il-gen-gen_nodes.adb: Remove all calls to Sm for
	Do_Accessibility_Check and Do_Tag_Check.
	* sem_type.ads (Is_Subtype_Of): Remove obsolete ???
	comment (function is not limited to scalar subtypes).
	* sem_util.ads (Is_Local_Variable_Reference): Revise comment to
	mention out-mode parameters as well, and remove ???.
	(Propagate_Concurrent_Flags): Minor reformatting.
	(Propagate_Invariant_Attributes): Typo fix.
	(Propagate_Predicate_Attributes): Indicate what is propagated
	and remove ??? comment.
	* sem_util.adb (Cannot_Raise_Constraint_Error): Remove unneeded
	test of Do_Tag_Check.
	(Is_Local_Variable_Reference): Extend function to testing for
	formals of mode out as well.
	* sinfo.ads: Remove ??? comment about flag
	Convert_To_Return_False indicating that the flag is obsolete (in
	fact it's used). Remove references to Do_Accessibility_Check and
	Do_Tag_Check (and the two associated ??? comments), as these
	flags are unneeded.
	* sinfo-cn.adb (Change_Conversion_To_Unchecked): Remove call of
	Set_Do_Tag_Check (N, False).
	* targparm.ads (Support_Atomic_Primitives_On_Target): Remove ???
	comment, plus minor reformatting.
2021-07-06 14:46:54 +00:00
Justin Squirek c7959e489d [Ada] Return when not working for procedures
gcc/ada/

	* par-ch6.adb (Get_Return_Kind): Properly handle the case of a
	"return when" statement in the procedure case.
2021-07-06 14:46:54 +00:00
Bob Duff f037632e65 [Ada] Transient scope cleanup
gcc/ada/

	* sem.ads (Node_To_Be_Wrapped): Minor comment fix.
	* exp_ch7.adb (Establish_Transient_Scope): Misc cleanups and
	comment improvements.
	(Set_Node_To_Be_Wrapped): Remove -- not worth putting this code
	in a separate procedure, called only once.
	* sem_util.adb (Requires_Transient_Scope): Assert that our
	parameter has the right Kind. It probably shouldn't be E_Void,
	but that is passed in in some cases.
	(Ensure_Minimum_Decoration): Move the call later, so we know Typ
	is Present, and remove "if Present (Typ)" from this procedure.
	* exp_aggr.adb (Convert_To_Assignments): Use membership test,
	and avoid the "if False" idiom.
	(Expand_Array_Aggregate): Remove a ??? comment.
	* sem_ch8.adb (Push_Scope): Take advantage of the full coverage
	rules for aggregates.
	* sem_res.adb (Resolve_Declare_Expression): Remove test for
	Is_Type -- that's all it can be.  Use named notation in call to
	Establish_Transient_Scope.
	* libgnat/a-cdlili.adb (Adjust): Remove redundant code.
	(Clear): Remove "pragma Warnings (Off);", which wasn't actually
	suppressing any warnings.
2021-07-06 14:46:53 +00:00
Bob Duff f5063691c1 [Ada] Make parent of N_Exception_Declaration be N_Declaration
gcc/ada/

	* gen_il-gen-gen_nodes.adb: Change the parent of
	N_Exception_Declaration to be N_Declaration.  Minor comment fix.
2021-07-06 14:46:53 +00:00
Ed Schonberg f55784f8ad [Ada] Improper predicate check on view conversion
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): If the conversion is
	the name of an assignment operation do not apply predicate check
	to it prior to the assignment.
2021-07-06 14:46:53 +00:00
Bob Duff 68c27b2a70 [Ada] Add assertions on tampering counts
gcc/ada/

	* libgnat/a-conhel.adb: Assert that tampering counts remain
	between 0 and 2**31-1.  This makes debugging of
	finalization-related bugs easier.
2021-07-06 14:46:52 +00:00
Doug Rupp 885efc5e70 [Ada] Unix Epochalypse (s-osprim.adb)
gcc/ada/

	* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Use s-osprim__posix.adb
	vice s-osprim__vxworks.adb for all vxworks7r2 targets.
2021-07-06 14:46:52 +00:00
Richard Kenner e9559decc6 [Ada] Add Void_Or_Type_Kind and Exception_Or_Object_Kind
gcc/ada/

	* gen_il-types.ads (Void_Or_Type_Kind,
	Exception_Or_Object_Kind): Declare.
	* gen_il-gen-gen_entities.adb: Likewise.
2021-07-06 14:46:52 +00:00
Gary Dismukes 2e1f3a5e3e [Ada] Support for Object.Op subprogram-call notation for untagged types
gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst: Add a
	description of the feature of prefixed-view calls for untagged
	types to the section on pragma Extensions_Allowed.
	* gnat_rm.texi: Regenerate.
	* einfo.ads: Update specification for
	Direct_Primitive_Operations to reflect its use for untagged
	types when Extensions_Allowed is True.
	* gen_il-gen-gen_entities.adb: Allow Direct_Primitive_Operations
	as a field of untagged classes of types by removing the "Pre"
	test of "Is_Tagged_Type (N)", and making that field generally
	available for all types and subtypes by defining it for
	Type_Kind and removing its specification for individual classes
	of types.
	* sem_ch3.adb (Analyze_Full_Type_Declaration): Initialize the
	Direct_Primitive_Operations list when not already set for the
	new (sub)type and its base type (except when Ekind of the type
	is E_Void, which can happen due to errors in cases where
	Derived_Type_Declaration is called and perhaps in other
	situations).
	(Analyze_Subtype_Declaration): Inherit
	Direct_Primitive_Operations list from the base type, for record
	and private cases.
	(Build_Derived_Record_Type): Initialize the
	Direct_Primitive_Operations list for derived record and private
	types.
	(Build_Derived_Type): Initialize the Direct_Primitive_Operations
	list for derived types (and also for their associated base types
	when needed).
	(Process_Full_View): For full types that are untagged record and
	private types, copy the primitive operations of the partial view
	to the primitives list of the full view.
	* sem_ch4.adb (Analyze_Selected_Component): Allow prefixed
	notation for subprogram calls in the case of untagged
	types (when Extensions_Allowed is True). In the case where
	Is_Private_Type (Prefix_Type) is True, call Try_Object_Operation
	when a discriminant selector wasn't found. Also call
	Try_Object_Operation in other type kind cases (when
	Extensions_Allowed is True).
	(Try_Object_Operation.Try_One_Prefixed_Interpretation): Prevent
	early return in the untagged case (when Extensions_Allowed is
	True). Condition main call to Try_Primitive_Operation on the
	type having primitives, and after that, if Prim_Result is False,
	test for case where the prefix type is a named access type with
	primitive operations and in that case call
	Try_Primitive_Operation after temporarily resetting Obj_Type to
	denote the access type (and restore it to the designated type
	after the call)
	(Try_Object_Operation.Valid_First_Argument_Of): Do matching type
	comparison by testing Base_Type (Obj_Type) against
	Base_Type (Typ), rather than against just Typ, to properly
	handle cases where the object prefix has a constrained
	subtype.  (Fixes a bug discovered while working on this
	feature.)
	* sem_ch6.adb
	(New_Overloaded_Entity.Check_For_Primitive_Subprogram): Add a
	primitive of an untagged type to the type's list of primitive
	operations, for both explicit and implicit (derived, so
	Comes_From_Source is False) subprogram declarations. In the case
	where the new primitive overrides an inherited subprogram,
	locate the primitives Elist that references the overridden
	subprogram, and replace that element of the list with the new
	subprogram (done by calling the new procedure
	Add_Or_Replace_Untagged_Primitive on the result type and each
	formal atype).
	(Check_For_Primitive_Subprogram.Add_Or_Replace_Untagged_Primitive):
	New nested procedure to either add or replace an untagged
	primitive subprogram in a given type's list of primitive
	operations (replacement happens in case where the new subprogram
	overrides a primitive of the type).
	* sem_ch7.adb (New_Private_Type): When Extensions_Allowed is
	True, initialize the Direct_Primitive_Operations list of a
	private type to New_Elmt_List in the case of untagged types.
	* sem_ch8.adb (Find_Selected_Component): In the case where the
	prefix is an entity name, relax condition that tests
	Has_Components so that Analyze_Selected_Component will also be
	called when Extensions_Allowed is True and the prefix type is
	any type.
2021-07-06 14:46:52 +00:00
Ed Schonberg daf9bc6aea [Ada] Spurious conformance error on expression function
gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not perform
	conformance check when the subprogram body has been created for
	an expression function that is not a completion of a previous
	specification, because the profile of the constructed body is
	copied from the expression function itself.
2021-07-06 14:46:51 +00:00
Steve Baird 0b2e951488 [Ada] Add GNAT RM text regarding Ada 2022 default Put_Image implementation
gcc/ada/

	* doc/gnat_rm/implementation_of_specific_ada_features.rst: Add a
	warning indicating that the details of the default (i.e.,
	selected by the compiler) implementation of T'Put_Image for a
	nonscalar type T are subject to change.
	* gnat_rm.texi: Regenerate.
2021-07-06 14:46:51 +00:00
Iain Sandoe f99f6eb58e X86: Provide a CTOR for stringop_algs [PR100246].
Several older compilers fail to build modern GCC because of missing
or incomplete C++11 support.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

PR bootstrap/100246 - [11/12 Regression] GCC will not bootstrap with clang 3.4/3.5 [xcode 5/6, Darwin 12/13]

	PR bootstrap/100246

gcc/ChangeLog:

	* config/i386/i386.h (struct stringop_algs): Define a CTOR for
	this type.
2021-07-06 11:13:38 +01:00
Richard Biener 7d810646d4 Add FMADDSUB and FMSUBADD SLP vectorization patterns and optabs
This adds named expanders for vec_fmaddsub<mode>4 and
vec_fmsubadd<mode>4 which map to x86 vfmaddsubXXXp{ds} and
vfmsubaddXXXp{ds} instructions.  This complements the previous
addition of ADDSUB support.

x86 lacks SUBADD and the negate variants of FMA with mixed
plus minus so I did not add optabs or patterns for those but
it would not be difficult if there's a target that has them.

2021-07-05  Richard Biener  <rguenther@suse.de>

	* doc/md.texi (vec_fmaddsub<mode>4): Document.
	(vec_fmsubadd<mode>4): Likewise.
	* optabs.def (vec_fmaddsub$a4): Add.
	(vec_fmsubadd$a4): Likewise.
	* internal-fn.def (IFN_VEC_FMADDSUB): Add.
	(IFN_VEC_FMSUBADD): Likewise.
	* tree-vect-slp-patterns.c (addsub_pattern::recognize):
	Refactor to handle IFN_VEC_FMADDSUB and IFN_VEC_FMSUBADD.
	(addsub_pattern::build): Likewise.
	* tree-vect-slp.c (vect_optimize_slp): CFN_VEC_FMADDSUB
	and CFN_VEC_FMSUBADD are not transparent for permutes.
	* config/i386/sse.md (vec_fmaddsub<mode>4): New expander.
	(vec_fmsubadd<mode>4): Likewise.

	* gcc.target/i386/vect-fmaddsubXXXpd.c: New testcase.
	* gcc.target/i386/vect-fmaddsubXXXps.c: Likewise.
	* gcc.target/i386/vect-fmsubaddXXXpd.c: Likewise.
	* gcc.target/i386/vect-fmsubaddXXXps.c: Likewise.
2021-07-06 11:56:47 +02:00
Richard Biener 9f489a5731 add -fmove-loop-stores option to control GIMPLE loop store-motion
This adds the -fmove-loop-stores option, mainly as a way to disable
the store-motion part of GIMPLE invariant motion (-ftree-loop-im)
which is enabled by default.  It might be sensible to turn off
-fmove-loop-stores at -O1 since it can result in compile-time
as well as memory usage issues but this patch tries to preserve
existing behavior besides introducing the new option with the
exception of -Og where I've disabled it.

Controlling store-motion has been made easy by earlier refactoring
for the invariant motion only use after loop interchange.

2021-07-02  Richard Biener  <rguenther@suse.de>

	* doc/invoke.texi (fmove-loop-stores): Document.
	* common.opt (fmove-loop-stores): New option.
	* opts.c (default_options_table): Enable -fmove-loop-stores
	at -O1 but not -Og.
	* tree-ssa-loop-im.c (pass_lim::execute): Pass
	flag_move_loop_stores instead of true to
	loop_invariant_motion_in_fun.
2021-07-06 11:56:47 +02:00
Iain Sandoe b019b28ebd Documentation : Describe --with-dsymutil configure option.
This adds documentation for the dsymutil configuration option
introduced with commit r12-2037-g3b5e8ee4f1ec.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* doc/install.texi: Document --with-dsymutil.
2021-07-06 09:22:28 +01:00
Andrew Pinski 51abfb6a89 Fix 101256: Wrong code due to range incorrect from PHI-OPT
So the problem here is that replace_phi_edge_with_variable
will copy range information to a already (not newly) defined
ssa name.  This causes wrong code later on.
This fixes the problem by require the new ssa name to
be defined in the same bb as the conditional that is
about to be deleted.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Changes from v1:
* this is a simplification of what was trying to be done before.

gcc/ChangeLog:

	PR tree-optimization/101256
	* dbgcnt.def (phiopt_edge_range): New counter.
	* tree-ssa-phiopt.c (replace_phi_edge_with_variable):
	Check to make sure the new name is defined in the same
	bb as the conditional before duplicating range info.
	Also add debug counter.

gcc/testsuite/ChangeLog:

	PR tree-optimization/101256
	* g++.dg/torture/pr101256.C: New test.
2021-07-06 00:32:40 -07:00
Thomas Koenig d7e3855d5d Do not replace variable op variable in I/O implied DO loop replacement.
This PR came about because index expressions of the form k+k in
implied DO loops in I/O statements were considered for replacement
by array slices.

Fixed by only doing the transformation if the expression is of the
type expr OP contastant.

gcc/fortran/ChangeLog:

	PR fortran/100227
	* frontend-passes.c (traverse_io_block): Adjust test for
	when a variable is eligible for the transformation to
	array slice.

gcc/testsuite/ChangeLog:

	PR fortran/100227
	* gfortran.dg/implied_do_io_7.f90: New test.
2021-07-06 07:04:09 +02:00
Kewen Lin c64d15224c i386: Disable param ira-consider-dup-in-all-alts [PR100328]
With Hongtao's SPEC2017 performance evaluation result here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573986.html
this new parameter ira-consider-dup-in-all-alts has negative
effects on i386, this patch is to disable it explicitly on
i386.

Bootstrapped & regtested on x86_64-redhat-linux.

gcc/ChangeLog:

	PR rtl-optimization/100328
	* config/i386/i386-options.c (ix86_option_override_internal):
	Set param_ira_consider_dup_in_all_alts to 0.
2021-07-05 20:54:16 -05:00
Kewen Lin 8ffe25eefa ira: Support more matching constraint forms with param [PR100328]
This patch is to make IRA consider matching constraint heavily,
even if there is at least one other alternative with non-NO_REG
register class constraint, it will continue and check matching
constraint in all available alternatives and respect the
matching constraint with preferred register class.

One typical case is destructive FMA style instruction on rs6000.
Without this patch, for the mentioned FMA instruction, IRA won't
respect the matching constraint on VSX_REG since there are some
alternative with FLOAT_REG which doesn't have matching constraint.
It can cause extra register copies since later reload has to make
code to respect the constraint.  This patch make IRA respect this
matching constraint on VSX_REG which is the preferred regclass,
but it excludes some cases where for one preferred register class
there can be two or more alternatives, one of them has the
matching constraint, while another doesn't have.  It also
considers the possibility of free register copy.

With option Ofast unroll, this patch can help to improve SPEC2017
bmk 508.namd_r +2.42% and 519.lbm_r +2.43% on Power8 while
508.namd_r +3.02% and 519.lbm_r +3.85% on Power9 without any
remarkable degradations.  It also improved something on SVE as
testcase changes showed and Richard's confirmation.

Bootstrapped & regtested on powerpc64le-linux-gnu P9,
x86_64-redhat-linux and aarch64-linux-gnu.

gcc/ChangeLog:

	PR rtl-optimization/100328
	* doc/invoke.texi (ira-consider-dup-in-all-alts): Document new
	parameter.
	* ira.c (ira_get_dup_out_num): Adjust as parameter
	param_ira_consider_dup_in_all_alts.
	* params.opt (ira-consider-dup-in-all-alts): New.
	* ira-conflicts.c (process_regs_for_copy): Add one parameter
	single_input_op_has_cstr_p.
	(get_freq_for_shuffle_copy): New function.
	(add_insn_allocno_copies): Adjust as single_input_op_has_cstr_p.
	* ira-int.h (ira_get_dup_out_num): Add one bool parameter.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/100328
	* gcc.target/aarch64/sve/acle/asm/div_f16.c: Remove one xfail.
	* gcc.target/aarch64/sve/acle/asm/div_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/div_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/divr_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/divr_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/divr_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mad_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mad_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mad_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mla_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mla_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mla_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mls_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mls_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mls_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/msb_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/msb_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/msb_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mulx_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mulx_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/mulx_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmad_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmad_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmad_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmla_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmla_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmla_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmls_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmls_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmls_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmsb_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmsb_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/nmsb_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/sub_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/sub_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/sub_f64.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/subr_f16.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/subr_f32.c: Likewise.
	* gcc.target/aarch64/sve/acle/asm/subr_f64.c: Likewise.
2021-07-05 20:53:19 -05:00
Indu Bhagat a3543b5e80 CTF,BTF testsuite: Use -gdwarf-4 for restrict type qualifier [PR101283]
DWARF DIEs do not contain DW_TAG_restrict_type when DWARF version is 2. CTF/BTF
generation feeds off DWARF DIEs, and as such, CTF records of kind
CTF_K_RESTRICT cease to be generated when DWARF version is 2.

This patch fixes the failure of these testcases on Darwin by using an explicit
-gdwarf-4 in the dg-options. This keeps the CTF record generation for restrict
type qualifier tested.

  PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf

2021-07-05  Indu Bhagat  <indu.bhagat@oracle.com>

gcc/testsuite/ChangeLog:

	PR debug/101283
	* gcc.dg/debug/btf/btf-cvr-quals-1.c: Use -gdwarf-4 on Darwin targets.
	* gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
2021-07-05 17:44:59 -07:00
GCC Administrator 6d53e6f9c7 Daily bump. 2021-07-06 00:16:44 +00:00
Jeff Law 1562c7987b Remove redundant compare in shift loop on H8
gcc/ChangeLog

	* config/h8300/shiftrotate.md (shift-by-variable patterns): Update to
	generate condition code aware RTL directly.
2021-07-05 17:25:39 -04:00
Andrew Pinski 7d69791972 Port most of the A CMP 0 ? A : -A to match
To improve phiopt and be able to remove abs_replacement, this ports
most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to
match.pd.  There is a few extra changes that are needed to remove
the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison:
   * Need to handle (A - B) case
   * Need to handle UN* comparisons.

I will handle those in a different patch.

Note phi-opt-15.c test needed to be updated as we get ABSU now
instead of not getting ABS.  When ABSU was added phiopt was not
updated even to use ABSU instead of not creating ABS.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	PR tree-optimization/101039
	* match.pd (A CMP 0 ? A : -A): New patterns.
	* tree-ssa-phiopt.c (abs_replacement): Delete function.
	(tree_ssa_phiopt_worker): Don't call abs_replacement.
	Update comment about abs_replacement.

gcc/testsuite/ChangeLog:

	PR tree-optimization/101039
	* gcc.dg/tree-ssa/phi-opt-15.c: Update test to expect
	ABSU and still not expect ABS_EXPR.
	* gcc.dg/tree-ssa/phi-opt-23.c: New test.
	* gcc.dg/tree-ssa/phi-opt-24.c: New test.
2021-07-05 12:44:14 -07:00
Andrew Pinski a50cecb20a Try inverted comparison for match_simplify in phiopt
Since match and simplify does not have all of the inverted
comparison patterns, it make sense to just have
phi-opt try to do the inversion and try match and simplify again.

OK? Bootstrapped and tested on x86_64-linux-gnu.

Thanks,
Andrew Pinski

gcc/ChangeLog:

	* tree-ssa-phiopt.c (gimple_simplify_phiopt):
	If "A ? B : C" fails to simplify, try "(!A) ? C : B".
2021-07-05 12:44:14 -07:00
Andrew Pinski cd48e550d1 Allow match-and-simplified phiopt to run in early phiopt
To move a few things more to match-and-simplify from phiopt,
we need to allow match_simplify_replacement to run in early
phiopt. To do this we add a replacement for gimple_simplify
that is explictly for phiopt.

OK? Bootstrapped and tested on x86_64-linux-gnu with no
regressions.

gcc/ChangeLog:

	* tree-ssa-phiopt.c (match_simplify_replacement):
	Add early_p argument. Call gimple_simplify_phiopt
	instead of gimple_simplify.
	(tree_ssa_phiopt_worker): Update call to
	match_simplify_replacement and allow unconditionally.
	(phiopt_early_allow): New function.
	(gimple_simplify_phiopt): New function.
2021-07-05 12:44:14 -07:00
Andrew Pinski 3c44b412fe Fix PR 101237: Remove element_type call when used with the functions from real
HONOR_SIGNED_ZEROS, HONOR_SIGN_DEPENDENT_ROUNDING, and HONOR_SNANS all
have an overload for taking a tree type now, so we should do that instead.

OK?  Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	PR middle-end/101237
	* fold-const.c (negate_expr_p): Remove call to element_mode
	and TREE_MODE/TREE_TYPE when calling HONOR_SIGNED_ZEROS,
	HONOR_SIGN_DEPENDENT_ROUNDING, and HONOR_SNANS.
	(fold_negate_expr_1): Likewise.
	(const_unop): Likewise.
	(fold_cond_expr_with_comparison): Likewise.
	(fold_binary_loc): Likewise.
	(fold_ternary_loc): Likewise.
	(tree_call_nonnegative_warnv_p): Likewise.
	* match.pd (-(A + B) -> (-B) - A): Likewise.
2021-07-05 12:44:13 -07:00
Iain Sandoe 3b5e8ee4f1 Darwin, configury : Allow for specification and detection of dsymutil.
In order to enable DWARF versions > 2 we need a sufficiently modern
version of dsymutil (in addition to the assembler / linker).  This
allows the user to configure a different path from the installed one.

In addition, there are several sources of dsymutil so we differentiate
these in order to be get accurate version information.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* configure.ac: Handle --with-dsymutil in the same way as we
	do for the assembler and linker.  (DEFAULT_DSYMUTIL): New.
	Extract the type and version for the dsymutil configured or
	found by the default searches.
	* config.in: Regenerated.
	* configure: Regenerated.
	* collect2.c (do_dsymutil): Handle locating dsymutil in the
	same way as for the assembler and  linker.
	* config/darwin.h (DSYMUTIL): Delete.
	* gcc.c: Report a configured dsymutil correctly.
	* exec-tool.in: Allow for dsymutil.

ChangeLog:

	* Makefile.def: Add dsymutil defs.
	* Makefile.in: Regenerated.
	* Makefile.tpl: Add dsymutil to flags.
	* configure: Regenerated.
	* configure.ac: Add dsymutil to target and build recipes.
2021-07-05 20:40:45 +01:00
Uros Bizjak be8749f939 i386: Implement 4-byte vector (V4QI/V2HI) constant permutations
2021-07-05  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	* config/i386/i386-expand.c (ix86_split_mmx_punpck):
	Handle V4QI and V2HI modes.
	(expand_vec_perm_blend): Allow 4-byte vector modes with TARGET_SSE4_1.
	Handle V4QI mode. Emit mmx_pblendvb32 for 4-byte modes.
	(expand_vec_perm_pshufb): Rewrite to use switch statemets.
	Handle 4-byte dual operands with TARGET_XOP and single operands
	with TARGET_SSSE3.  Emit mmx_ppermv32 for TARGET_XOP and
	mmx_pshufbv4qi3 for TARGET_SSSE3.
	(expand_vec_perm_pblendv): Allow 4-byte vector modes with TARGET_SSE4_1.
	(expand_vec_perm_interleave2): Allow 4-byte vector modes.
	(expand_vec_perm_pshufb2): Allow 4-byte vector modes with TARGET_SSSE3.
	(expand_vec_perm_even_odd_1): Handle V4QI mode.
	(expand_vec_perm_broadcast_1): Handle V4QI mode.
	(ix86_vectorize_vec_perm_const): Handle V4QI mode.
	* config/i386/mmx.md (mmx_ppermv32): New insn pattern.
	(mmx_pshufbv4qi3): Ditto.
	(*mmx_pblendw32): Ditto.
	(*mmx_pblendw64): Rename from *mmx_pblendw.
	(mmx_punpckhbw_low): New insn_and_split pattern.
	(mmx_punpcklbw_low): Ditto.
2021-07-05 21:05:10 +02:00
Pierre-Marie de Rodat 8e0b3827bb [Ada] Regenerate *.texi files with Sphinx 4.0.2
gcc/ada/

	* gnat-style.texi, gnat_rm.texi, gnat_ugn.texi: Regenerate.
2021-07-05 13:09:18 +00:00
Piotr Trojanek 59748b7180 [Ada] Reject overlays in Global/Depends/Initializes contracts
gcc/ada/

	* sem_prag.adb (Analyze_Depends_In_Decl_Part): Reject overlays
	in Depends and Refined_Depends contracts.
	(Analyze_Global_In_Decl_Part): Likewise for Global and
	Refined_Global.
	(Analyze_Initializes_In_Decl_Part): Likewise for Initializes
	(when appearing both as a single item and as a initialization
	clause).
	* sem_util.ads (Ultimate_Overlaid_Entity): New routine.
	* sem_util.adb (Report_Unused_Body_States): Ignore overlays.
	(Ultimate_Overlaid_Entity): New routine.
2021-07-05 13:09:17 +00:00
Claire Dross fdb5c20036 [Ada] Add Reference and Constant_Reference functions to formal containers
gcc/ada/

	* libgnat/a-cfdlli.ads, libgnat/a-cfdlli.adb
	libgnat/a-cfinve.ads, libgnat/a-cfinve.adb,
	libgnat/a-cofove.ads, libgnat/a-cofove.adb,
	libgnat/a-coboho.ads, libgnat/a-coboho.adb (Constant_Reference):
	Get a read-only access to an element of the container.
	(At_End): Ghost functions used to express pledges in the
	postcondition of Reference.
	(Reference): Get a read-write access to an element of the
	container.
	* libgnat/a-cfhama.ads, libgnat/a-cfhama.adb,
	libgnat/a-cforma.ads, libgnat/a-cforma.adb: The full view of the
	Map type is no longer a tagged type, but a wrapper over this
	tagged type. This is to avoid issues with dispatching result in
	At_End functions.
	(Constant_Reference): Get a read-only access to an element of
	the container.
	(At_End): Ghost functions used to express pledges in the
	postcondition of Reference.
	(Reference): Get a read-write access to an element of the
	container.

	* libgnat/a-cfhase.ads, libgnat/a-cfhase.adb,
	libgnat/a-cforse.ads, libgnat/a-cforse.adb: The full view of the
	Map type is no longer a tagged type, but a wrapper over this
	tagged type.
	(Constant_Reference): Get a read-only access to an element of
	the container.
	* libgnat/a-cofuse.ads, libgnat/a-cofuve.ads (Copy_Element):
	Expression function used to cause SPARK to make sure
	Element_Type is copiable.
	* libgnat/a-cofuma.ads (Copy_Key): Expression function used to
	cause SPARK to make sure Key_Type is copiable.
	(Copy_Element): Expression function used to cause SPARK to make
	sure Element_Type is copiable.
2021-07-05 13:09:17 +00:00
Yannick Moy 902d707666 [Ada] Adapt SPARK RM rule on non-effectively volatile abstract state
gcc/ada/

	* sem_prag.adb (Analyze_Global_Item): Adapt to update SPARK RM
	rule.
2021-07-05 13:09:16 +00:00
Arnaud Charlet 796b616383 [Ada] Use runtime from base compiler during stage1 #2
gcc/ada/

	* Make-generated.in: Add -f switch to ensure cp will never fail.
2021-07-05 13:09:16 +00:00
Steve Baird 77630ba95a [Ada] Fix some "current instance" bugs
gcc/ada/

	* exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): When
	building the assignment statement corresponding to the default
	expression for a component, we make a copy of the expression.
	When making that copy (and if we have seen a component that
	requires late initialization), pass a Map parameter into the
	call to New_Copy_Tree to redirect references to the type to
	instead refer to the _Init formal parameter of the init proc.
	This includes hoisting the declaration of Has_Late_Init_Comp out
	one level so that it becomes available to Build_Assignment.
	(Find_Current_Instance): Return True for other kinds of current
	instance references, instead of just access-valued attribute
	references such as T'Access.
	* sem_util.adb (Is_Aliased_View): Return True for the _Init
	formal parameter of an init procedure. The changes in
	exp_ch3.adb can have the effect of replacing a "T'Access"
	attribute reference in an init procedure with an "_Init'Access"
	attribute reference. We want such an attribute reference to be
	legal. However, we do not simply mark the formal parameter as
	being aliased because that might impact callers.
	(Is_Object_Image): Return True if Is_Current_Instance returns
	True for the prefix of an Image (or related attribute) attribute
	reference.
2021-07-05 13:09:16 +00:00
Piotr Trojanek 6cf7cc8ccf [Ada] Simplify and reuse Is_Concurrent_Interface
gcc/ada/

	* exp_ch3.adb (Stream_Operation_OK): Reuse
	Is_Concurrent_Interface.
	* sem_ch3.adb (Analyze_Interface_Declaration,
	Build_Derived_Record_Type): Likewise.
	* sem_ch6.adb (Check_Limited_Return): Likewise.
	* sem_util.adb (Is_Concurrent_Interface): Don't call
	Is_Interface because each of the Is_Protected_Interface,
	Is_Synchronized_Interface and Is_Task_Interface calls it anyway.
2021-07-05 13:09:15 +00:00
Ghjuvan Lacambre 0700922ea5 [Ada] Fix missing error messages when returning limited type
gcc/ada/

	* sem_ch6.adb (Check_Limited_Return): Replace Comes_From_Source
	with Comes_From_Extended_Return_Statement.
2021-07-05 13:09:15 +00:00
Steve Baird 7e7397265c [Ada] Remove Ada.Strings.Text_Output and child units
gcc/ada/

	* libgnat/a-stobbu.adb, libgnat/a-stobbu.ads,
	libgnat/a-stobfi.adb, libgnat/a-stobfi.ads,
	libgnat/a-stoubu.adb, libgnat/a-stoubu.ads,
	libgnat/a-stoufi.adb, libgnat/a-stoufi.ads,
	libgnat/a-stoufo.adb, libgnat/a-stoufo.ads,
	libgnat/a-stouut.adb, libgnat/a-stouut.ads,
	libgnat/a-stteou.ads: Delete files.
	* Makefile.rtl, impunit.adb: Remove references to deleted files.
2021-07-05 13:09:15 +00:00
Piotr Trojanek 1d1e91f4c3 [Ada] Fix excessive check for alignment of overlaying objects
gcc/ada/

	* sem_util.adb (Has_Compatible_Alignment_Internal): If the
	prefix of the Address expression is an entire object with a
	known alignment, then skip checks related to its size.
2021-07-05 13:09:14 +00:00
Doug Rupp 63b43535dc [Ada] The Unix Epochalyse of 2038 - OS_Time comparison
gcc/ada/

	* libgnat/s-os_lib.ads: Import OS_Time comparison ops as
	intrinsic.
	* libgnat/s-os_lib.adb: Remove OS_TIme comparison ops
	implementation.
2021-07-05 13:09:14 +00:00
Doug Rupp cee731748f [Ada] The Unix Epochalypse of 2038 (Warn about time_t in the compiler)
gcc/ada/

	* libgnat/s-os_lib.ads: Add some comments about time_t.
	* libgnat/s-os_lib.adb (GM_Split/To_GM_Time): Rename formal to
	P_OS_Time.
	(GM_Time_Of/To_OS_Time): Likewise.
2021-07-05 13:09:14 +00:00
Ghjuvan Lacambre 2644eaa0b9 [Ada] Fix missing minus sign in literal translation
gcc/ada/

	* sem_res.adb (Resolve): Insert minus sign if needed.
2021-07-05 13:09:13 +00:00
Steve Baird 74895b6354 [Ada] Temporarily disable Ada 2022 Image and Put_Image support for tagged types
gcc/ada/

	* exp_put_image.adb:
	(Enable_Put_Image, Preload_Root_Buffer_Type): Revert to querying
	the -gnatd_z switch, as opposed to testing whether Ada_Version >= Ada_2022.
2021-07-05 13:09:13 +00:00
Justin Squirek bcb8c3bba7 [Ada] INOX: prototype alternative accessibility model
gcc/ada/

	* checks.adb (Accessibility_Checks_Suppressed): Add check
	against restriction No_Dynamic_Accessibility_Checks.
	(Apply_Accessibility_Check): Add assertion to check restriction
	No_Dynamic_Accessibility_Checks is not active.
	* debug.adb: Add documentation for new debugging switch to
	control which accessibility model gets employed under
	restriction No_Dynamic_Accessibility_Checks.
	* exp_attr.adb (Expand_N_Attribute_Reference): Disable dynamic
	accessibility check generation when
	No_Dynamic_Accessibility_Checks is active.
	* exp_ch4.adb (Apply_Accessibility_Check): Skip check generation
	when restriction No_Dynamic_Accessibility_Checks is active.
	(Expand_N_Allocator): Disable dynamic accessibility checks when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_N_In): Disable dynamic accessibility checks when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_N_Type_Conversion): Disable dynamic accessibility checks
	when No_Dynamic_Accessibility_Checks is active.
	* exp_ch5.adb (Expand_N_Assignment_Statement): Disable
	alternative accessibility model calculations when computing a
	dynamic level for a SAOAAT.
	* exp_ch6.adb (Add_Call_By_Copy_Code): Disable dynamic
	accessibility check generation when
	No_Dynamic_Accessibility_Checks is active.
	(Expand_Branch): Disable alternative accessibility model
	calculations.
	(Expand_Call_Helper): Disable alternative accessibility model
	calculations.
	* restrict.adb, restrict.ads: Add new restriction
	No_Dynamic_Accessibility_Checks.
	(No_Dynamic_Accessibility_Checks_Enabled): Created to test when
	experimental features (which are generally incompatible with
	standard Ada) can be enabled.
	* sem_attr.adb (Safe_Value_Conversions): Add handling of new
	accessibility model under the restriction
	No_Dynamic_Accessibility_Checks.
	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Disallow new restriction No_Dynamic_Accessibility_Checks from
	being exclusively specified within a body or subunit without
	being present in a specification.
	* sem_res.adb (Check_Fully_Declared_Prefix): Minor comment
	fixup.
	(Valid_Conversion): Omit implicit conversion checks on anonymous
	access types and perform static checking instead when
	No_Dynamic_Accessibility_Checks is active.
	* sem_util.adb, sem_util.ads (Accessibility_Level): Add special
	handling of anonymous access objects, formal parameters,
	anonymous access components, and function return objects.
	(Deepest_Type_Access_Level): When
	No_Dynamic_Accessibility_Checks is active employ an alternative
	model. Add paramter Allow_Alt_Model to override the new behavior
	in certain cases.
	(Type_Access_Level): When No_Dynamic_Accessibility_Checks is
	active employ an alternative model. Add parameter
	Allow_Alt_Model to override the new behavior in certain cases.
	(Typ_Access_Level): Created within Accessibility_Level for
	convenience.
	* libgnat/s-rident.ads, snames.ads-tmpl: Add handing for
	No_Dynamic_Accessibility_Checks.
2021-07-05 13:09:13 +00:00
Doug Rupp 35d721c09a [Ada] The Unix Epochalypse of 2038 - Use OS_Time
gcc/ada/

	* adaint.h (__gnat_set_file_time_name): Use OS_Time.
	* adaint.c (__gnat_set_file_time_name): Likewise.
2021-07-05 13:09:12 +00:00
Doug Rupp a0bdd4b03b [Ada] The Unix Epochalyse of 2038 - OS_Time
gcc/ada/

	* adaint.h (OS_Time): typedef as long long.
	* osint.adb (Underlying_OS_Time): Declare as 64-bit signed type.
	* libgnat/s-os_lib.adb ("<"): Compare OS_Time as
	Long_Long_Integer.
	("<="): Likewise.
	(">"): Likewise.
	(">="): Likewise.
	* libgnat/s-os_lib.ads (OS_Time): Declare as 64-bit signed type.
2021-07-05 13:09:12 +00:00
Ghjuvan Lacambre e7b17be973 [Ada] Move overriding rename error message from declaration to use
gcc/ada/

	* sem_ch3.adb (Check_Abstract_Overriding): Post error message on
	renaming node.
2021-07-05 13:09:12 +00:00
Yannick Moy f7b2ce2f53 [Ada] Adapt SPARK checking after change in rules regarding heap modeling
gcc/ada/

	* libgnat/a-uncdea.ads: Add Depends/Post to
	Ada.Unchecked_Deallocation.
	* sem_ch4.adb (Analyze_Allocator): Remove checking of allocator
	placement.
	* sem_res.adb (Flag_Object): Same.
2021-07-05 13:09:11 +00:00
Ghjuvan Lacambre 36d4f97d58 [Ada] Turn GNAT_Annotate into its own pragma
gcc/ada/

	* aspects.ads: Add GNAT_Annotate aspect.
	* gnat1drv.adb (Adjust_Global_Switches): Stop defining
	Name_Gnat_Annotate as an alias of Name_Annotate.
	* snames.ads-tmpl: Define Gnat_Annotate.
	* par-prag.adb, sem_prag.ads: Add Pragma_Gnat_Annotate to list
	of pragmas.
	* lib-writ.adb, sem_ch13.adb, sem_prag.adb: Handle Gnat_Annotate
	like Aspect_Annotate.
2021-07-05 13:09:11 +00:00
Piotr Trojanek 22c0e0cabd [Ada] Fix comment about the debug flag for strict alignment
gcc/ada/

	* ttypes.ads (Target_Strict_Alignment): Fix comment.
2021-07-05 13:09:11 +00:00
Piotr Trojanek 5c3bbe1d98 [Ada] Cleanup checking for compatible alignment
gcc/ada/

	* sem_util.adb (Has_Compatible_Alignment_Internal): Fix
	indentation of ELSIF comments; remove explicit calls to
	UI_To_Int; remove extra parens around the MOD operand.
2021-07-05 13:09:10 +00:00