Commit Graph

189557 Commits

Author SHA1 Message Date
Aldy Hernandez 47c2cf3ac6 Remove TDF_THREADING flag in favor of param.
I am returning a TDF_* flag to the queue of available entries as I am
unconvinced that we need to burn an entire flag for internal debugging
constructs, especially since we seem to be running out of them.

I've added a --param=threader-debug entry similar to the one we use for
ranger debugging.  Currently this only affects the backward threader,
but since the DOM threader is an outlier and on the chopping block, I
avoided using the "backward" name.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* dumpfile.c (dump_options): Remove TDF_THREADING entry.
	* dumpfile.h (enum dump_flag): Remove TDF_THREADING and adjust
	remaining entries.
	* flag-types.h (enum threader_debug): New.
	* gimple-range-path.cc (DEBUG_SOLVER): Use param_threader_debug.
	* params.opt: Add entry for --param=threader-debug=.
2021-11-09 14:29:22 +01:00
Thomas Schwinge c71cb26a9e Get rid of infinite recursion for 'typedef' used with GTY-marked 'gcc/diagnostic-spec.h:nowarn_map' [PR101204, PR103157]
Reproduced with clang version 10.0.0-4ubuntu1:

    gtype-desc.c:11333:1: warning: all paths through this function will call itself [-Winfinite-recursion]

... as well as some GCC's '-O2 -fdump-tree-optimized':

    void gt_pch_nx(int_hash<unsigned int, 0u, 4294967295u>*, gt_pointer_operator, void*) ([...])
    {
      <bb 2>:

      <bb 3>:
      goto <bb 3>;

    }

That three-arguments 'gt_pch_nx' function as well as two one-argument
'gt_ggc_mx', 'gt_pch_nx' functions now turn empty:

    [...]
     void
    -gt_ggc_mx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
    +gt_ggc_mx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
     {
    -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
    -  gt_ggc_mx (&((*x)));
    +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
     }
    [...]
     void
    -gt_pch_nx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
    +gt_pch_nx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
     {
    -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
    -  gt_pch_nx (&((*x)));
    +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
     }
    [...]
     void
    -gt_pch_nx (int_hash<location_t,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
    +gt_pch_nx (struct xint_hash_t* x ATTRIBUTE_UNUSED,
            ATTRIBUTE_UNUSED gt_pointer_operator op,
            ATTRIBUTE_UNUSED void *cookie)
     {
    -    gt_pch_nx (&((*x)), op, cookie);
     }
    [...]

	gcc/
	PR middle-end/101204
	PR other/103157
	* diagnostic-spec.h (typedef xint_hash_t): Turn into...
	(struct xint_hash_t): ... this.
	* doc/gty.texi: Update.
2021-11-09 13:20:41 +01:00
Przemyslaw Wirkus 32ba7860cc arm: add armv9-a architecture to -march
In this patch:
	+ Add `armv9-a` to -march.
	+ Update multilib with armv9-a and armv9-a+simd.

gcc/ChangeLog:

	* config/arm/arm-cpus.in (armv9): New define.
	(ARMv9a): New group.
	(armv9-a): New arch definition.
	* config/arm/arm-tables.opt: Regenerate.
	* config/arm/arm.h (BASE_ARCH_9A): New arch enum value.
	* config/arm/t-aprofile: Added armv9-a and armv9+simd.
	* config/arm/t-arm-elf: Added arm9-a, v9_fps and all_v9_archs
	to MULTILIB_MATCHES.
	* config/arm/t-multilib: Added v9_a_nosimd_variants and
	v9_a_simd_variants to MULTILIB_MATCHES.
	* doc/invoke.texi: Update docs.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/multilib.exp: Update test with armv9-a entries.
	* lib/target-supports.exp (v9a): Add new armflag.
	(__ARM_ARCH_9A__): Add new armdef.
2021-11-09 11:34:57 +00:00
Martin Jambor df8690f283
ipa: Fix segfault when remapping debug_binds with expressions (PR 103132)
My initial implementation of the method
ipa_param_body_adjustments::remap_with_debug_expressions was based on
the assumption that if it was asked to remap an expression (as opposed
to a simple SSA_NAME), the expression would not contain an SSA_NAME
operand which is to be debug-reset.  While that is true for when
called from ipa_param_body_adjustments::prepare_debug_expressions, it
turns out it is not true when invoked from remap_gimple_stmt in
tree-inline.c.  This patch adds a simple logic to handle such cases
and simply map the entire value to NULL_TREE in those cases.

gcc/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103132
	* ipa-param-manipulation.c (replace_with_mapped_expr): Early
	return with error_mark_mode when part of expression is mapped to
	NULL.
	(ipa_param_body_adjustments::remap_with_debug_expressions): Set
	mapped value to NULL if walk_tree returns error_mark_mode.

gcc/testsuite/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103132
	* gcc.dg/ipa/pr103132.c: New test.
2021-11-09 11:37:17 +01:00
Ghjuvan Lacambre 77eb8c649d [Ada] Fix Codepeer warning
gcc/ada/

	* freeze.adb (Check_Inherited_Conditions): Initialize
	Ifaces_List.
2021-11-09 09:44:50 +00:00
Eric Botcazou 7df3ac2e9e [Ada] Tidy up implementation of Has_Compatible_Type
gcc/ada/

	* sem_ch4.adb (Analyze_Membership_Op) <Find_Interpretation>: Handle
	both overloaded and non-overloaded cases.
	<Try_One_Interp>: Do a reversed call to Covers if the outcome of the
	call to Has_Compatible_Type is false.
	Simplify implementation after change to Find_Interpretation.
	(Analyze_User_Defined_Binary_Op): Be prepared for previous errors.
	(Find_Comparison_Types) <Try_One_Interp>: Do a reversed call to
	Covers if the outcome of the call to Has_Compatible_Type is false.
	(Find_Equality_Types) <Try_One_Interp>: Likewise.
	* sem_type.adb (Has_Compatible_Type): Remove the reversed calls to
	Covers.  Add explicit return on all paths.
2021-11-09 09:44:50 +00:00
Justin Squirek a2e4ebe02b [Ada] Invalid GPR_PROJECT_PATH_FILE confuses gnatls
gcc/ada/

	* gnatls.adb (Initialize_Default_Project_Path): Remove early
	abort on invalid path.
2021-11-09 09:44:50 +00:00
Eric Botcazou 5861b128b9 [Ada] Print Storage_Pool and Procedure_To_Call fields
gcc/ada/

	* sprint.adb (Sprint_Node_Actual) <N_Allocator>: Also print the
	Procedure_To_Call field if it is present.
	<N_Extended_Return_Statement>: Also print the Storage_Pool and
	Procedure_To_Call fields if they are present.
	<N_Free_Statement>: Likewise.
	<N_Simple_Return_Statement>: Likewise.
2021-11-09 09:44:50 +00:00
Patrick Bernardi 09afdaeeeb [Ada] Do not indicate a pending abort if the task is already aborting
gcc/ada/

	* libgnarl/s-tasini.adb (Check_Abort_Status): Don't return 1 if
	the task is aborting.
	* libgnarl/s-tasini.ads (Check_Abort_Status): Update comment.
2021-11-09 09:44:50 +00:00
Patrick Bernardi f6174ec5bd [Ada] RTEMS: use atomic primitive packages on aarch64
gcc/ada/

	* Makefile.rtl: Add ATOMICS_TARGET_PAIRS and
	ATOMICS_BUILTINS_TARGET_PAIRS to LIBGNAT_TARGET_PAIRS for
	aarch64-rtems.
2021-11-09 09:44:50 +00:00
Justin Squirek 9f24d32cf6 [Ada] Hang on compilation of unit with type extension in body
gcc/ada/

	* exp_util.adb (Ancestor_Primitive): Prevent return of an
	subprogram alias when the ancestor primitive of the alias is the
	same as Subp.
2021-11-09 09:44:50 +00:00
Justin Squirek 686b427ff4 [Ada] Crash on expansion of tagged membership test
gcc/ada/

	* exp_ch4.adb (Tagged_Membership): Use corresponding record type
	when expanding a tagged membership test on protected types.
2021-11-09 09:44:49 +00:00
Alexandre Oliva d235950e83 [Ada] Improve integration of strub with type systems
gcc/ada/

	* strub.adb, strub.ads: New files.
	* exp_attr.adb (Access_Cases): Copy strub mode to subprogram type.
	* exp_disp.adb (Expand_Dispatching_Call): Likewise.
	* freeze.adb (Check_Inherited_Conditions): Check that strub modes
	match overridden subprograms and interfaces.
	(Freeze_All): Renaming declarations too.
	* sem_attr.adb (Resolve_Attribute): Reject 'Access to
	strub-annotated data object.
	* sem_ch3.adb (Derive_Subprogram): Copy strub mode to
	inherited subprogram.
	* sem_prag.adb (Analyze_Pragma): Propagate Strub Machine_Attribute
	from access-to-subprogram to subprogram type when required,
	but not from access-to-data to data type.  Mark the entity that
	got the pragma as having a gigi rep item.
	* sem_res.adb (Resolve): Reject implicit conversions that
	would change strub modes.
	(Resolve_Type_Conversions): Reject checked conversions
	between incompatible strub modes.
	* doc/gnat_rm/security_hardening_features.rst: Update.
	* gnat_rm.texi: Regenerate.
	* libgnat/a-except.ads (Raise_Exception): Revert strub-callable
	annotation in public subprogram.
	* libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise.
	* libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise.
	* libgnat/s-secsta.ads (SS_Allocate): Likewise.
	(SS_Mark, SS_Release): Likewise.
	* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add ada/strub.o.
2021-11-09 09:44:49 +00:00
Etienne Servais 80d52cbe59 [Ada] Initialize Current_Source_Unit
gcc/ada/

	* sinput.ads: Initialize Current_Source_Unit to No_Unit.
2021-11-09 09:44:49 +00:00
Piotr Trojanek c8a0089baf [Ada] Use atomics in runtime on ARM and Aarch64 VxWorks
gcc/ada/

	* Makefile.rtl (ARM and Aarch64 VxWorks): Use atomic variants of
	runtime units.
	* libgnat/a-strunb__shared.ads: Mention AARCH64 and ARM as
	supported.
	* libgnat/s-atocou.ads: Likewise.
2021-11-09 09:44:49 +00:00
Ghjuvan Lacambre 51e99ead91 [Ada] Accessibility fix
gcc/ada/

	* sem_util.adb (Accessibility_Level): Use init_proc_level_formal
	instead of computing a new accessibility level from Scope_Depth
	(E).
2021-11-09 09:44:49 +00:00
Johannes Kliemann cbe421bd45 [Ada] Add gcc specs with vxworks7 base addresses for cert
gcc/ada/

	* vxworks7-cert-rtp-link.spec: Replace the definition of
	__wrs_rtp_base with the base_link spec.
	* vxworks7-cert-rtp-base-link.spec: Add base_link spec with
	__wrs_rtp_base definition for all architectures.
	* vxworks7-cert-rtp-base-link__ppc64.spec: Add base_link spec
	with __wrs_rtp_base definition for ppc64.
	* vxworks7-cert-rtp-base-link__x86.spec: Add base_link spec with
	__wrs_rtp_base definition for x86.
	* vxworks7-cert-rtp-base-link__x86_64.spec: Add base_link spec
	with __wrs_rtp_base definition for x86_64.
2021-11-09 09:44:49 +00:00
Piotr Trojanek 7751c73202 [Ada] Cleanup copying of parameter lists
gcc/ada/

	* sem_util.adb (Copy_Parameter_List): Refactor to remove
	repeated calls to First_Formal.
2021-11-09 09:44:48 +00:00
Piotr Trojanek b064f139e3 [Ada] Cleanup building of renamed equality
gcc/ada/

	* exp_ch8.adb (Build_Body_For_Renaming): Remove unnecessary
	calls to Sloc; set Handled_Statement_Sequence when building
	subprogram body; whitespace cleanup.
2021-11-09 09:44:48 +00:00
Piotr Trojanek b5f17bffea [Ada] Refine type in expansion of array equality
gcc/ada/

	* exp_ch4.adb (Handle_One_Dimension): Parameter N must be always
	positive, because it is translated into expression of 'First and
	'Last.
2021-11-09 09:44:48 +00:00
Piotr Trojanek e93e554454 [Ada] Simplify building of entity occurrences
gcc/ada/

	* tbuild.adb (New_Occurrence_Of): Simplify by reusing
	Make_Identifier.
2021-11-09 09:44:48 +00:00
Etienne Servais 0803fd245a [Ada] Return a valid value when handling Constraint_Error
gcc/ada/

	* scng.adb (Set_Start_Column): Return Column_Number'Last when
	handling Constraint_Error. Plus reformat a strangely 7 level if
	loop.
2021-11-09 09:44:48 +00:00
Piotr Trojanek 02ca2184cd [Ada] Simplify expansion of array equality
gcc/ada/

	* exp_ch4.adb (Test_Empty_Arrays): Simplify with Evolve_Or_Else;
	remove unnecessary call to Relocate_Node.
	(Test_Lengths_Correspond): Likewise.
2021-11-09 09:44:48 +00:00
Piotr Trojanek f4665dc4fb [Ada] Reference in Unbounded_String is almost never null
gcc/ada/

	* libgnat/a-strunb.adb (Deallocate): Rename Reference_Copy to
	Old, to make the code similar to other routines in this package.
	(Realloc_For_Chunk): Use a temporary, deallocate the previous
	string using a null-allowing copy of the string reference.
2021-11-09 09:44:48 +00:00
Ghjuvan Lacambre adc9410f95 [Ada] sem_util.adb: fix typos in Accessibility_Level docs
gcc/ada/

	* sem_util.adb (Accessibility_Level): Fix typos.
2021-11-09 09:44:47 +00:00
Tom Tromey 99c8e906b1 [Ada] Document the SuSE kernel bug
gcc/ada/

	* doc/gnat_ugn/platform_specific_information.rst: Document the
	SuSE kernel bug.
	* gnat_ugn.texi: Regenerate.
2021-11-09 09:44:47 +00:00
Gary Dismukes 64cb8ebef3 [Ada] Errors on globals in expressions of predicate aspects in generic bodies
gcc/ada/

	* sem_ch13.adb (Freeze_Entity_Checks): Analyze the expression of
	a pragma Predicate associated with an aspect at the freeze point
	of the type, to ensure that references to globals get saved when
	the aspect occurs within a generic body. Also, add
	Aspect_Static_Predicate to the choices of the membership test of
	the enclosing guard.
2021-11-09 09:44:47 +00:00
Piotr Trojanek 1275c4031a [Ada] Tune comment about expansion of array equality
gcc/ada/

	* exp_ch4.adb (Arr_Attr): Refine type of the parameter from Int
	to Pos; refine name of the parameter from Num to Dim; fix
	reference to "Expr" in comment.
2021-11-09 09:44:47 +00:00
Steve Baird c914810688 [Ada] Add missing regular expression syntax error check
gcc/ada/

	* libgnat/s-regexp.adb (Compile.Check_Well_Formed_Patern): When
	a "|" operator is encountered in a pattern, check that it is not
	the last character of the pattern.
2021-11-09 09:44:47 +00:00
Yannick Moy ea8726cac5 [Ada] Complete support for prefixed call on subtypes/derived types
gcc/ada/

	* sem_ch3.adb (Analyze_Subtype_Declaration,
	Derived_Type_Declaration): Initialize list of primitive
	operations when Extensions_Allowed.
2021-11-09 09:44:47 +00:00
Piotr Trojanek 51ad879c72 [Ada] Fix detection of array aggregates with single others associations
gcc/ada/

	* checks.adb (Apply_Constraint_Check): Guard against calling
	Choices when the first association in an array aggregate is a
	N_Iterated_Component_Association node.
2021-11-09 09:44:47 +00:00
Yannick Moy ca803c3d7b [Ada] Fix support for prefixed call with incomplete type declarations
gcc/ada/

	* sem_ch3.adb (Analyze_Incomplete_Type_Decl): Add the missing
	initialization.
2021-11-09 09:44:46 +00:00
Piotr Trojanek 9c8bb4d682 [Ada] Guard against illegal items in Global but not Depends
gcc/ada/

	* sem_prag.adb (Check_Usage): Guard against calling Usage_Error
	with illegal Item_Id. The intention to do this was already
	described in the comment but not implemented.
2021-11-09 09:44:46 +00:00
Etienne Servais 74e514af79 [Ada] Build activation chain for BIP only when needed
gcc/ada/

	* exp_ch6.adb (Expand_Actuals): Add a condition to check for the
	possibility of task.
2021-11-09 09:44:46 +00:00
Aldy Hernandez 6b8b959675 Convert strlen pass from evrp to ranger.
The following patch converts the strlen pass from evrp to ranger,
leaving DOM as the last remaining user.

No additional cleanups have been done.  For example, the strlen pass
still has uses of VR_ANTI_RANGE, and the sprintf still passes around
pairs of integers instead of using a proper range.  Fixing this
could further improve these passes.

Basically the entire patch is just adjusting the calls to range_of_expr
to include context.  The previous context of si->stmt was mostly
empty, so not really useful ;-).

With ranger we are now able to remove the range calculation from
before_dom_children entirely.  Just working with the ranger on-demand
catches all the strlen and sprintf testcases with the exception of
builtin-sprintf-warn-22.c which is due to a limitation of the sprintf
code.  I have XFAILed the test and documented what the problem is.

On a positive note, these changes found two possible sprintf overflow
bugs in the C++ and Fortran front-ends which I have fixed below.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-strlen.c (compare_nonzero_chars): Pass statement
	context to ranger.
	(get_addr_stridx): Same.
	(get_stridx): Same.
	(get_range_strlen_dynamic): Same.
	(handle_builtin_strlen): Same.
	(handle_builtin_strchr): Same.
	(handle_builtin_strcpy): Same.
	(maybe_diag_stxncpy_trunc): Same.
	(handle_builtin_stxncpy_strncat): Same.
	(handle_builtin_memcpy): Same.
	(handle_builtin_strcat): Same.
	(handle_alloc_call): Same.
	(handle_builtin_memset): Same.
	(handle_builtin_string_cmp): Same.
	(handle_pointer_plus): Same.
	(count_nonzero_bytes_addr): Same.
	(count_nonzero_bytes): Same.
	(handle_store): Same.
	(fold_strstr_to_strncmp): Same.
	(handle_integral_assign): Same.
	(check_and_optimize_stmt): Same.
	(class strlen_dom_walker): Replace evrp with ranger.
	(strlen_dom_walker::before_dom_children): Remove evrp.
	(strlen_dom_walker::after_dom_children): Remove evrp.
	* gimple-ssa-warn-access.cc (maybe_check_access_sizes):
	Restrict sprintf output.

gcc/cp/ChangeLog:

	* ptree.c (cxx_print_xnode): Add more space to pfx array.

gcc/fortran/ChangeLog:

	* misc.c (gfc_dummy_typename): Make sure ts->kind is
	non-negative.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/builtin-sprintf-warn-22.c: XFAIL.
2021-11-09 09:55:58 +01:00
Rasmus Villemoes cc6b8cd9a2 libstdc++: only define _GLIBCXX_HAVE_TLS for VxWorks >= 6.6
According to
https://gcc.gnu.org/legacy-ml/gcc-patches/2008-03/msg01698.html, the
TLS support, including the __tls_lookup function, was added to VxWorks
in 6.6.

It certainly doesn't exist on our VxWorks 5 platform, but the fallback
code in eh_globals.cc using __gthread_key_create() etc. used to work
just fine.

libstdc++-v3/ChangeLog:

	* config/os/vxworks/os_defines.h (_GLIBCXX_HAVE_TLS): Only
	define for VxWorks >= 6.6.
2021-11-09 09:51:08 +01:00
Martin Liska 69b6cce92e Fix clang -Wcast-qual warning.
gcc/ChangeLog:

	* genconditions.c (write_one_condition): Add const qualifier
	to pointer casting.
2021-11-09 09:46:09 +01:00
Jeff Law 2abd924f91 Minor optimization of variable bit testing
gcc/
	* match.pd: New pattern to simplify (1 << n) & M ==/!= 0 for M
	being a power of 2.

gcc/testsuite
	* gcc.dg/tree-ssa/bittest.c: New test
2021-11-08 23:23:34 -05:00
GCC Administrator 1bd89833d7 Daily bump. 2021-11-09 00:16:21 +00:00
Bill Schmidt 206c08ce28 rs6000: Add escape-newline support for builtins files
2021-11-08  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def (VEC_INIT_V16QI): Use
	escape-newline support.
	(VEC_INIT_V4SI): Likewise.
	(VEC_INIT_V8HI): Likewise.
	(PACK_V1TI): Likewise.
	(DIVDEU): Likewise.
	(VFIRSTMISMATCHOREOSINDEX_V16QI): Likewise.
	(VFIRSTMISMATCHOREOSINDEX_V8HI): Likewise.
	(VFIRSTMISMATCHOREOSINDEX_V4SI): Likewise.
	(CMPRB2): Likewise.
	(VSTDCP): Likewise.
	(VSIEDP): Likewise.
	(FMAF128_ODD): Likewise.
	(VSCEQPUO): Likewise.
	(VSIEQP): Likewise.
	(VSIEQPF): Likewise.
	(VSTDCQP): Likewise.
	(PACK_TD): Likewise.
	(TABORTDC): Likewise.
	(TABORTDCI): Likewise.
	(SE_LXVRBX): Likewise.
	(SE_LXVRHX): Likewise.
	(SE_LXVRWX): Likewise.
	(SE_LXVRDX): Likewise.
	(VREPLACE_UN_UV2DI): Likewise.
	(VREPLACE_UN_UV4SI): Likewise.
	(VREPLACE_UN_V2DI): Likewise.
	(VREPLACE_ELT_UV2DI): Likewise.
	(VREPLACE_ELT_V2DI): Likewise.
	(ZE_LXVRBX): Likewise.
	(ZE_LXVRHX): Likewise.
	(ZE_LXVRWX): Likewise.
	(ZE_LXVRDX): Likewise.
	(CFUGED): Likewise.
	(CNTLZDM): Likewise.
	(CNTTZDM): Likewise.
	(PDEPD): Likewise.
	(PEXTD): Likewise.
	(PMXVBF16GER2): Likewise.
	(PMXVBF16GER2_INTERNAL): Likewise.
	(PMXVBF16GER2NN): Likewise.
	(PMXVBF16GER2NN_INTERNAL): Likewise.
	(PMXVBF16GER2NP): Likewise.
	(PMXVBF16GER2NP_INTERNAL): Likewise.
	(PMXVBF16GER2PN): Likewise.
	(PMXVBF16GER2PN_INTERNAL): Likewise.
	(PMXVBF16GER2PP): Likewise.
	(PMXVBF16GER2PP_INTERNAL): Likewise.
	(PMXVF16GER2): Likewise.
	(PMXVF16GER2_INTERNAL): Likewise.
	(PMXVF16GER2NN): Likewise.
	(PMXVF16GER2NN_INTERNAL): Likewise.
	(PMXVF16GER2NP): Likewise.
	(PMXVF16GER2NP_INTERNAL): Likewise.
	(PMXVF16GER2PN): Likewise.
	(PMXVF16GER2PN_INTERNAL): Likewise.
	(PMXVF16GER2PP): Likewise.
	(PMXVF16GER2PP_INTERNAL): Likewise.
	(PMXVF32GER_INTERNAL): Likewise.
	(PMXVF32GERNN): Likewise.
	(PMXVF32GERNN_INTERNAL): Likewise.
	(PMXVF32GERNP): Likewise.
	(PMXVF32GERNP_INTERNAL): Likewise.
	(PMXVF32GERPN): Likewise.
	(PMXVF32GERPN_INTERNAL): Likewise.
	(PMXVF32GERPP): Likewise.
	(PMXVF32GERPP_INTERNAL): Likewise.
	(PMXVF64GER): Likewise.
	(PMXVF64GER_INTERNAL): Likewise.
	(PMXVF64GERNN): Likewise.
	(PMXVF64GERNN_INTERNAL): Likewise.
	(PMXVF64GERNP): Likewise.
	(PMXVF64GERNP_INTERNAL): Likewise.
	(PMXVF64GERPN): Likewise.
	(PMXVF64GERPN_INTERNAL): Likewise.
	(PMXVF64GERPP): Likewise.
	(PMXVF64GERPP_INTERNAL): Likewise.
	(PMXVI16GER2): Likewise.
	(PMXVI16GER2_INTERNAL): Likewise.
	(PMXVI16GER2PP): Likewise.
	(PMXVI16GER2PP_INTERNAL): Likewise.
	(PMXVI16GER2S): Likewise.
	(PMXVI16GER2S_INTERNAL): Likewise.
	(PMXVI16GER2SPP): Likewise.
	(PMXVI16GER2SPP_INTERNAL): Likewise.
	(PMXVI4GER8): Likewise.
	(PMXVI4GER8_INTERNAL): Likewise.
	(PMXVI4GER8PP): Likewise.
	(PMXVI4GER8PP_INTERNAL): Likewise.
	(PMXVI8GER4): Likewise.
	(PMXVI8GER4_INTERNAL): Likewise.
	(PMXVI8GER4PP): Likewise.
	(PMXVI8GER4PP_INTERNAL): Likewise.
	(PMXVI8GER4SPP): Likewise.
	(PMXVI8GER4SPP_INTERNAL): Likewise.
	* config/rs6000/rs6000-gen-builtins.c (MAXLINES): New macro.
	(linebuf): Increase size.
	(lines): New variable.
	(lastline): Likewise.
	(real_line_pos): New function.
	(diag): Change signature.
	(bif_diag): Change signature; support escape-newline handling.
	(ovld_diag): Likewise.
	(fatal): Move earlier.
	(consume_whitespace): Adjust diag call.
	(advance_line): Add escape-newline handling; call fatal.
	(safe_inc_pos): Adjust diag call.
	(match_identifier): Likewise.
	(match_integer): Likewise.
	(match_to_right_bracket): Call fatal instead of diag; adjust diag
	call.
	(match_basetype): Adjust diag calls.
	(match_bracketed_pair): Likewise.
	(match_const_restriction): Likewise.
	(match_type): Likewise.
	(parse_args): Likewise.
	(parse_bif_attrs): Likewise.
	(complete_vector_type): Likewise.
	(complete_base_type): Likewise.
	(parse_prototype): Likewise.
	(parse_bif_entry): Likewise.
	(parse_bif_stanza): Likewise.
	(parse_ovld_entry): Likewise.
	(parse_ovld_stanza): Likewise.
	(main): Allocate buffers for lines[].
2021-11-08 15:59:57 -06:00
Eric Botcazou 6c5fffd127 Fix couple of issues in large PIC model on x86-64/VxWorks
The first issue is that the !gotoff_operand path of legitimize_pic_address
in the large PIC model does not make use of REG when it is available, which
breaks for thunks because new pseudo-registers can no longer be created.
And the second issue is that the system compiler (LLVM) generates @GOTOFF
in large model even for RTP, so we do the same.

gcc/
	* config/i386/i386.c (legitimize_pic_address): Adjust comment and
	use the REG argument on the CM_LARGE_PIC code path as well.
	* config/i386/predicates.md (gotoff_operand): Do not treat VxWorks
	specially with the large code models.
2021-11-08 22:12:19 +01:00
Jan Hubicka d44d791012 Remove workaround allowing interposition of nested functions.
* gimple.c (gimple_call_static_chain_flags): Revert the workaround
	allowing interposition since issues with binds_to_local_def were
	hopefully solved.
2021-11-08 18:58:51 +01:00
Andrew MacLeod 0cd653bd25 Don't calculate new values when using the private context callback.
When using rangers private callback mechanism to provide context
to fold_stmt calls, we are only suppose to be using the cache in read
only mode, never calculate new values.

	gcc/
	PR tree-optimization/103122
	* gimple-range.cc (gimple_ranger::range_of_expr): Request the cache
	entry with "calulate new values" set to false.

	gcc/testsuite/
	* g++.dg/pr103122.C: New.
2021-11-08 12:48:57 -05:00
Jan Hubicka 33a7a63275 Improve handling of some builtins.
For nested functions we output call to builtin_dwarf_cfa which
initializes frame entry used only for debugging.  This however
prevents us from detecting functions containing nested functions
as const/pure or analyze side effects in modref.

builtin_dwarf_cfa is not documented and I wonder if it should be turned to
internal function. But I think we could consider functions using it const even
if in theory one can do things like test the return address and see the
difference between different frame addreses.

While doing so I also noticed that special_buitin_state handles quite few
builtins that are not special cased by ipa-modref.  They do not make
user visible loads/stores and thus I think they shoul dbe annotated by
".c" to make this explicit for both modref and PTA.

Finally I aded dwarf_cfa and similar return_address to list of simple
bulitins since it compiles to simple stack frame load (and we consider
simple other builtins doing so).

	* builtins.c (is_simple_builtin): Add builitin_dwarf_cfa
	and builtin_return_address.
	(builtin_fnspec): Annotate builtin_return,
	bulitin_eh_pointer, builtin_eh_filter, builtin_unwind_resume,
	builtin_cxa_end_cleanup, builtin_eh_copy_values,
	builtin_frame_address, builtin_apply_args,
	builtin_asan_before_dynamic_init, builtin_asan_after_dynamic_init,
	builtin_prefetch, builtin_dwarf_cfa, builtin_return_addrss
	as ".c"
	* ipa-pure-const.c (special_builtin_state): Add builtin_dwarf_cfa
	and builtin_return_address.
2021-11-08 18:40:17 +01:00
Jan Hubicka 666d780426 Move uncprop after modref
moveS uncprop after modref and pure/const pass and adds a comment that
this pass should alwasy be last since it is only supposed to help PHI lowering.
The pass replaces constant by SSA names that are known to be constant at the
place which hardly helps other passes.

gcc/ChangeLog:

	PR tree-optimization/103177
	* passes.def: Move uncprop after pure/const and modref.
2021-11-08 18:38:09 +01:00
Martin Jambor 239d82d4c0
ipa: Unshare expresseions before putting them into debug statements (PR 103099, PR 103107)
My recent patch to improve debug experience when there are removed
parameters (by ipa-sra or ipa-split) was not careful to unshare the
expressions that were then put into debug statements, which manifests
itself as PR 103099.  This patch adds unsharing them using
unshare_expr_without_location which is a bit more careful with stripping
locations than what we were doing manually and so also fixes PR 103107.

gcc/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103099
	PR ipa/103107
	* tree-inline.c (remap_gimple_stmt): Unshare the expression without
	location before invoking remap_with_debug_expressions on it.
	* ipa-param-manipulation.c
	(ipa_param_body_adjustments::prepare_debug_expressions): Likewise.

gcc/testsuite/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103099
	PR ipa/103107
	* g++.dg/ipa/pr103099.C: New test.
	* gcc.dg/ipa/pr103107.c: Likewise.
2021-11-08 17:52:51 +01:00
David Edelsohn a7dce7626a powerpc: Fix vsx_splat_v4si_di breakage on Power8.
The vsx_splat_v4si_di pattern uses a Power8 and a Power9 instruction.
The final condition of TARGET_DIRECT_MODE_64BIT implicitly requires Power8.
The "we" constraint requires Power9, but also requires 64 bit. Because
the DImode pattern already requires 64 bit mode, this isn't horrible,
but it would be best to remove all uses of "we" constraint.  The
mtvsrws instruction itself does not require 64 bit mode.

This patch reverts the previous change to fix the breakage.

gcc/ChangeLog:

	* config/rs6000/vsx.md (vsx_splat_v4si_di): Revert "wa"
	constraint to "we".
2021-11-08 11:46:47 -05:00
Richard Biener d626fe77cd Fix spurious valgrind errors in irred loop verification
The sbitmap bitmap_{set,clear}_bit changes trigger spurious
uninit value use reportings from valgrind since we now
read the old value before setting/clearing a bit so
verify_loop_structures optimization to not clear the sbitmap is reported.

Fixed by using a temporary BB flag which should also be more
efficient in terms of cache re-use.

2021-11-08  Richard Biener  <rguenther@suse.de>

	* cfgloop.c (verify_loop_structure): Use a temporary BB flag
	instead of an sbitmap to cache irreducible state.
2021-11-08 16:19:35 +01:00
Aldy Hernandez 18546941ae path solver: Avoid recalculating ranges already in the cache.
The problem here is an ordering issue with a path that starts
with 19->3:

 <bb 3> [local count: 916928331]:
  # value_20 = PHI <value_17(19), value_7(D)(17)>
  # n_27 = PHI <n_16(19), 1(17)>
  n_16 = n_27 + 4;
  value_17 = value_20 / 10000;
  if (value_20 > 42949672959999)
    goto <bb 19>; [89.00%]
  else
    goto <bb 4>; [11.00%]

The problem here is that both value_17 and value_20 are in the set of
imports we must pre-calculate.  The value_17 name occurs first in the
bitmap, so we try to resolve it first, which causes us to recursively
solve the value_20 range.  We do so correctly and put them both in the
cache.  However, when we try to solve value_20 from the bitmap, we
ignore that it already has a cached entry and try to resolve the PHI
with the wrong value of value_17:

  # value_20 = PHI <value_17(19), value_7(D)(17)>

The right thing to do is to avoid recalculating definitions already
solved.

Regstrapped and checked for # threads before and after on x86-64 Linux.

gcc/ChangeLog:

	PR tree-optimization/103120
	* gimple-range-path.cc (path_range_query::range_defined_in_block):
	Bail if there's a cache entry.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr103120.c: New test.
2021-11-08 16:08:09 +01:00
Bill Schmidt a354b4255b rs6000: Miscellaneous uses of rs6000_builtins_decl_x
There are a few leftover places where we use the old rs6000_builtins_decl
array, but we need to use rs6000_builtins_decl_x instead when the new
builtins infrastructure is in play.

2021-11-08  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000.c (rs6000_builtin_reciprocal): Use
	rs6000_builtin_decls_x when appropriate.
	(add_condition_to_bb): Likewise.
	(rs6000_atomic_assign_expand_fenv): Likewise.
2021-11-08 08:49:45 -06:00