Commit Graph

189525 Commits

Author SHA1 Message Date
Richard Sandiford
5720a9d5be vect: Hookize better_loop_vinfo_p
One of the things we want to do on AArch64 is compare vector loops
side-by-side and pick the best one.  For some targets, we want this
to be based on issue rates as well as the usual latency-based costs
(at least for loops with relatively high iteration counts).

The current approach to doing this is: when costing vectorisation
candidate A, try to guess what the other main candidate B will look
like and adjust A's latency-based cost up or down based on the likely
difference between A and B's issue rates.  This effectively means
that we try to cost parts of B at the same time as A, without actually
being able to see B.

This is needlessly indirect and complex.  It was a compromise due
to the code being added (too) late in the GCC 11 cycle, so that
target-independent changes weren't possible.

The target-independent code already compares two candidate loop_vec_infos
side-by-side, so that information about A and B above are available
directly.  This patch creates a way for targets to hook into this
comparison.

The AArch64 code can therefore hook into better_main_loop_than_p to
compare issue rates.  If the issue rate comparison isn't decisive,
the code can fall back to the normal latency-based comparison instead.

gcc/
	* tree-vectorizer.h (vector_costs::better_main_loop_than_p)
	(vector_costs::better_epilogue_loop_than_p)
	(vector_costs::compare_inside_loop_cost)
	(vector_costs::compare_outside_loop_cost): Likewise.
	* tree-vectorizer.c (vector_costs::better_main_loop_than_p)
	(vector_costs::better_epilogue_loop_than_p)
	(vector_costs::compare_inside_loop_cost)
	(vector_costs::compare_outside_loop_cost): New functions,
	containing code moved from...
	* tree-vect-loop.c (vect_better_loop_vinfo_p): ...here.
2021-11-10 12:31:01 +00:00
Richard Sandiford
772d76acb5 vect: Remove vec_outside/inside_cost fields
The vector costs now use a common base class instead of being
completely abstract.  This means that there's no longer a
need to record the inside and outside costs separately.

gcc/
	* tree-vectorizer.h (_loop_vec_info): Remove vec_outside_cost
	and vec_inside_cost.
	(vector_costs::outside_cost): New function.
	* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Update
	after above.
	(vect_estimate_min_profitable_iters): Likewise.
	(vect_better_loop_vinfo_p): Get the inside and outside costs
	from the loop_vec_infos' vector_costs.
2021-11-10 12:31:00 +00:00
Richard Sandiford
4725f62789 vect: Move vector costs to loop_vec_info
target_cost_data is in vec_info but is really specific to
loop_vec_info.  This patch moves it there and renames it to
vector_costs, to distinguish it from scalar target costs.

gcc/
	* tree-vectorizer.h (vec_info::target_cost_data): Replace with...
	(_loop_vec_info::vector_costs): ...this.
	(LOOP_VINFO_TARGET_COST_DATA): Delete.
	* tree-vectorizer.c (vec_info::vec_info): Remove target_cost_data
	initialization.
	(vec_info::~vec_info): Remove corresponding delete.
	* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
	vector_costs to null.
	(_loop_vec_info::~_loop_vec_info): Delete vector_costs.
	(vect_analyze_loop_operations): Update after above changes.
	(vect_analyze_loop_2): Likewise.
	(vect_estimate_min_profitable_iters): Likewise.
	* tree-vect-slp.c (vect_slp_analyze_operations): Likewise.
2021-11-10 12:31:00 +00:00
Jan Hubicka
d70ef65692 Make EAF flags more regular (and expressive)
I hoped that I am done with EAF flags related changes, but while looking into
the Fortran testcases I noticed that I have designed them in unnecesarily
restricted way.  I followed the scheme of NOESCAPE and NODIRECTESCAPE which is
however the only property tht is naturally transitive.

This patch replaces the existing flags by 9 flags:

EAF_UNUSED
EAF_NO_DIRECT_CLOBBER and EAF_NO_INDIRECT_CLOBBER
EAF_NO_DIRECT_READ and EAF_NO_INDIRECT_READ
EAF_NO_DIRECT_ESCAPE and EAF_NO_INDIRECT_ESCAPE
EAF_NO_DIRECT_READ and EAF_NO_INDIRECT_READ

So I have removed the unified EAF_DIRECT flag and made each of the flags to come
in direct and indirect variant.  Newly the indirect variant is not implied by direct
(well except for escape but it is not special cased in the code)
Consequently we can analyse i.e. the case where function reads directly and clobber
indirectly as in the following testcase:

struct wrap {
	void **array;
};
__attribute__ ((noinline))
void
write_array (struct wrap *ptr)
{
	ptr->array[0]=0;
}
int
test ()
{
	void *arrayval;
	struct wrap w = {&arrayval};
	write_array (&w);
	return w.array == &arrayval;
}

This is pretty common in array descriptors and also C++ pointer wrappers or structures
containing pointers to arrays.

Other advantage is that !binds_to_current_def_p functions we can still track the fact
that the value is not clobbered indirectly while previously we implied EAF_DIRECT
for all three cases.

Finally the propagation becomes more regular and I hope easier to understand
because the flags are handled in a symmetric way.

In tree-ssa-structalias I now produce "callarg" var_info as before and if necessary
also "indircallarg" for the indirect accesses.  I added some logic to optimize the
common case where we can not make difference between direct and indirect.

gcc/ChangeLog:

2021-11-09  Jan Hubicka  <hubicka@ucw.cz>

	* tree-core.h (EAF_DIRECT): Remove.
	(EAF_NOCLOBBER): Remove.
	(EAF_UNUSED): Remove.
	(EAF_NOESCAPE): Remove.
	(EAF_NO_DIRECT_CLOBBER): New.
	(EAF_NO_INDIRECT_CLOBBER): New.
	(EAF_NODIRECTESCAPE): Remove.
	(EAF_NO_DIRECT_ESCAPE): New.
	(EAF_NO_INDIRECT_ESCAPE): New.
	(EAF_NOT_RETURNED): Remove.
	(EAF_NOT_RETURNED_INDIRECTLY): New.
	(EAF_NOREAD): Remove.
	(EAF_NO_DIRECT_READ): New.
	(EAF_NO_INDIRECT_READ): New.
	* gimple.c (gimple_call_arg_flags): Update for new flags.
	(gimple_call_retslot_flags): Update for new flags.
	* ipa-modref.c (dump_eaf_flags): Likewise.
	(remove_useless_eaf_flags): Likewise.
	(deref_flags): Likewise.
	(modref_lattice::init): Likewise.
	(modref_lattice::merge): Likewise.
	(modref_lattice::merge_direct_load): Likewise.
	(modref_lattice::merge_direct_store): Likewise.
	(modref_eaf_analysis::merge_call_lhs_flags): Likewise.
	(callee_to_caller_flags): Likewise.
	(modref_eaf_analysis::analyze_ssa_name): Likewise.
	(modref_eaf_analysis::propagate): Likewise.
	(modref_merge_call_site_flags): Likewise.
	* ipa-modref.h (interposable_eaf_flags): Likewise.
	* tree-ssa-alias.c: (ref_maybe_used_by_call_p_1) Likewise.
	* tree-ssa-structalias.c (handle_call_arg): Likewise.
	(handle_rhs_call): Likewise.
	* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ipa/modref-1.C: Update template.
	* gcc.dg/ipa/modref-3.c: Update template.
	* gcc.dg/lto/modref-3_0.c: Update template.
	* gcc.dg/lto/modref-4_0.c: Update template.
	* gcc.dg/tree-ssa/modref-10.c: Update template.
	* gcc.dg/tree-ssa/modref-11.c: Update template.
	* gcc.dg/tree-ssa/modref-5.c: Update template.
	* gcc.dg/tree-ssa/modref-6.c: Update template.
	* gcc.dg/tree-ssa/modref-13.c: New test.
2021-11-10 13:08:41 +01:00
Tamar Christina
0cf6065ce4 testsuite: change vect_long to vect_long_long in complex tests.
These tests are still failing on SPARC and it looks like this is because I need
to use vect_long_long instead of vect_long.

gcc/testsuite/ChangeLog:

	PR testsuite/103042
	* gcc.dg/vect/complex/bb-slp-complex-add-pattern-long.c: Use
	vect_long_long instead of vect_long.
	* gcc.dg/vect/complex/bb-slp-complex-add-pattern-unsigned-long.c:
	Likewise.
	* gcc.dg/vect/complex/vect-complex-add-pattern-long.c: Likewise.
	* gcc.dg/vect/complex/vect-complex-add-pattern-unsigned-long.c:
	Likewise.
2021-11-10 12:05:50 +00:00
Tamar Christina
92617a8e2a middle-end: Fix signbit tests when ran on ISA with support for masks.
These test don't work on vector ISAs where the truth
type don't match the vector mode of the operation.

However I still want the tests to run on these
architectures but just turn off the ISA modes that
enable masks.

This thus turns off SVE is it's on and turns off
AVX512 if it's on.

gcc/testsuite/ChangeLog:

	* gcc.dg/signbit-2.c: Turn off masks.
	* gcc.dg/signbit-5.c: Likewise.
2021-11-10 12:05:50 +00:00
Tamar Christina
5cfa174e08 vect: remove unused variable in complex numbers detection code.
This removed an unused variable that clang seems to catch when
compiling GCC with Clang.

gcc/ChangeLog:

	* tree-vect-slp-patterns.c (complex_mul_pattern::matches): Remove l1node.
2021-11-10 12:05:49 +00:00
Jonathan Wakely
77963796ae libstdc++: Fix test for libstdc++ not including <unistd.h> [PR100117]
The <cxxx> headers for the C library are not under our control, so we
can't prevent them from including <unistd.h>. Change the PR 49745 test
to only include the C++ library headers, not the <cxxx> ones.

To ensure <bits/stdc++.h> isn't included automatically we need to use
no_pch to disable PCH.

libstdc++-v3/ChangeLog:

	PR libstdc++/100117
	* testsuite/17_intro/headers/c++1998/49745.cc: Explicitly list
	all C++ headers instead of including <bits/stdc++.h>
2021-11-10 12:03:29 +00:00
Jonathan Wakely
80fe172ba9 libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
Since Glibc 2.34 all pthreads symbols are defined directly in libc not
libpthread, and since Glibc 2.32 we have used __libc_single_threaded to
avoid unnecessary locking in single-threaded programs. This means there
is no reason to avoid linking to libpthread now, and so no reason to use
weak symbols defined in gthr-posix.h for all the pthread_xxx functions.

libstdc++-v3/ChangeLog:

	PR libstdc++/100748
	PR libstdc++/103133
	* config/os/gnu-linux/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
	Define for glibc 2.34 and later.
2021-11-10 12:01:27 +00:00
Richard Biener
b2cd32b743 testsuite/102690 - XFAIL g++.dg/warn/Warray-bounds-16.C
This XFAILs the bogus diagnostic test and rectifies the expectation
on the optimization.

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

	PR testsuite/102690
	* g++.dg/warn/Warray-bounds-16.C: XFAIL diagnostic part
	and optimization.
2021-11-10 11:09:56 +01:00
Andre Vieira
0f68560161 [AArch64] Fix TBAA information when lowering NEON loads and stores to gimple
This patch fixes the wrong TBAA information when lowering NEON loads and stores
to gimple that showed up when bootstrapping with UBSAN.

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c
	(aarch64_general_gimple_fold_builtin): Change pointer alignment and
	alias.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/simd/lowering_tbaa.c: New test.
2021-11-10 09:52:49 +00:00
Andre Vieira
02fb5732ff [AArch64] Fix big-endian testisms introduced by NEON gimple lowering patch
This patch reverts the tests for big-endian after the NEON gimple lowering
patch.  The earlier patch only lowers NEON loads and stores for little-endian,
meaning the codegen now differs between endinanness so we need target specific
testing.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/fmla_intrinsic_1.c: Fix big-endian testism.
	* gcc.target/aarch64/fmls_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/fmul_intrinsic_1.c: Likewise.
2021-11-10 09:51:53 +00:00
Jan Hubicka
b406bb901f Fix modref_tree::remap_params
gcc/ChangeLog:

	* ipa-modref-tree.h (modref_tree::remap_params): Fix off-by-one error.
2021-11-10 10:28:34 +01:00
Jakub Jelinek
75ef0353a2 rs6000, libgcc: Fix up -Wmissing-prototypes warning on rs6000/linux-unwind.h
Jonathan reported and I've verified a
In file included from ../../../libgcc/unwind-dw2.c:412:
./md-unwind-support.h:398:6: warning: no previous prototype for ‘ppc_backchain_fallback’ [-Wmissing-prototypes]
  398 | void ppc_backchain_fallback (struct _Unwind_Context *context, void *a)
      |      ^~~~~~~~~~~~~~~~~~~~~~
warning on powerpc*-linux* libgcc build.

All the other MD_* macro functions are static, so I think the following
is the right thing rather than adding a previous prototype for
ppc_backchain_fallback.

2021-11-10  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/linux-unwind.h (ppc_back_fallback): Make it static,
	formatting fix.
2021-11-10 10:24:49 +01:00
liuhongt
fb16178254 Improve integer bit test on __atomic_fetch_[or|and]_* returns
commit adedd5c173
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 3 13:37:25 2016 +0200

    re PR target/49244 (__sync or __atomic builtins will not emit 'lock bts/btr/btc')

optimized bit test on __atomic_fetch_or_* and __atomic_fetch_and_* returns
with lock bts/btr/btc by turning

  mask_2 = 1 << cnt_1;
  _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
  _5 = _4 & mask_2;

into

  _4 = ATOMIC_BIT_TEST_AND_SET (ptr_6, cnt_1, 0, _3);
  _5 = _4;

and

  mask_6 = 1 << bit_5(D);
  _1 = ~mask_6;
  _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
  _3 = _2 & mask_6;
  _4 = _3 != 0;

into

  mask_6 = 1 << bit_5(D);
  _1 = ~mask_6;
  _11 = .ATOMIC_BIT_TEST_AND_RESET (v_8(D), bit_5(D), 1, 0);
  _4 = _11 != 0;

But it failed to optimize many equivalent, but slighly different cases:

1.
  _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
  _4 = (_Bool) _1;
2.
  _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
  _4 = (_Bool) _1;
3.
  _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
  _7 = ~_1;
  _5 = (_Bool) _7;
4.
  _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
  _7 = ~_1;
  _5 = (_Bool) _7;
5.
  _1 = __atomic_fetch_or_4 (ptr_6, 1, _3);
  _2 = (int) _1;
  _7 = ~_2;
  _5 = (_Bool) _7;
6.
  _1 = __atomic_fetch_and_4 (ptr_6, ~1, _3);
  _2 = (int) _1;
  _7 = ~_2;
  _5 = (_Bool) _7;
7.
  _1 = __atomic_fetch_or_4 (ptr_6, 0x80000000, _3);
  _5 = (signed int) _1;
  _4 = _5 < 0;
8.
  _1 = __atomic_fetch_and_4 (ptr_6, 0x7fffffff, _3);
  _5 = (signed int) _1;
  _4 = _5 < 0;
9.
  _1 = 1 << bit_4(D);
  mask_5 = (unsigned int) _1;
  _2 = __atomic_fetch_or_4 (v_7(D), mask_5, 0);
  _3 = _2 & mask_5;
10.
  mask_7 = 1 << bit_6(D);
  _1 = ~mask_7;
  _2 = (unsigned int) _1;
  _3 = __atomic_fetch_and_4 (v_9(D), _2, 0);
  _4 = (int) _3;
  _5 = _4 & mask_7;

We make

  mask_2 = 1 << cnt_1;
  _4 = __atomic_fetch_or_* (ptr_6, mask_2, _3);
  _5 = _4 & mask_2;

and

  mask_6 = 1 << bit_5(D);
  _1 = ~mask_6;
  _2 = __atomic_fetch_and_4 (v_8(D), _1, 0);
  _3 = _2 & mask_6;
  _4 = _3 != 0;

the canonical forms for this optimization and transform cases 1-9 to the
equivalent canonical form.  For cases 10 and 11, we simply remove the cast
before __atomic_fetch_or_4/__atomic_fetch_and_4 with

  _1 = 1 << bit_4(D);
  _2 = __atomic_fetch_or_4 (v_7(D), _1, 0);
  _3 = _2 & _1;

and

  mask_7 = 1 << bit_6(D);
  _1 = ~mask_7;
  _3 = __atomic_fetch_and_4 (v_9(D), _1, 0);
  _6 = _3 & mask_7;
  _5 = (int) _6;

2021-11-04  H.J. Lu  <hongjiu.lu@intel.com>
	    Hongtao Liu  <hongtao.liu@intel.com>
gcc/

	PR middle-end/102566
	* match.pd (nop_atomic_bit_test_and_p): New match.
	* tree-ssa-ccp.c (convert_atomic_bit_not): New function.
	(gimple_nop_atomic_bit_test_and_p): New prototype.
	(optimize_atomic_bit_test_and): Transform equivalent, but slighly
	different cases to their canonical forms.

gcc/testsuite/

	PR middle-end/102566
	* g++.target/i386/pr102566-1.C: New test.
	* g++.target/i386/pr102566-2.C: Likewise.
	* g++.target/i386/pr102566-3.C: Likewise.
	* g++.target/i386/pr102566-4.C: Likewise.
	* g++.target/i386/pr102566-5a.C: Likewise.
	* g++.target/i386/pr102566-5b.C: Likewise.
	* g++.target/i386/pr102566-6a.C: Likewise.
	* g++.target/i386/pr102566-6b.C: Likewise.
	* gcc.target/i386/pr102566-1a.c: Likewise.
	* gcc.target/i386/pr102566-1b.c: Likewise.
	* gcc.target/i386/pr102566-2.c: Likewise.
	* gcc.target/i386/pr102566-3a.c: Likewise.
	* gcc.target/i386/pr102566-3b.c: Likewise.
	* gcc.target/i386/pr102566-4.c: Likewise.
	* gcc.target/i386/pr102566-5.c: Likewise.
	* gcc.target/i386/pr102566-6.c: Likewise.
	* gcc.target/i386/pr102566-7.c: Likewise.
	* gcc.target/i386/pr102566-8a.c: Likewise.
	* gcc.target/i386/pr102566-8b.c: Likewise.
	* gcc.target/i386/pr102566-9a.c: Likewise.
	* gcc.target/i386/pr102566-9b.c: Likewise.
	* gcc.target/i386/pr102566-10a.c: Likewise.
	* gcc.target/i386/pr102566-10b.c: Likewise.
	* gcc.target/i386/pr102566-11.c: Likewise.
	* gcc.target/i386/pr102566-12.c: Likewise.
	* gcc.target/i386/pr102566-13.c: New test.
	* gcc.target/i386/pr102566-14.c: New test.
2021-11-10 17:16:42 +08:00
Eric Botcazou
f15ad1e3f9 [Ada] Minor cleanup in translation of calls to subprograms
gcc/ada/

	* gcc-interface/ada-tree.h (DECL_STUBBED_P): Delete.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set it.
	* gcc-interface/trans.c (Call_to_gnu): Use GNAT_NAME local variable
	and adjust accordingly.  Replace test on DECL_STUBBED_P with direct
	test on Convention and move it down in the processing.
2021-11-10 08:57:43 +00:00
Bob Duff
0e988162f6 [Ada] Warn for bidirectional characters
gcc/ada/

	* scng.adb (Check_Bidi): New procedure to give warning. Note
	that this is called only for non-ASCII characters, so should not
	be an efficiency issue.
	(Slit): Call Check_Bidi for wide characters in string_literals.
	(Minus_Case): Call Check_Bidi for wide characters in comments.
	(Char_Literal_Case): Call Check_Bidi for wide characters in
	character_literals.  Move Accumulate_Checksum down, because
	otherwise, if Err is True, the Code is uninitialized.
	* errout.ads: Make the obsolete nature of "Insertion character
	?" more prominent; one should not have to read several
	paragraphs before finding out that it's obsolete.
2021-11-10 08:57:42 +00:00
Bob Duff
76a71469f3 [Ada] Avoid warnings regarding rep clauses in generics -- follow-on
gcc/ada/

	* repinfo.adb (List_Component_Layout): Initialize Sbit.
2021-11-10 08:57:42 +00:00
Piotr Trojanek
ab6101146d [Ada] Fix comments about expansion of array equality
gcc/ada/

	* exp_ch4.adb (Expand_Array_Equality): Fix inconsistent casing
	in comment about the template for expansion of array equality;
	now we use lower case for true/false/boolean.
	(Handle_One_Dimension): Fix comment about the template for
	expansion of array equality.
2021-11-10 08:57:42 +00:00
Bob Duff
db778c7022 [Ada] Avoid warnings regarding rep clauses in generics
gcc/ada/

	* repinfo.adb (List_Common_Type_Info, List_Object_Info): Add
	check for In_Generic_Scope.
	(List_Component_Layout): Check for known static values.
	* sem_ch13.adb (Check_Record_Representation_Clause): Add check
	for In_Generic_Scope.
2021-11-10 08:57:41 +00:00
Etienne Servais
5fc6b47ac6 [Ada] ACATS BDC1002 shall not error on arbitrary aspect
gcc/ada/

	* aspects.adb, aspects.ads (Is_Aspect_Id): New function.
	* namet-sp.ads, namet-sp.adb (Aspect_Spell_Check,
	Attribute_Spell_Check): New Functions.
	* par-ch13.adb (Possible_Misspelled_Aspect): Removed.
	(With_Present): Use Aspect_Spell_Check, use Is_Aspect_Id.
	(Get_Aspect_Specifications): Use Aspect_Spell_Check,
	Is_Aspect_Id, Bad_Aspect.
	* par-sync.adb (Resync_Past_Malformed_Aspect): Use Is_Aspect_Id.
	* sem_ch13.adb (Check_One_Attr): Use Is_Aspect_Id.
	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Introduce the Process_No_Specification_Of_Aspect, emit a warning
	instead of an error on unknown aspect, hint for typos.
	Introduce Process_No_Use_Of_Attribute to add spell check for
	attributes too.
	(Set_Error_Msg_To_Profile_Name): Use Is_Aspect_Id.
	* sem_util.adb (Bad_Attribute): Use Attribute_Spell_Check.
	(Bad_Aspect): New function.
	* sem_util.ads (Bad_Aspect): New function.
2021-11-10 08:57:41 +00:00
Patrick Bernardi
3015264887 [Ada] Do not assume a priority value of zero is a valid priority
gcc/ada/

	* libgnarl/s-taskin.adb (Initialize_ATCB): Initialize
	T.Common.Current_Priority to Priority'First.
	* libgnarl/s-taskin.ads (Unspecified_Priority): Redefined as -1.
	* libgnat/system-rtems.ads: Start priority range from 1, as 0 is
	reserved by the operating system.
2021-11-10 08:57:41 +00:00
Pierre-Alexandre Bazin
bbe3c88351 [Ada] Prove double precision integer arithmetic unit
gcc/ada/

	* libgnat/a-nbnbig.ads: Mark the unit as Pure.
	* libgnat/s-aridou.adb: Add contracts and ghost code for proof.
	(Scaled_Divide): Reorder operations and use of temporaries in
	two places to facilitate proof.
	* libgnat/s-aridou.ads: Add full functional contracts.
	* libgnat/s-arit64.adb: Mark in SPARK.
	* libgnat/s-arit64.ads: Add contracts similar to those from
	s-aridou.ads.
	* rtsfind.ads: Document the limitation that runtime units
	loading does not work for private with-clauses.
2021-11-10 08:57:40 +00:00
Piotr Trojanek
99f8a65368 [Ada] Don't carry action bodies for expansion of array equality
gcc/ada/

	* exp_ch3.adb (Make_Eq_Body): Adapt call to
	Expand_Record_Equality.
	* exp_ch4.ads, exp_ch4.adb (Expand_Composite_Equality): Remove
	Bodies parameter; adapt comment; fix style in body; adapt calls
	to Expand_Record_Equality.
	(Expand_Array_Equality): Adapt calls to
	Expand_Composite_Equality.
	(Expand_Record_Equality): Remove Bodies parameter; adapt
	comment; adapt call to Expand_Composite_Equality.
	* exp_ch8.adb (Build_Body_For_Renaming): Adapt call to
	Expand_Record_Equality.
2021-11-10 08:57:40 +00:00
Piotr Trojanek
0c66423ac9 [Ada] Use predefined equality for arrays inside records
gcc/ada/

	* exp_ch4.adb (Expand_Composite_Equality): Handle arrays inside
	records just like scalars; only records inside records need
	dedicated handling.
2021-11-10 08:57:40 +00:00
Eric Botcazou
55a213950e [Ada] Fix oversight in latest change to Has_Compatible_Type
gcc/ada/

	* sem_type.ads (Has_Compatible_Type): Add For_Comparison parameter.
	* sem_type.adb (Has_Compatible_Type): Put back the reversed calls
	to Covers guarded with For_Comparison.
	* sem_ch4.adb (Analyze_Membership_Op) <Try_One_Interp>: Remove new
	reversed call to Covers and set For_Comparison to true instead.
	(Find_Comparison_Types) <Try_One_Interp>: Likewise
	(Find_Equality_Types) <Try_One_Interp>: Likewise.
2021-11-10 08:57:39 +00:00
Yannick Moy
94396a27bc [Ada] Create explicit ghost mirror unit for big integers
gcc/ada/

	* Makefile.rtl: Add unit.
	* libgnat/a-nbnbin__ghost.adb: Move...
	* libgnat/a-nbnbig.adb: ... here. Mark ghost as ignored.
	* libgnat/a-nbnbin__ghost.ads: Move...
	* libgnat/a-nbnbig.ads: ... here.  Add comment for purpose of
	this unit. Mark ghost as ignored.
	* libgnat/s-widthu.adb: Use new unit.
	* sem_aux.adb (First_Subtype): Adapt to the case of a ghost type
	whose freeze node is rewritten to a null statement.
2021-11-10 08:57:39 +00:00
Etienne Servais
a0546e1a16 [Ada] Fix Constraint error on rexgexp close bracket find algorithm
gcc/ada/

	* libgnat/s-regexp.adb (Check_Well_Formed_Pattern): Fix
	Constraint_Error on missing close bracket.
2021-11-10 08:57:39 +00:00
Piotr Trojanek
7eafa54f12 [Ada] Extend optimized equality of 2-element arrays
gcc/ada/

	* exp_ch4.adb (Expand_Array_Equality): Remove check of the array
	bound being an N_Range node; use Type_High_Bound/Type_Low_Bound,
	which handle all kinds of array bounds.
2021-11-10 08:57:38 +00:00
Etienne Servais
f51d1dde83 [Ada] Warn when interfaces swapped between full and partial view
gcc/ada/

	* sem_ch3.adb (Derived_Type_Declaration): Introduce a subprogram
	for tree transformation. If a tree transformation is performed,
	then warn that it would be better to reorder the interfaces.
2021-11-10 08:57:38 +00:00
Eric Botcazou
8c787be254 [Ada] Add guard against previous error for peculiar ACATS test
gcc/ada/

	* sem_ch4.adb (Find_Non_Universal_Interpretations): Add guard.
2021-11-10 08:57:38 +00:00
Yannick Moy
29900c061a [Ada] Better error message on missing parentheses
gcc/ada/

	* par-ch4.adb (P_Primary): Adapt test for getting error message
	on missing parentheses.
2021-11-10 08:57:37 +00:00
liuhongt
249b4eeef1 Extend is_cond_scalar_reduction to handle bit_and/bit_xor/bit_ior.
This will enable transformation like

-  # sum1_50 = PHI <prephitmp_64(13), 0(4)>
-  # sum2_52 = PHI <sum2_21(13), 0(4)>
+  # sum1_50 = PHI <_87(13), 0(4)>
+  # sum2_52 = PHI <_89(13), 0(4)>
   # ivtmp_62 = PHI <ivtmp_61(13), 64(4)>
   i.2_7 = (long unsigned int) i_49;
   _8 = i.2_7 * 8;
...
   vec1_i_38 = vec1_29 >> _10;
   vec2_i_39 = vec2_31 >> _10;
   _11 = vec1_i_38 & 1;
-  _63 = tmp_37 ^ sum1_50;
-  prephitmp_64 = _11 == 0 ? sum1_50 : _63;
+  _ifc__86 = _11 != 0 ? tmp_37 : 0;
+  _87 = sum1_50 ^ _ifc__86;
   _12 = vec2_i_39 & 1;
:

so that vectorizer won't failed due to

  /* If this isn't a nested cycle or if the nested cycle reduction value
     is used ouside of the inner loop we cannot handle uses of the reduction
     value.  */
  if (nlatch_def_loop_uses > 1 || nphi_def_loop_uses > 1)
    {
      if (dump_enabled_p ())
	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
			 "reduction used in loop.\n");
      return NULL;
    }

gcc/ChangeLog:

	PR tree-optimization/103126
	* tree-vect-loop.c (neutral_op_for_reduction): Remove static.
	* tree-vectorizer.h (neutral_op_for_reduction): Declare.
	* tree-if-conv.c : Include tree-vectorizer.h.
	(is_cond_scalar_reduction): Handle
	BIT_XOR_EXPR/BIT_IOR_EXPR/BIT_AND_EXPR.
	(convert_scalar_cond_reduction): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/ifcvt-reduction-logic-op.c: New test.
2021-11-10 16:28:42 +08:00
konglin1
f2572a398d i386: Support complex fma/conj_fma for _Float16.
Support cmla_optab, cmul_optab, cmla_conj_optab, cmul_conj_optab for vector _Float16.

gcc/ChangeLog:

	* config/i386/sse.md (cmul<conj_op><mode>3): add new define_expand.
	(cmla<conj_op><mode>4): Likewise

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-vector-complex-float.c: New test.
2021-11-10 15:10:23 +08:00
Aldy Hernandez
9299f69027 Remove unused gimple-ssa-evr-analyze.h header file.
gcc/ChangeLog:

	* tree-ssa-threadedge.c: Do not include
	gimple-ssa-evrp-analyze.h.
	* value-pointer-equiv.cc: Same.
2021-11-10 08:04:08 +01:00
Aldy Hernandez
a2ab1a5ade Include PHI threading restrictions in backthreader diagnostics.
I forgot to include the path dump when failing a path in resolve_phi.
To do so I abstracted dump_path into its own function, which made me
realize we had another copy with slightly different output.

I've merged everything and cleaned it up.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c
	(back_threader::maybe_register_path_dump): Abstract path dumping...
	(dump_path): ...here.
	(back_threader::resolve_phi): Call dump_path.
	(debug): Same.
2021-11-10 07:46:59 +01:00
konglin1
60e3179b7a i386: Optimization for mm512_set1_pch.
This patch is to support fold _mm512_fmadd_pch (a, _mm512_set1_pch(*(b)), c)
to 1 instruction vfmaddcph (%rsp){1to16}, %zmm1, %zmm2;

gcc/ChangeLog:

	* config/i386/sse.md (fma_<complexpairopname>_<mode>_pair):
	Add new define_insn.
	(fma_<mode>_fmaddc_bcst): Add new define_insn_and_split.
	(fma_<mode>_fcmaddc_bcst): Likewise

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16vl-complex-broadcast-1.c: New test.
2021-11-10 14:36:59 +08:00
liuhongt
b879d40a17 Simplify (trunc)MAX/MIN((extend)a, (extend)b) to MAX/MIN(a,b)
a and b are same type as trunc type and has less precision than
extend type.

gcc/ChangeLog:

	PR target/102464
	* match.pd: Simplify (trunc)fmax/fmin((extend)a, (extend)b) to
	MAX/MIN(a,b)

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr102464-maxmin.c: New test.
2021-11-10 14:31:22 +08:00
Andrew Pinski
52fa771758 aarch64: [PR101529] Fix vector shuffle insertion expansion
The function aarch64_evpc_ins would reuse the target even though
it might be the same register as the two inputs.
Instead of checking to see if we can reuse the target, just use the
original input directly.

Committed as approved after bootstrapped and tested on
aarch64-linux-gnu with no regressions.

	PR target/101529

gcc/ChangeLog:

	* config/aarch64/aarch64.c (aarch64_evpc_ins): Don't use target
	as an input, use original one.

gcc/testsuite/ChangeLog:

	* c-c++-common/torture/builtin-convertvector-2.c: New test.
	* c-c++-common/torture/builtin-shufflevector-2.c: New test.
2021-11-10 04:06:54 +00:00
Sandra Loosemore
d581cf9c2f Nios2: Add TARGET_CAN_INLINE_P hook.
2021-11-09  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* config/nios2/nios2.c (nios2_can_inline_p): New.
	(TARGET_CAN_INLINE_P): Define.

	gcc/testsuite/
	* gcc.target/nios2/custom-fp-inline-1.c: New.
	* gcc.target/nios2/custom-fp-inline-2.c: New.
	* gcc.target/nios2/custom-fp-inline-3.c: New.
	* gcc.target/nios2/custom-fp-inline-4.c: New.
2021-11-09 18:00:54 -08:00
GCC Administrator
c9b1334eec Daily bump. 2021-11-10 00:16:28 +00:00
David Malcolm
8722a17067 c: more precise locations for some -Wpragmas diagnostics
gcc/c-family/ChangeLog:
	* c-pragma.c (GCC_BAD_AT): New macro.
	(GCC_BAD2_AT): New macro.
	(handle_pragma_pack): Use the location of the pertinent token when
	issuing diagnostics about invalid constants/actions, and trailing
	junk.
	(handle_pragma_target): Likewise for non-string "GCC option".
	(handle_pragma_message): Likewise for trailing junk.

gcc/testsuite/ChangeLog:
	* gcc.dg/bad-pragma-locations.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-11-09 18:25:44 -05:00
Bill Schmidt
96276f9935 rs6000: Match recent builtins changes in new builtins support
2021-11-09  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_gimple_fold_new_builtin):
	Disable gimple fold for RS6000_BIF_{XVMINDP,XVMINSP,VMINFP} and
	RS6000_BIF_{XVMAXDP,XVMAXSP,VMAXFP} when fast-math is not set.
	(lxvrse_expand_builtin): Modify the expansion for sign extension.
	All extensions are done within VSX registers.

gcc/testsuite/
	* gcc.target/powerpc/p10_vec_xl_sext.c: Fix long long case.
2021-11-09 15:48:33 -06:00
Bernhard Reutner-Fischer
8875a92d31 Fortran: Fix memory leak in finalization wrappers [PR68800]
If a finalization is not required we created a namespace containing
formal arguments for an internal interface definition but never used
any of these. So the whole sub_ns namespace was not wired up to the
program and consequently was never freed. The fix is to simply not
generate any finalization wrappers if we know that it will be unused.
Note that this reverts back to the original r190869
(8a96d64282ac534cb597f446f02ac5d0b13249cc) handling for this case
by reverting this specific part of r194075
(f1ee56b4be7cc3892e6ccc75d73033c129098e87) for PR fortran/37336.

valgrind summary for e.g.
gfortran.dg/abstract_type_3.f03 and gfortran.dg/abstract_type_4.f03
where ".orig" is pristine trunk and ".mine" contains this fix:

at3.orig.vg:LEAK SUMMARY:
at3.orig.vg-   definitely lost: 8,460 bytes in 11 blocks
at3.orig.vg-   indirectly lost: 13,288 bytes in 55 blocks
at3.orig.vg-     possibly lost: 0 bytes in 0 blocks
at3.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
at3.orig.vg-        suppressed: 0 bytes in 0 blocks
at3.orig.vg-
at3.orig.vg-Use --track-origins=yes to see where uninitialised values come from
at3.orig.vg-ERROR SUMMARY: 38 errors from 33 contexts (suppressed: 0 from 0)
--
at3.mine.vg:LEAK SUMMARY:
at3.mine.vg-   definitely lost: 344 bytes in 1 blocks
at3.mine.vg-   indirectly lost: 7,192 bytes in 18 blocks
at3.mine.vg-     possibly lost: 0 bytes in 0 blocks
at3.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
at3.mine.vg-        suppressed: 0 bytes in 0 blocks
at3.mine.vg-
at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
at4.orig.vg:LEAK SUMMARY:
at4.orig.vg-   definitely lost: 13,751 bytes in 12 blocks
at4.orig.vg-   indirectly lost: 11,976 bytes in 60 blocks
at4.orig.vg-     possibly lost: 0 bytes in 0 blocks
at4.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
at4.orig.vg-        suppressed: 0 bytes in 0 blocks
at4.orig.vg-
at4.orig.vg-Use --track-origins=yes to see where uninitialised values come from
at4.orig.vg-ERROR SUMMARY: 18 errors from 16 contexts (suppressed: 0 from 0)
--
at4.mine.vg:LEAK SUMMARY:
at4.mine.vg-   definitely lost: 3,008 bytes in 3 blocks
at4.mine.vg-   indirectly lost: 4,056 bytes in 11 blocks
at4.mine.vg-     possibly lost: 0 bytes in 0 blocks
at4.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
at4.mine.vg-        suppressed: 0 bytes in 0 blocks
at4.mine.vg-
at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)

gcc/fortran/ChangeLog:

2018-10-12  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	PR fortran/68800
	* class.c (generate_finalization_wrapper): Do not leak
	finalization wrappers if they will not be used.
	* expr.c (gfc_free_actual_arglist): Formatting fix.
	* gfortran.h (gfc_free_symbol): Pass argument by reference.
	(gfc_release_symbol): Likewise.
	(gfc_free_namespace): Likewise.
	* symbol.c (gfc_release_symbol): Adjust acordingly.
	(free_components): Set procedure pointer components
	of derived types to NULL after freeing.
	(free_tb_tree): Likewise.
	(gfc_free_symbol): Set sym to NULL after freeing.
	(gfc_free_namespace): Set namespace to NULL after freeing.
2021-11-09 21:56:49 +01:00
François Dumont
f4b4ce152a libstdc++: [_GLIBCXX_DEBUG] Implement unordered container merge
The _GLIBCXX_DEBUG unordered containers need a dedicated merge implementation
so that any existing iterator on the transfered nodes is properly invalidated.

Add typedef/using declarations for everything used as-is from normal implementation.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (__distance_fw): Replace class keyword with
	typename.
	* include/bits/hashtable.h (_Hashtable<>::_M_merge_unique): Remove noexcept
	qualification. Use const_iterator for node extraction/reinsert.
	(_Hashtable<>::_M_merge_multi): Likewise. Compute new hash code before extract.
	* include/debug/safe_container.h (_Safe_container<>): Make all methods
	protected.
	* include/debug/safe_unordered_container.h
	(_Safe_unordered_container<>::_UContInvalidatePred<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_UMContInvalidatePred<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_UContMergeGuard<_Source, _InvalidatePred>): New.
	(_Safe_unordered_container<>::_S_uc_guard<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_S_umc_guard<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_M_invalide_all): Make public.
	(_Safe_unordered_container<>::_M_invalide_if): Likewise.
	(_Safe_unordered_container<>::_M_invalide_local_if): Likewise.
	* include/debug/unordered_map
	(unordered_map<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_map<>::reference, const_reference, difference_type): New typedef.
	(unordered_map<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_map<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_map<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_map<>::operator[], at, rehash, reserve): Add usings.
	(unordered_map<>::merge): New.
	(unordered_multimap<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_multimap<>::reference, const_reference, difference_type): New typedef.
	(unordered_multimap<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_multimap<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_multimap<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_multimap<>::rehash, reserve): Add usings.
	(unordered_multimap<>::merge): New.
	* include/debug/unordered_set
	(unordered_set<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_set<>::reference, const_reference, difference_type): New typedef.
	(unordered_set<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_set<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_set<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_set<>::rehash, reserve): Add usings.
	(unordered_set<>::merge): New.
	(unordered_multiset<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_multiset<>::reference, const_reference, difference_type): New typedef.
	(unordered_multiset<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_multiset<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_multiset<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_multiset<>::rehash, reserve): Add usings.
	(unordered_multiset<>::merge): New.
	* testsuite/23_containers/unordered_map/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge4_neg.cc: New test.
	* testsuite/util/testsuite_abi.h: [_GLIBCXX_DEBUG] Use normal unordered
	container implementation.
2021-11-09 21:50:17 +01:00
Andrew Pinski
f7844b6a77 [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue
When I fixed PR 102622, I accidently left behind a TYPE_PRECISION
check which I had there for checking before hand.  This check
is not needed as the code will handle it correctly anyways.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

	PR tree-optimization/10352

gcc/ChangeLog:

	* match.pd: Remove check of TYPE_PRECISION for
	the a?0:pow2 case.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/pr10352-1.c: New test.
2021-11-09 19:01:57 +00:00
Andrew MacLeod
56af35de3d Keep x_range_query NULL for global ranges.
Instead of x_range_query always pointing to an object, have it default to
NULL and return a pointer to the global query in that case.

	* function.c (allocate_struct_function): Don't set x_range_query.
	* function.h (get_range_query): Move to value-query.h.
	* gimple-range.cc (enable_ranger): Check that query is currently NULL.
	(disable_ranger): Clear function current query field.
	* value-query.cc (get_global_range_query): Relocate to:
	* value-query.h (get_global_range_query): Here and inline.
	(get_range_query): Relocate here from function.h.
2021-11-09 13:27:42 -05:00
Aldy Hernandez
53080c5b4c Dump details of an attempt to register a jump threading path.
The goal with these sets of patches is to improve the detailed dumps for
the threader, as I hope we eventually reach the point when I'm not
the only one looking at these dumps ;-).

This patch adds candidate paths to the detailed threading dumps to make it
easier to see the decisions the threader makes.  With it we can now
grep for the discovery logic in action:

$ grep ^path: a.ii.*thread*
a.ii.034t.ethread:path: 4->5->xx REJECTED
a.ii.034t.ethread:path: 3->5->8 SUCCESS
a.ii.034t.ethread:path: 4->5->6 SUCCESS
a.ii.034t.ethread:path: 0->2->xx REJECTED
a.ii.034t.ethread:path: 0->2->xx REJECTED
...
...
a.ii.111t.threadfull1:path: 14->22->23->xx REJECTED (unreachable)
a.ii.111t.threadfull1:path: 15->22->23->xx REJECTED (unreachable)
a.ii.111t.threadfull1:path: 16->22->23->xx REJECTED (unreachable)

In addition to this, if --param=threader-debug=all is used, one can see
the entire chain of events leading up to the ultimate threading
decision:

==============================================
path_range_query: compute_ranges for path: 2->5
 Registering killing_def (path_oracle) _3
 Registering killing_def (path_oracle) _1
range_defined_in_block (BB2) for _1 is _Bool VARYING
 Registering killing_def (path_oracle) _2
range_defined_in_block (BB2) for _2 is _Bool VARYING
range_defined_in_block (BB2) for _3 is _Bool VARYING
outgoing_edge_range_p for b_10(D) on edge 2->5 is int VARYING
...
... [BBs and gimple along path]
...
path: 2->5->xx REJECTED

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c
	(back_threader::maybe_register_path_dump): New.
	(back_threader::maybe_register_path): Call maybe_register_path_dump.
2021-11-09 18:23:44 +01:00
Aldy Hernandez
2b59cf475a Return NULL for maybe_register_path when unprofitable.
This is a minor cleanup for maybe_register_path to return NULL when
the path is unprofitable.  It is needed for a follow-up patch to
generate better dumps from the threader.

There is no change in behavior, since the only call to this function
bails on !profitable_path_p.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c (back_threader::maybe_register_path):
	Return NULL when unprofitable.
2021-11-09 18:23:43 +01:00
Martin Jambor
2d60c0a3ee
Introduce build_debug_expr_decl
This patch introduces a helper function build_debug_expr_decl to build
DEBUG_EXPR_DECL tree nodes in the most common way and replaces with a
call of this function all code pieces which build such a DECL itself
and sets its mode to the TYPE_MODE of its type.

There still remain 11 instances of open-coded creation of a
DEBUG_EXPR_DECL which set the mode of the DECL to something else.  It
would probably be a good idea to figure out that has any effect and if
not, convert them to calls of build_debug_expr_decl too.  But this
patch deliberately does not introduce any functional changes.

gcc/ChangeLog:

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

	* tree.h (build_debug_expr_decl): Declare.
	* tree.c (build_debug_expr_decl): New function.
	* cfgexpand.c (avoid_deep_ter_for_debug): Use build_debug_expr_decl
	instead of building a DEBUG_EXPR_DECL.
	* ipa-param-manipulation.c
	(ipa_param_body_adjustments::prepare_debug_expressions): Likewise.
	* omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise.
	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise.
	* tree-ssa-phiopt.c (spaceship_replacement): Likewise.
	* tree-ssa-reassoc.c (make_new_ssa_for_def): Likewise.
2021-11-09 17:54:28 +01:00