190040 Commits

Author SHA1 Message Date
Jonathan Wakely
39de0e5411 libstdc++: Add effective-target for std::allocator implementation
This allows tests to be skipped if the std::allocator implementation is
not __gnu_cxx::new_allocator.

The 20_util/allocator/overaligned.cc test requires either C++17 or
new_allocator, otherwise we can't guarantee to return overaligned
memory.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/50594.cc: Check effective target.
	* testsuite/20_util/allocator/1.cc: Likewise.
	* testsuite/20_util/allocator/overaligned.cc: Likewise.
	* testsuite/23_containers/unordered_map/96088.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/96088.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/96088.cc: Likewise.
	* testsuite/23_containers/unordered_set/96088.cc: Likewise.
	* testsuite/ext/throw_allocator/check_delete.cc: Likewise.
	* testsuite/ext/throw_allocator/check_new.cc: Likewise.
	* testsuite/lib/libstdc++.exp (check_effective_target_std_allocator_new):
	Define new proc.
2021-11-23 21:23:24 +00:00
Harald Anlauf
16e95050f7 Fortran: do not attempt simplification of [LU]BOUND for pointer/allocatable
gcc/fortran/ChangeLog:

	PR fortran/103392
	* simplify.c (simplify_bound): Do not try to simplify
	LBOUND/UBOUND for arrays with POINTER or ALLOCATABLE attribute.

gcc/testsuite/ChangeLog:

	PR fortran/103392
	* gfortran.dg/bound_simplification_7.f90: New test.
2021-11-23 22:02:40 +01:00
Marek Polacek
4b1d3d8d73 c++: -Wuninitialized for mem-inits and empty classes [PR19808]
This fixes a bogus -Wuninitialized warning: there's nothing to initialize
in empty classes, so don't add them into our uninitialized set.

	PR c++/19808

gcc/cp/ChangeLog:

	* init.c (emit_mem_initializers): Don't add is_really_empty_class
	members into uninitialized.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wuninitialized-28.C: Make a class nonempty.
	* g++.dg/warn/Wuninitialized-29.C: Likewise.
	* g++.dg/warn/Wuninitialized-31.C: New test.
2021-11-23 15:02:08 -05:00
Marek Polacek
7b7318faf7 c++: Add static in g++.dg/warn/Waddress-5.C
While reviewing some other changes I noticed that this test talks
about 'sf' being static, but it wasn't actually marked as such.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Waddress-5.C: Make sf static.
2021-11-23 14:28:48 -05:00
Xi Ruoyao
3363022ed8
fixincludes: don't abort() on access failure [PR103306]
Some distro may ship dangling symlinks in include directories, triggers
the access failure.  Skip it and continue to next header instead of
being to panic.

Restore to old behavior before r12-5234 but without resurrecting the
problematic getcwd() call, by using the environment variable "INPUT"
exported by fixinc.sh.

Tested on x86_64-linux-gnu, with a dangling symlink intentionally
injected into /usr/include.

fixincludes/

	PR bootstrap/103306
	* fixincl.c (process): Don't call abort().
2021-11-24 03:18:38 +08:00
Bill Schmidt
d6024c85a1 rs6000: Better error messages for power8/9 vector builtins
2021-11-11  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Change
	error messages for ENB_P8V and ENB_P9V.
2021-11-23 13:17:02 -06:00
Bill Schmidt
c2c534f6fa rs6000: Add [power6-64] stanza to new builtin support
2021-11-23  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add power6-64 stanza.  Move
	CMPB to power6-64 stanza.
	* config/rs6000/rs6000-call.c (rs6000_invalid_new_builtin): Handle
	ENB_P6_64 case.
	(rs6000_new_builtin_is_supported): Likewise.
	(rs6000_expand_new_builtin): Likewise.  Clean up formatting.
	(rs6000_init_builtins): Handle ENB_P6_64 case.
	* config/rs6000/rs6000-gen-builtins.c (bif_stanza): Add	BSTZ_P6_64.
	(stanza_map): Add entry mapping power6-64 to BSTZ_P6_64.
	(enable_string): Add "ENB_P6_64".
	(write_decls): Add ENB_P6_64 to bif_enable enum.
2021-11-23 13:16:58 -06:00
Bill Schmidt
e6a6569ce2 rs6000: Fix test_mffsl.c effective target check
Paul Clarke pointed out to me that I had wrongly used a compile-time check
instead of a run-time check in this executable test.  This patch fixes
that.  I also fixed a typo in a string that caught my eye.

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

gcc/testsuite/
	* gcc.target/powerpc/test_mffsl.c: Change effective target to
	a run-time check.  Fix a typo in a debug print statement.
2021-11-23 12:56:57 -06:00
Harald Anlauf
721d8b9e26 Fortran: fix scalarization for intrinsic LEN_TRIM with present KIND argument
gcc/fortran/ChangeLog:

	PR fortran/87711
	PR fortran/87851
	* trans-array.c (arg_evaluated_for_scalarization): Add LEN_TRIM to
	list of intrinsics for which an optional KIND argument needs to be
	removed before scalarization.

gcc/testsuite/ChangeLog:

	PR fortran/87711
	PR fortran/87851
	* gfortran.dg/len_trim.f90: New test.
2021-11-23 17:51:38 +01:00
Christophe Lyon
46d3cfd29d libcpp: Fix ATTR_LIKELY definition PR preprocessor/103355
Fix the definition of ATTR_LIKELY when __has_cpp_attribute is not
defined, as it is the case with old compilers such as gcc-4.8.5.

	libcpp/:
	PR preprocessor/103355
	* system.h (ATTR_LIKELY): Fix definition.
2021-11-23 16:06:42 +00:00
Jan Hubicka
8632f8c65d Remove duplicated param valud in modref tree
Modref tree template stores its own copy of param_moderf_max_bases, *_max_refs
and *_max_accesses values.  This was done before we had per-function limits and
even back then it was bit dubious, so this patch removes it.

gcc/ChangeLog:

	* ipa-modref-tree.h (struct modref_tree): Remove max_bases, max_refs
	and max_accesses.
	(modref_tree::modref_tree): Remove parametr.
	(modref_tree::insert_base): Add max_bases parameter.
	(modref_tree::insert): Add max_bases, max_refs, max_accesses
	parameters.
	(modref_tree::insert): New member function.
	(modref_tree::merge): Add max_bases, max_refs, max_accesses
	parameters.
	(modref_tree::insert): New member function.
	* ipa-modref-tree.c (test_insert_search_collapse): Update.
	(test_merge): Update.
	* ipa-modref.c (dump_records): Don't dump max_refs and max_bases.
	(dump_lto_records): Likewise.
	(modref_summary::finalize): Fix whitespace.
	(get_modref_function_summary): Likewise.
	(modref_access_analysis::record_access): Update.
	(modref_access_analysis::record_access_lto): Update.
	(modref_access_analysis::process_fnspec): Update.
	(analyze_function): Update.
	(modref_summaries::duplicate): Update.
	(modref_summaries_lto::duplicate): Update.
	(write_modref_records): Update.
	(read_modref_records): Update.
	(read_section): Update.
	(propagate_unknown_call): Update.
	(modref_propagate_in_scc): Update.
	(ipa_merge_modref_summary_after_inlining): Update.
2021-11-23 16:36:01 +01:00
Jonathan Wakely
5459fa132a libstdc++: Fix circular dependency for bitmap_allocator [PR103381]
<ext/bitmap_allocator.h> includes <function>, and since C++17 that
includes <unordered_map>. If std::allocator is defined in terms of
__gnu_cxx::bitmap_allocator then you get a circular reference and
bootstrap fails when compiling src/c++17/*.cc.

libstdc++-v3/ChangeLog:

	PR libstdc++/103381
	* include/ext/bitmap_allocator.h: Include <bits/stl_function.h>
	instead of <functional>.
2021-11-23 12:30:57 +00:00
Martin Liska
d3f22853d1 docs: Remove 2 more duplicite param descriptions.
gcc/ChangeLog:

	* doc/invoke.texi: Remove 2 more duplicite param descriptions.
2021-11-23 11:27:29 +01:00
Richard Biener
6cd4406700 tree-optimization/103361 - fix unroll-and-jam direction vector handling
This properly uses lambda_int instead of truncating the direction
vector to int which leads to false unexpected negative values.

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

	PR tree-optimization/103361
	* gimple-loop-jam.c (adjust_unroll_factor): Use lambda_int
	for the dependence distance.
	* tree-data-ref.c (print_lambda_vector): Properly print a lambda_int.

	* g++.dg/torture/pr103361.C: New testcase.
2021-11-23 11:04:34 +01:00
Jakub Jelinek
2780484bc3 inliner: Remove unused transform_lang_insert_block hook
This struct copy_body_data's hook is always NULL since merge
of the tuples branch, before that it has been shortly used by the C++
FE during ctor/dtor cloning to chain the remapped blocks, but only
very shortly, before transform_lang_insert_block was a bool and
the call to insert_block was done through a langhook.
I'd say that for something that hasn't been used since 4.4 there is
zero chance we'll want to use it again in the near future.

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

gcc/
	* tree-inline.h (struct copy_body_data): Remove
	transform_lang_insert_block member.
	* tree-inline.c (remap_block): Don't call
	id->transform_lang_insert_block.
	(optimize_inline_calls, copy_gimple_seq_and_replace_locals,
	tree_function_versioning, maybe_inline_call_in_expr,
	copy_fn): Don't initialize id.transform_lang_insert_block.
	* gimplify.c (gimplify_omp_loop): Likewise.
gcc/c/
	* c-typeck.c (c_clone_omp_udr): Don't initialize
	id.transform_lang_insert_block.
gcc/cp/
	* semantics.c (clone_omp_udr): Don't initialize
	id.transform_lang_insert_block.
	* optimize.c (clone_body): Likewise.
2021-11-23 11:03:44 +01:00
Jan Hubicka
6033b27ead Improve bytewise DSE
testcase modref-dse-4.c and modref-dse-5.c fails on some targets because they
depend on store merging.  What really happens is that without store merging
we produce for kill_me combined write that is ao_ref with offset=0, size=32
and max_size=96.  We have size != max_size becaue we do ont track the info that
all 3 writes must happen in a group and conider case only some of them are done.

This disables byte-wise DSE which checks that size == max_size.  This is
completely unnecesary for store being proved to be dead or load being checked
to not read live bytes.  It is only necessary for kill store that is used to
prove that given store is dead.

While looking into this I also noticed that we check that everything is byte
aligned.  This is also unnecessary and with access merging in modref may more
commonly fire on accesses that we could otherwise handle.

This patch fixes both also also changes interface to normalize_ref that I found
confusing since it modifies the ref. Instead of that we have get_byte_range
that is computing range in bytes (since that is what we need to maintain the
bitmap) and has additional parameter specifying if the store in question should
be turned into sub-range or super-range depending whether we compute range
for kill or load.

gcc/ChangeLog:

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

	PR tree-optimization/103335
	* tree-ssa-dse.c (valid_ao_ref_for_dse): Rename to ...
	(valid_ao_ref_kill_for_dse): ... this; do not check that boundaries
	are divisible by BITS_PER_UNIT.
	(get_byte_aligned_range_containing_ref): New function.
	(get_byte_aligned_range_contained_in_ref): New function.
	(normalize_ref): Rename to ...
	(get_byte_range): ... this one; handle accesses not aligned to byte
	boundary; return range in bytes rater than updating ao_ref.
	(clear_live_bytes_for_ref): Take write ref by reference; simplify using
	get_byte_access.
	(setup_live_bytes_from_ref): Likewise.
	(clear_bytes_written_by): Update.
	(live_bytes_read): Update.
	(dse_classify_store): Simplify tech before live_bytes_read checks.

gcc/testsuite/ChangeLog:

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

	* gcc.dg/tree-ssa/modref-dse-4.c: Update template.
	* gcc.dg/tree-ssa/modref-dse-5.c: Update template.
2021-11-23 10:57:14 +01:00
Andrew Pinski
911b633803 Canonicalize &MEM[ssa_n, CST] to ssa_n p+ CST in fold_stmt_1
This is a new version of the patch to fix PR 102216.
Instead of doing the canonicalization inside forwprop, Richi
mentioned we should do it inside fold_stmt_1 and that is what
this patch does.

	PR tree-optimization/102216

gcc/ChangeLog:

	* gimple-fold.c (fold_stmt_1): Add canonicalization
	of "&MEM[ssa_n, CST]" to "ssa_n p+ CST", note this
	can only be done if !in_place.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/pr102216-1.C: New test.
	* g++.dg/tree-ssa/pr102216-2.C: New test.
2021-11-23 09:55:47 +00:00
Jakub Jelinek
5e9b973bd6 openmp: Fix up handling of reduction clauses on the loop construct [PR102431]
We were using unshare_expr and walk_tree_without_duplicate replacement
of the placeholder vars.  The OMP_CLAUSE_REDUCTION_{INIT,MERGE} can contain
other trees that need to be duplicated though, e.g. BLOCKs referenced in
BIND_EXPR(s), or local VAR_DECLs.  This patch uses the inliner code to copy
all of that.  There is a slight complication that those local VAR_DECLs or
placeholders don't have DECL_CONTEXT set, they will get that only when
they are gimplified later on, so this patch sets DECL_CONTEXT for those
temporarily and resets it afterwards.

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

	PR middle-end/102431
	* gimplify.c (replace_reduction_placeholders): Remove.
	(note_no_context_vars): New function.
	(gimplify_omp_loop): For OMP_PARALLEL's BIND_EXPR create a new
	BLOCK.  Use copy_tree_body_r with walk_tree instead of unshare_expr
	and replace_reduction_placeholders for duplication of
	OMP_CLAUSE_REDUCTION_{INIT,MERGE} expressions.  Ensure all mentioned
	automatic vars have DECL_CONTEXT set to non-NULL before doing so
	and reset it afterwards for those vars and their corresponding
	vars.

	* c-c++-common/gomp/pr102431.c: New test.
	* g++.dg/gomp/pr102431.C: New test.
	* gfortran.dg/gomp/pr102431.f90: New test.
2021-11-23 10:30:02 +01:00
Haochen Gui
f4eae6450e rs6000: Optimize code generation of vec_reve [PR100868]
gcc/
	PR target/100868
	* config/rs6000/altivec.md (altivec_vreve<mode>2 for VEC_K): Use
	xxbrq for v16qi, xxbrq + xxbrh for v8hi and xxbrq + xxbrw for v4si
	or v4sf when p9_vector is set.
	(altivec_vreve<mode>2 for VEC_64): Defined. Implemented by xxswapd.

gcc/testsuite/
	PR target/100868
	* gcc.target/powerpc/vec_reve_1.c: New test.
	* gcc.target/powerpc/vec_reve_2.c: Likewise.
2021-11-23 16:31:59 +08:00
Martin Liska
1ddf11d364 contrib: filter out -Wc++20-extensions
contrib/ChangeLog:

	* filter-clang-warnings.py: Filter -Wc++20-extensions as it does
	not respect proper attribute detection.
2021-11-23 08:36:54 +01:00
Martin Liska
cab8f69857 contrib: Support itemx in check-params-in-docs.py.
contrib/ChangeLog:

	* check-params-in-docs.py: Support @itemx in param documentation
	and support multi-line documentation for parameters.
2021-11-23 08:26:51 +01:00
Navid Rahimi
df1a0d526e Re: [PATCH] PR tree-optimization/102232 Adding a missing pattern to match.pd
PR tree-optimization/102232

gcc/
	* match.pd (x * (1 + y / x) - y) -> (x - y % x): New optimization.

gcc/testsuite/

	* gcc.dg/tree-ssa/pr102232.c: Testcase for this optimization.
2021-11-22 22:07:35 -05:00
Marek Polacek
630686f93f libcpp: Use [[likely]] conditionally
Let's hide [[likely]] behind a macro, to suppress warnings if the
compiler doesn't support it.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>

	PR preprocessor/103355

libcpp/ChangeLog:

	* lex.c: Use ATTR_LIKELY instead of [[likely]].
	* system.h (ATTR_LIKELY): Define.
2021-11-22 21:43:38 -05:00
Navid Rahimi
e888bea238 Re: [PATCH] PR tree-optimization/96779 Adding a missing pattern to match.pd
PR tree-optimization/96779
gcc/
	* match.pd (-x == x) -> (x == 0): New optimization.

gcc/testsuite
	* gcc.dg/tree-ssa/pr96779.c: Testcase for this optimization.
	* gcc.dg/tree-ssa/pr96779-disabled.c: Testcase for this optimization
	when -fwrapv passed.
2021-11-22 19:48:04 -05:00
GCC Administrator
06be28f64a Daily bump. 2021-11-23 00:16:27 +00:00
Jason Merrill
1df539fd19 c++: remember pointer-to-member location
Jakub recently mentioned that a PTRMEM_CST has no location; let's give it a
location wrapper.

gcc/cp/ChangeLog:

	* typeck.c (build_x_unary_op): Set address location.
	(convert_member_func_to_ptr): Handle location wrapper.
	* pt.c (convert_nontype_argument): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/template/crash106.C: Adjust.
	* g++.dg/diagnostic/ptrtomem3.C: New test.
2021-11-22 17:43:10 -05:00
Jason Merrill
5440c88e61 c++: improved return expression location
Stripping the location wrapper from retval meant we didn't have the
necessary location information for any conversion diagnostics.  We only need
the stripping for the named return value optimization, let's use the
unstripped expression for everything else.

gcc/cp/ChangeLog:

	* typeck.c (check_return_expr): Only strip location wrapper during
	NRV handling.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/pr65327.C: Adjust location.
	* g++.dg/cpp23/constexpr-nonlit4.C: Likewise.
	* g++.dg/cpp23/constexpr-nonlit5.C: Likewise.
	* g++.dg/cpp2a/constexpr-init1.C: Likewise.
2021-11-22 17:42:53 -05:00
Jakub Jelinek
a6e0d59370 libcpp: Fix _Pragma stringification [PR103165]
As the testcase show, sometimes _Pragma is turned into CPP_PRAGMA
.. CPP_PRAGMA_EOL tokens, even when it might still need to be
stringized later on.  We are then ICEing because we don't handle
stringification of CPP_PRAGMA or CPP_PRAGMA_EOL, but trying to
reconstruct the exact tokens with exact spacing after it has been
lowered is very hard.  So, instead this patch ensures we don't
lower _Pragma during expand_arg calls, but only later when
cpp_get_token_1 is called outside of expand_arg.

2021-11-22  Jakub Jelinek  <jakub@redhat.com>
	    Tobias Burnus  <tobias@codesourcery.com>

	PR preprocessor/103165
libcpp/
	* internal.h (struct lexer_state): Add ignore__Pragma field.
	* macro.c (builtin_macro): Don't interpret _Pragma if
	pfile->state.ignore__Pragma.
	(expand_arg): Temporarily set pfile->state.ignore__Pragma to 1.
gcc/testsuite/
	* c-c++-common/gomp/pragma-3.c: New test.
	* c-c++-common/gomp/pragma-4.c: New test.
	* c-c++-common/gomp/pragma-5.c: New test.

Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>
2021-11-22 22:29:20 +01:00
Roger Sayle
a944b5dec3 tree-optimization/103345: Improved load merging.
This patch implements PR tree-optimization/103345 to merge adjacent
loads when combined with addition or bitwise xor.  The current code
in gimple-ssa-store-merging.c's find_bswap_or_nop alreay handles ior,
so that all that's required is to treat PLUS_EXPR and BIT_XOR_EXPR in
the same way at BIT_IOR_EXPR.  Many thanks to Andrew Pinski for
pointing out that this also resolves PR target/98953.

2021-11-22  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR tree-optimization/98953
	PR tree-optimization/103345
	* gimple-ssa-store-merging.c (find_bswap_or_nop_1): Handle
	BIT_XOR_EXPR and PLUS_EXPR the same as BIT_IOR_EXPR.
	(pass_optimize_bswap::execute): Likewise.

gcc/testsuite/ChangeLog
	PR tree-optimization/98953
	PR tree-optimization/103345
	* gcc.dg/tree-ssa/pr98953.c: New test case.
	* gcc.dg/tree-ssa/pr103345.c: New test case.
2021-11-22 18:15:36 +00:00
Martin Liska
c38c547a70 docs: remove duplicate param documentation
gcc/ChangeLog:

	* doc/invoke.texi: Remove duplicate documentation for 3 params.
2021-11-22 17:37:12 +01:00
Jakub Jelinek
1aedb3920a openacc: Fix up C++ #pragma acc routine handling [PR101731]
The following testcase ICEs because two function declarations are nested in
each other and the acc routine handling code isn't prepared to put the
pragma on both.

The fix is similar to what #pragma omp declare {simd,variant} does,
in particular set the fndecl_seen flag already in cp_parser_late_parsing*
when we encounter it rather than only after we finalize it.

In cp_finalize_oacc_routine I had to move the fndecl_seen diagnostics to
non-FUNCTION_DECL block, because for FUNCTION_DECLs the flag is already
known to be set from cp_parser_late_parsing_oacc_routine, but can't be
removed altogether, because that regresses quality of 2 goacc/routine-5.c
diagnostics - we drop "a single " from the
'#pragma acc routine' not immediately followed by a single function declaration or definition
diagnostic say on
 #pragma acc routine
 int foo (), b;
if we drop it altogether.

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

	PR c++/101731
	* parser.c (cp_parser_late_parsing_oacc_routine): Set
	parser->oacc_routine->fndecl_seen here, rather than ...
	(cp_finalize_oacc_routine): ... here.  Don't error if
	parser->oacc_routine->fndecl_seen is set for FUNCTION_DECLs.

	* c-c++-common/goacc/routine-6.c: New test.
2021-11-22 17:07:19 +01:00
Jonathan Wakely
d7376862b6 libstdc++: Fix condition for definition of _GLIBCXX14_DEPRECATED
The check for C++14 was using the wrong date.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX14_DEPRECATED): Fix condition
	checking for C++14.
2021-11-22 14:57:17 +00:00
Florian Weimer
f58bf16f67 libgcc: Remove dbase member from struct unw_eh_callback_data if NULL
Only bfin, frv, i386 and nios2 need this member at present.

libgcc/ChangeLog

	* unwind-dw2-fde-dip.c (NEED_DBASE_MEMBER): Define.
	(struct unw_eh_callback_data): Make dbase member conditional.
	(unw_eh_callback_data_dbase): New function.
	(base_from_cb_data): Simplify for the non-dbase case.
	(_Unwind_IteratePhdrCallback): Adjust.
	(_Unwind_Find_FDE): Likewise.
2021-11-22 13:31:10 +01:00
Florian Weimer
90986c5f0a libgcc: Remove tbase member from struct unw_eh_callback_data
It is always a null pointer.

libgcc/ChangeLog

	* unwind-dw2-fde-dip.c (struct unw_eh_callback_data): Remove
	tbase member.
	(base_from_cb_data): Adjust.
	(_Unwind_IteratePhdrCallback): Likewise.
	(_Unwind_Find_FDE): Likewise.
2021-11-22 13:30:23 +01:00
Richard Biener
f456eaf2e0 tree-optimization/103351 - avoid compare-debug issue wrt CD-DCE change
This avoids differences in the split edge of a cluster due to different
order of same key PHI args when sorting by sorting after the edge
destination index as second key.

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

	PR tree-optimization/103351
	* tree-ssa-dce.c (sort_phi_args): Sort after e->dest_idx as
	second key.

	* g++.dg/torture/pr103351.C: New testcase.
2021-11-22 12:18:08 +01:00
Jakub Jelinek
4b1e14346a openmp: Handle OMP_MASKED in potential_constant_expression_1 [PR103349]
WHen adding OMP_MASKED, I apparently forgot to handle it in
potential_constant_expression_1, which means we can ICE on it.

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

	PR c++/103349
	* constexpr.c (potential_constant_expression_1): Punt on OMP_MASKED.

	* g++.dg/gomp/masked-1.C: New test.
2021-11-22 10:13:24 +01:00
liuhongt
b5844cb0bc Don't allow mask/sse/mmx mov in TLS code sequences.
As change in assembler, refer to [1], this patch disallow mask/sse/mmx
mov in TLS code sequences which require integer MOV instructions.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=d7e3e627027fcf37d63e284144fe27ff4eba36b5

gcc/ChangeLog:

	PR target/103275
	* config/i386/constraints.md (Bk): New
	define_memory_constraint.
	* config/i386/i386-protos.h (ix86_gpr_tls_address_pattern_p):
	Declare.
	* config/i386/i386.c (ix86_gpr_tls_address_pattern_p): New
	function.
	* config/i386/i386.md (*movsi_internal): Don't allow
	mask/sse/mmx move in TLS code sequences.
	(*movdi_internal): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr103275.c: New test.
2021-11-22 11:24:11 +08:00
Kewen Lin
2b5b8610e9 xtensa: Fix non-robust split condition in define_insn_and_split
This patch is to fix some non-robust split conditions in some
define_insn_and_splits, to make each of them applied on top of
the corresponding condition for define_insn part, otherwise the
splitting could perform unexpectedly.

gcc/ChangeLog:

	* config/xtensa/xtensa.md (movdi_internal, movdf_internal): Fix split
	condition.
2021-11-21 20:18:31 -06:00
GCC Administrator
ae957bef06 Daily bump. 2021-11-22 00:16:29 +00:00
Jakub Jelinek
da17c304e2 fortran, debug: Fix up DW_AT_rank [PR103315]
For DW_AT_rank we were emitting
        .uleb128 0x4    # DW_AT_rank
        .byte   0x97    # DW_OP_push_object_address
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x1c
        .byte   0x6     # DW_OP_deref
on 64-bit and
        .uleb128 0x4    # DW_AT_rank
        .byte   0x97    # DW_OP_push_object_address
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x10
        .byte   0x6     # DW_OP_deref
on 32-bit.  I think this is wrong, as dtype.rank field in the descriptor
has unsigned char type, not pointer type nor pointer sized integral.
E.g. if we have a
    REAL :: a(..)
dummy argument, which is passed as a reference to the function descriptor,
we want to evaluate a->dtype.rank.  The above DWARF expressions perform
*(uintptr_t *)(a + 0x1c)
and
*(uintptr_t *)(a + 0x10)
respectively.  The following patch changes those to:
        .uleb128 0x5    # DW_AT_rank
        .byte   0x97    # DW_OP_push_object_address
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x1c
        .byte   0x94    # DW_OP_deref_size
        .byte   0x1
and
        .uleb128 0x5    # DW_AT_rank
        .byte   0x97    # DW_OP_push_object_address
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x10
        .byte   0x94    # DW_OP_deref_size
        .byte   0x1
which perform
*(unsigned char *)(a + 0x1c)
and
*(unsigned char *)(a + 0x10)
respectively.

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

	PR debug/103315
	* trans-types.c (gfc_get_array_descr_info): Use DW_OP_deref_size 1
	instead of DW_OP_deref for DW_AT_rank.
2021-11-21 21:08:04 +01:00
Jakub Jelinek
364539710f i386: Fix up handling of target attribute [PR101180]
As shown in the testcase below, if a function has multiple target attributes
(rather than a single one with one or more arguments) or if a function
gets one target attribute on one declaration and another one on another
declaration, on x86 their effect is not combined into
DECL_FUNCTION_SPECIFIC_TARGET, but instead only the last processed target
attribute wins.  aarch64 handles this right, the following patch follows
what it does, i.e. only start with target_option_default_node if
DECL_FUNCTION_SPECIFIC_TARGET is previously NULL (i.e. the first target
attribute being processed on a function) and otherwise start from the
previous DECL_FUNCTION_SPECIFIC_TARGET.

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

	PR c++/101180
	* config/i386/i386-options.c (ix86_valid_target_attribute_p): If
	fndecl already has DECL_FUNCTION_SPECIFIC_TARGET, use that as base
	instead of target_option_default_node.

	* gcc.target/i386/pr101180.c: New test.
2021-11-21 21:06:23 +01:00
Harald Anlauf
8fef6f720a Fortran: fix lookup for gfortran builtin math intrinsics used by DEC extensions
gcc/fortran/ChangeLog:

	PR fortran/99061
	* trans-intrinsic.c (gfc_lookup_intrinsic): Helper function for
	looking up gfortran builtin intrinsics.
	(gfc_conv_intrinsic_atrigd): Use it.
	(gfc_conv_intrinsic_cotan): Likewise.
	(gfc_conv_intrinsic_cotand): Likewise.
	(gfc_conv_intrinsic_atan2d): Likewise.

gcc/testsuite/ChangeLog:

	PR fortran/99061
	* gfortran.dg/dec_math_5.f90: New test.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
2021-11-21 19:29:27 +01:00
Jan Hubicka
0f5afb6263 Improve base tracking in ipa-modref
on exchange2 benchamrk we miss some useful propagation because modref gives
up very early on analyzing accesses through pointers.  For example in
int test (int *a)
{
  int i;
  for (i=0; a[i];i++);
  return i+a[i];
}

We are not able to determine that a[i] accesses are relative to a.
This is because get_access requires the SSA name that is in MEM_REF to be
PARM_DECL while on other places we use ipa-prop helper to work out the proper
base pointers.

This patch commonizes the code in get_access and parm_map_for_arg so both
use the check properly and extends it to also figure out that newly allocated
memory is not a side effect to caller.

gcc/ChangeLog:

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

	PR ipa/103227
	* ipa-modref.c (parm_map_for_arg): Rename to ...
	(parm_map_for_ptr): .. this one; handle static chain and calls to
	malloc functions.
	(modref_access_analysis::get_access): Use parm_map_for_ptr.
	(modref_access_analysis::process_fnspec): Update.
	(modref_access_analysis::analyze_load): Update.
	(modref_access_analysis::analyze_store): Update.

gcc/testsuite/ChangeLog:

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

	PR ipa/103227
	* gcc.dg/tree-ssa/modref-15.c: New test.
2021-11-21 16:15:41 +01:00
Jan Hubicka
c8260767aa Fix failure merge_block.c testcase
gcc/testsuite/ChangeLog:

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

	PR ipa/103264
	* gcc.dg/tree-prof/merge_block.c: Add -fno-ipa-modref
2021-11-21 16:13:40 +01:00
Jan Hubicka
09a4ffb72a Refactor load/store/kill analysis in ipa-modref
Refactor load/store/kill analysis in ipa-modref to a class
modref_access_analysis.  This is done in order to avoid some code duplication
and early exits that has turned out to be hard to maintain and there were
multiple bugs we noticed recently.

gcc/ChangeLog:

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

	* ipa-modref.c (ignore_nondeterminism_p): Move earlier in source
	code.
	(ignore_retval_p): Likewise.
	(ignore_stores_p): Likewise.
	(parm_map_for_arg): Likewise.
	(class modref_access_analysis): New class.
	(modref_access_analysis::set_side_effects): New member function.
	(modref_access_analysis::set_nondeterministic): New member function.
	(get_access): Turn to ...
	(modref_access_analysis::get_access): ... this one.
	(record_access): Turn to ...
	(modref_access_analysis::record_access): ... this one.
	(record_access_lto): Turn to ...
	(modref_access_analysis::record_access_lto): ... This one.
	(record_access_p): Turn to ...
	(modref_access_analysis::record_access_p): ... This one
	(modref_access_analysis::record_unknown_load): New member function.
	(modref_access_analysis::record_unknown_store): New member function.
	(get_access_for_fnspec): Turn to ...
	(modref_access_analysis::get_access_for_fnspec): ... this one.
	(merge_call_side_effects): Turn to ...
	(moderf_access_analysis::merge_call_side_effects): Turn to ...
	(collapse_loads): Move later in source code.
	(collapse_stores): Move later in source code.
	(process_fnspec): Turn to ...
	(modref_access_analysis::process_fnspec): ... this one.
	(analyze_call): Turn to ...
	(modref_access_analysis::analyze_call): ... this one.
	(struct summary_ptrs): Remove.
	(analyze_load): Turn to ...
	(modref_access_analysis::analyze_load): ... this one.
	(analyze_store): Turn to ...
	(modref_access_analysis::analyze_store): ... this one.
	(analyze_stmt): Turn to ...
	(modref_access_analysis::analyze_stmt): ... This one.
	(remove_summary): Remove.
	(modref_access_analysis::propagate): Break out from ...
	(modref_access_analysis::analyze): Break out from ...
	(analyze_function): ... here.
2021-11-21 13:22:34 +01:00
Roger Sayle
dc915b361b Tweak tree-ssa-math-opts.c to solve PR target/102117.
This patch resolves PR target/102117 on s390.  The problem is that
some of the functionality of GCC's RTL expanders is no longer triggered
following the transition to tree SSA form.  On s390, unsigned widening
multiplications are converted into WIDEN_MULT_EXPR (aka w* in tree dumps),
but signed widening multiplies are left in their original form, which
alas doesn't benefit from the clever logic in expand_widening_mult.

The fix is to teach convert_mult_to_widen, that RTL expansion can
synthesize a signed widening multiplication if the target provides
a suitable umul_widen_optab.

On s390-linux-gnu with -O2 -m64, the code in the bugzilla PR currently
generates:

imul128:
        stmg    %r12,%r13,96(%r15)
        srag    %r0,%r4,63
        srag    %r1,%r3,63
        lgr     %r13,%r3
        mlgr    %r12,%r4
        msgr    %r1,%r4
        msgr    %r0,%r3
        lgr     %r4,%r12
        agr     %r1,%r0
        lgr     %r5,%r13
        agr     %r4,%r1
        stmg    %r4,%r5,0(%r2)
        lmg     %r12,%r13,96(%r15)
        br      %r14

but with this patch should now generate the more efficient:

imul128:
        lgr     %r1,%r3
        mlgr    %r0,%r4
        srag    %r5,%r3,63
        ngr     %r5,%r4
        srag    %r4,%r4,63
        sgr     %r0,%r5
        ngr     %r4,%r3
        sgr     %r0,%r4
        stmg    %r0,%r1,0(%r2)
        br      %r14

2021-11-21  Roger Sayle  <roger@nextmovesoftware.com>
	    Robin Dapp  <rdapp@linux.ibm.com>

gcc/ChangeLog
	PR target/102117
	* tree-ssa-math-opts.c (convert_mult_to_widen): Recognize
	signed WIDEN_MULT_EXPR if the target supports umul_widen_optab.

gcc/testsuite/ChangeLog
	PR target/102117
	* gcc.target/s390/mul-wide.c: New test case.
	* gcc.target/s390/umul-wide.c: New test case.
2021-11-21 11:40:08 +00:00
GCC Administrator
f658f1d7a2 Daily bump. 2021-11-21 00:16:32 +00:00
Jan Hubicka
ce2dbf943a Fix ignore_nondeterminism_p in ipa-modref
Improve debug output in ipa-modref and fix ignore_nondeterminism predicate:
looping pures and cont are still deterministic.

gcc/ChangeLog:

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

	PR ipa/103052
	* ipa-modref.c (ignore_nondeterminism_p): Allow looping pure/cont.
	(merge_call_side_effects): Improve debug output.
2021-11-21 00:39:42 +01:00
Jan Hubicka
a0e99d5bb7 Fix looping flag discovery in ipa-pure-const
The testcase shows situation where there is non-trivial cycle in the callgraph
involving a noreturn call.  This cycle is important for const function discovery
but not important for pure.  IPA pure const uses same strongly connected
components for both propagations which makes it to get suboptimal result
(does not detect the pure flag). However local pure const gets the situation
right becaue it processes functions in right order.  This hits rarely
executed code in propagate_pure_const that merge results with previously
known state that has long standing bug in it that makes it to throw away
the looping flag.

Bootstrapped/regtested x86_64-linux.

gcc/ChangeLog:

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

	PR ipa/103052
	* ipa-pure-const.c (propagate_pure_const): Fix merging of loping flag.

gcc/testsuite/ChangeLog:

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

	PR ipa/103052
	* gcc.c-torture/execute/pr103052.c: New test.
2021-11-21 00:35:22 +01:00
Jeff Law
7950c96ca6 Clobber the condition code in the bfin doloop patterns
Per Aldy's excellent, but tough to follow analysis in PR 103226, this patch
fixes the bfin-elf regression.

In simplest terms the doloop patterns on this port may clobber the condition
code register, but they do not expose that until after register allocation.
That would be fine, except that other patterns have exposed CC earlier.  As
a result the dataflow, particularly for CC, is incorrect.

This leads the register allocators to assume that a value in CC outside the
loop is still valid inside the loop when in fact, the value has been
clobbered.  This is what caused pr80974 to start failing.

With this fix, not only do we fix the pr80974 regression, but we fix ~20
other execution failures in the port.  It also reduces test time for the
port from ~90 minutes to ~60 minutes.

	PR tree-optimization/103226
gcc/
	* config/bfin/bfin.md (doloop pattern, splitter and expander): Clobber
	CC.
2021-11-20 11:30:09 -05:00