guojiufu [Thu, 28 May 2020 06:10:39 +0000 (14:10 +0800)]
rs6000: allow cunroll to grow size according to -funroll-loop or -fpeel-loops
Previously, flag_unroll_loops was turned on at -O2 implicitly. This
also turned on cunroll with allowance size increasing, and cunroll
will unroll/peel the loop even the loop is complex like code in PR95018.
With this patch, size growth for cunroll is allowed only for if -funroll-loops
or -fpeel-loops or -O3 is specified explicitly.
guojiufu [Thu, 28 May 2020 05:42:23 +0000 (13:42 +0800)]
Introduce flag_cunroll_grow_size for cunroll
Currently GIMPLE complete unroller(cunroll) is checking
flag_unroll_loops and flag_peel_loops to see if allow size growth.
Beside affects curnoll, flag_unroll_loops also controls RTL unroler.
To have more freedom to control cunroll and RTL unroller, this patch
introduces flag_cunroll_grow_size. With this patch, we can control
cunroll and RTL unroller indepently.
* common.opt (flag_cunroll_grow_size): New flag.
* toplev.c (process_options): Set flag_cunroll_grow_size.
* tree-ssa-loop-ivcanon.c (pass_complete_unroll::execute):
Use flag_cunroll_grow_size.
Backports the conversion of the parameter fields debugids and versionids
to Identifiers. The idea is that Identifiers should be used instead of
C strings where ever possible.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 740f3d1ea.
* d-lang.cc (d_handle_option): Use new fields to save debug and
version levels passed over command-line.
(d_post_options): Add them to front-end here.
Marek Polacek [Fri, 5 Jun 2020 18:22:35 +0000 (14:22 -0400)]
c++: Make braced-init-list as template arg work with aggr init [PR95369]
Barry pointed out to me that our braced-init-list as a template-argument
extension doesn't work as expected when we aggregate-initialize. Since
aggregate list-initialization is a user-defined conversion sequence, we
allow it as part of a converted constant expression.
Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/ChangeLog:
Harald Anlauf [Fri, 5 Jun 2020 18:30:34 +0000 (20:30 +0200)]
PR fortran/95530, PR fortran/95537 - Buffer overflows with long symbols
The testcases for PR95090 and PR95106 trigger buffer overflows with long
symbols that were found with an instrumented compiler. Enlarge the
affected buffers, and add checks that the buffers will suffice.
Mark Wielaard [Thu, 28 May 2020 00:55:36 +0000 (02:55 +0200)]
diagnostics: Consistently add fixit hint for implicit builtin declaration
There are two warnings that might trigger when a builtin function is
used but not declared yet. Both called through implicitly_declare in
c-decl. The first in implicit_decl_warning does warn for builtins,
but does not add a fixit hint for them (only for non-builtins when
a header is suggested through lookup_name_fuzzy). This warning is
guarded by -Wimplicit-function-declaration. The second warning, which
does include a fixit hint if possible, is given when the implicit
builtin declaration has an incompatible signature. This second warning
cannot be disabled.
This setup means that you only get a fixit-hint for usage of builtin
functions where the implicit signature is different than the actual
signature of the builtin. No fixit hints with header suggestions
are ever generated for builtins like abs, isdigit or putchar.
It seems more consistent to always generate a fixit-hint if possible
for the -Wimplicit-function-declaration warning. And for the second
warning to make it depend on -Wbuiltin-declaration-mismatch like
other warnings about builtin declaration mismatches.
Include a new test to show we get fixit-hints for abs, isdigit and
putchar now. Some small tweaks to existing tests to show the
effect of -Wno-builtin-declaration-mismatch with this change. And
a testcase to show that #pragma GCC diagnostic ignored now works.
gcc/c/ChangeLog:
* c-decl.c (implicit_decl_warning): When warned and olddecl is
an undeclared builtin, then add a fixit header hint, if found.
(implicitly_declare): Add OPT_Wbuiltin_declaration_mismatch to
warning_at about implicit builtin declaration type mismatch.
gcc/testsuite/ChangeLog:
* gcc.dg/missing-header-fixit-3.c: Add
-Wno-implicit-function-declaration.
* gcc.dg/missing-header-fixit-4.c: Add new expected output.
* gcc.dg/missing-header-fixit-5.c: New testcase.
* gcc.dg/Wbuiltin-declaration-mismatch-ignore.c: Likewise.
Jason Merrill [Thu, 4 Jun 2020 19:56:57 +0000 (15:56 -0400)]
c++: Fix pretty-print of pointer minus integer.
For whatever reason, GCC internally represents a pointer minus an integer as
a pointer plus a very large unsigned integer. But exposing that to users is
unsightly, and it's easy enough to show the real value.
gcc/cp/ChangeLog:
* error.c (dump_binary_op): Handle negative operand to
POINTER_PLUS_EXPR.
gcc/c-family/ChangeLog:
* c-pretty-print.c (pp_c_additive_expression): Handle negative
operand to POINTER_PLUS_EXPR.
My earlier patch to add case handling to the spell checker caused a
Fortran regression. I believe I must have misread the test results.
This patch fixes the problem by changing the cutoff. I chose this
value because the previous patch effectively multiplied the result of
get_edit_distance by 2 (unless a case change is involved).
gcc/fortran/ChangeLog:
PR fortran/95509
* misc.c (gfc_closest_fuzzy_match): Update cutoff value
computation.
These are not itself necessary for OpenACC 'exit data' directives, and are
skipped over (now) in libgomp. We might as well not emit them to start with,
in line with the equivalent OpenMP directive. We keep the no-op handling in
libgomp for the reason of backward compatibility.
gcc/
* gimplify.c (gimplify_adjust_omp_clauses): Remove
'GOMP_MAP_STRUCT' mapping from OpenACC 'exit data' directives.
gcc/testsuite/
* c-c++-common/goacc/struct-enter-exit-data-1.c: New file.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>: Explain
special handling.
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Updates the Target interface, removing static from all members, so all
field accesses and member function calls go through a single global
'target'. Information relating to extern ABI are now in TargetC,
TargetCPP, and TargetObjC for each supported language respectively.
* dmd/MERGE: Merge upstream dmd 56f0a65c4.
* d-builtins.cc (build_frontend_type): Remove static.
(d_build_builtins_module): Use target.va_listType() to get front-end
type for va_list.
(d_init_builtins): Move creation of va_list to Target::va_listType.
* d-codegen.cc (build_interface_binfo): Use new target global.
(build_vindex_ref): Likewise.
(identity_compare_p): Likewise.
* d-ctfloat.cc (CTFloat::parse): Likewise.
* d-lang.cc (d_init): Likewise.
* d-port.cc (Port::isFloat32LiteralOutOfRange): Likewise.
(Port::isFloat64LiteralOutOfRange): Likewise.
* d-target.cc (define_float_constants): Initialize constants through a
reference, instead of setting globals.
(Target::_init): Initialize new fields instead of setting globals.
(Target::va_listType): Build front-end type from va_list_type_node.
(Target::toCppMangle): Renamed to ...
(TargetCPP::toMangle): ... this.
(Target::cppTypeInfoMangle): Renamed to ...
(TargetCPP::typeInfoMangle): ... this.
(Target::cppTypeMangle): Renamed to ...
(TargetCPP::typeMangle): this.
(Target::cppParameterType): Renamed to ...
(TargetCPP::parameterType): ... this. Use target.va_listType() to get
front-end type for va_list.
(Target::cppFundamentalType): Renamed to ...
(TargetCPP::fundamentalType): ... this.
* d-tree.h (build_frontend_type): Declare.
* decl.cc (base_vtable_offset): Use new target global.
* typeinfo.cc (layout_classinfo_interfaces): Likewise.
(layout_cpp_typeinfo): Likewise.
* types.cc (valist_array_p): Use target.va_listType() to get front-end
type for va_list.
(layout_aggregate_type): Use new target global.
Arnaud Charlet [Mon, 3 Feb 2020 10:22:57 +0000 (05:22 -0500)]
[Ada] Support 'Reduce under -gnatX
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* scng.adb (Scan): Fix typo to take into account all future
versions of Ada.
* sem_attr.ads (Attribute_Impl_Def): Add Attribute_Reduce for
now.
* sem_attr.adb (Analyze_Attribute): Only allow 'Reduce under
-gnatX.
* snames.ads-tmpl (Name_Reduce): Update comment.
Ed Schonberg [Wed, 5 Feb 2020 16:38:38 +0000 (11:38 -0500)]
[Ada] Subtype inherits Atomic flag from base type
2020-06-05 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Subtype_Declaration): For scalar types,
and for subtype declarations without a constraint, subtype
inherits Atomic flag from base type.
Eric Botcazou [Wed, 5 Feb 2020 17:02:03 +0000 (18:02 +0100)]
[Ada] Make the Has_Dynamic_Range_Check flag obsolete
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* atree.adb (New_Copy): Clear Has_Dynamic_Range_Check on
subexpression nodes.
* checks.adb (Append_Range_Checks): Assert that the node
doesn't have the Has_Dynamic_Range_Check flag set.
(Insert_Range_Checks): Likewise.
* exp_ch3.adb (Expand_N_Subtype_Indication): Do not apply
range checks for a full type or object declaration.
* sem_ch3.ads: Move with and use clauses for Nlists to...
(Process_Range_Expr_In_Decl): Change default to No_List for
the Check_List parameter.
* sem_ch3.adb: ...here.
(Process_Range_Expr_In_Decl): Likewise. When the insertion
node is a declaration, only insert on the list if is present
when the declaration involves discriminants, and only insert
on the node when there is no list otherwise.
* libgnat/s-os_lib.adb (Is_Dirsep): Moved from Build_Path to
package level to reuse.
(Normalize_Pathname.Final_Value): Reduce 2 'if' statements to
one.
(Normalize_Pathname.Fill_Directory): New procedure instead of
function Get_Directory. Remove slash to backslash conversion and
drive letter uppercasing on Windows.
Piotr Trojanek [Thu, 16 Jan 2020 17:50:05 +0000 (18:50 +0100)]
[Ada] Simplify iteration over components
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* einfo.adb: Minor reformatting.
* sem_util.adb (Has_Full_Default_Initialization,
Is_Partially_Initialized_Type, Caller_Known_Size_Record,
Large_Max_Size_Mutable): Iterate with
First_Component/Next_Component; rename Ent to Comp.
Eric Botcazou [Tue, 4 Feb 2020 23:13:00 +0000 (00:13 +0100)]
[Ada] Fix incorrect initialization for array of non-standard enumeration type
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use
Expr_Rep_Value instead of Expr_Value to obtain the equivalent
integer value.
* sem_eval.ads (Expr_Value): Document more supported cases.
* sem_eval.adb (Expr_Rep_Value): Copy missing cases from
Exp_Value.
Bob Duff [Tue, 4 Feb 2020 16:08:32 +0000 (11:08 -0500)]
[Ada] Put_Image attribute: Rtsfind cleanups
2020-06-05 Bob Duff <duff@adacore.com>
gcc/ada/
* rtsfind.adb, rtsfind.ads: Move subtypes of RTU_Id into package
body, because they are not needed by clients. Change "Child_" to
"Descendant", because grandchildren and great grandchildren are
involved. Replace all the repetitive comments with a single
concise one. Change the parent subtypes to be more consistent;
use the most specific parent.
Ed Schonberg [Fri, 31 Jan 2020 17:28:21 +0000 (12:28 -0500)]
[Ada] Spurious error on address clause in task body
2020-06-05 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch9.adb, (Analyze_Task_Body): After analying the task
body, indicate that all local variables have no delayed aspects.
This prevents improper later calls to
Check_Aspect_At_End_Of_Declarations, that would happen when the
constructed task_procedure body (generated during expansion) is
analyzed. The legality of aspect specifications that may appear
on local declarations has already been established, and it is in
general not possible to recheck them properly during expansion,
when visibility may not be fully established.
Arnaud Charlet [Fri, 31 Jan 2020 14:18:37 +0000 (09:18 -0500)]
[Ada] AI12-0336 Meaning of Time_Offset
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* libgnat/a-calfor.ads, libgnat/a-catizo.ads,
libgnat/a-catizo.adb (Local_Time_Offset, Local_Image): New.
(UTC_Time_Offset): Now a renaming of Local_Time_Offset.
Eric Botcazou [Fri, 31 Jan 2020 10:56:30 +0000 (11:56 +0100)]
[Ada] Fix assertion failure on double rederivation of private type
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch3.adb (Available_Full_View): New function returning
either the full or the underlying full view.
(Build_Full_Derivation): Add guard for the full view.
(Copy_And_Build): Retrieve the underlying full view, if any,
also if deriving a completion.
(Build_Derived_Private_Type): Use Available_Full_View throughout
to decide whether a full derivation must be done.
* einfo.adb, einfo.ads, exp_util.adb: Remove Invariants_Ignored
flag.
* sem_prag.adb (Invariant): Instead of setting a flag to be
checked elsewhere, remove the pragma as soon as it is analyzed
and checked for legality.
Arnaud Charlet [Thu, 30 Jan 2020 08:09:19 +0000 (03:09 -0500)]
[Ada] Minor wording changes wrt Ada 202x
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* par-ch3.adb, par-ch4.adb, scng.adb, sem_aggr.adb,
sem_ch10.adb, sem_ch12.adb, sem_prag.adb: Update wording: change
Ada_2020 to Ada 2020 in comments and mention -gnat2020 instead
of -gnatX switch.
Richard Biener [Fri, 5 Jun 2020 08:13:27 +0000 (10:13 +0200)]
tree-optimization/95539 - fix SLP_TREE_REPRESENTATIVE vs. dr_info
This fixes a disconnect between the stmt_info used for dr_info
analysis and the one in SLP_TREE_REPRESENTATIVE with a temporary
workaround.
2020-06-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/95539
* tree-vect-data-refs.c
(vect_slp_analyze_and_verify_instance_alignment): Use
SLP_TREE_REPRESENTATIVE for the data-ref check.
* tree-vect-stmts.c (vectorizable_load): Reset stmt_info
back to the first scalar stmt rather than the
SLP_TREE_REPRESENTATIVE to match previous behavior.
Fei Yang [Fri, 5 Jun 2020 09:34:59 +0000 (10:34 +0100)]
expand: Simplify removing subregs when expanding a copy [PR95254]
In rtl expand, if we have a copy that matches one of the following patterns:
(set (subreg:M1 (reg:M2 ...)) (subreg:M1 (reg:M2 ...)))
(set (subreg:M1 (reg:M2 ...)) (mem:M1 ADDR))
(set (mem:M1 ADDR) (subreg:M1 (reg:M2 ...)))
(set (subreg:M1 (reg:M2 ...)) (constant C))
where mode M1 is equal in size to M2, try to detect whether the mode change
involves an implicit round trip through memory. If so, see if we can avoid
that by removing the subregs and doing the move in mode M2 instead.
2020-06-05 Felix Yang <felix.yang@huawei.com>
gcc/
PR target/95254
* expr.c (emit_move_insn): Check src and dest of the copy to see
if one or both of them are subregs, try to remove the subregs when
innermode and outermode are equal in size and the mode change involves
an implicit round trip through memory.
gcc/testsuite/
PR target/95254
* gcc.target/aarch64/pr95254.c: New test.
* gcc.target/i386/pr67609.c: Check "movq\t%xmm0" instead of "movdqa".
Jakub Jelinek [Fri, 5 Jun 2020 08:44:23 +0000 (10:44 +0200)]
ix86: Improve __builtin_c[lt]z followed by extension [PR95535]
In January I've added patterns to optimize SImode -> DImode sign or zero
extension of __builtin_popcount, this patch does the same for
__builtin_c[lt]z. Like most other instructions, the [tl]zcntl instructions
clear the upper 32 bits of the destination register and as the instructions
only result in values 0 to 32 inclusive, both sign and zero extensions
behave the same.
2020-06-05 Jakub Jelinek <jakub@redhat.com>
PR target/95535
* config/i386/i386.md (*ctzsi2_zext, *clzsi2_lzcnt_zext): New
define_insn_and_split patterns.
(*ctzsi2_zext_falsedep, *clzsi2_lzcnt_zext_falsedep): New
define_insn patterns.
* gcc.target/i386/pr95535-1.c: New test.
* gcc.target/i386/pr95535-2.c: New test.
Jonathan Wakely [Fri, 22 May 2020 06:22:50 +0000 (07:22 +0100)]
Add new/delete to struct occurence
This adds an example how to use new/delete operators to pool
allocated objects.
2020-06-04 Jonathan Wakely <jwakely@redhat.com>
* alloc-pool.h (object_allocator::remove_raw): New.
* tree-ssa-math-opts.c (struct occurrence): Use NSMDI.
(occurrence::occurrence): Add.
(occurrence::~occurrence): Likewise.
(occurrence::new): Likewise.
(occurrence::delete): Likewise.
(occ_new): Remove.
(insert_bb): Use new occurence (...) instead of occ_new.
(register_division_in): Likewise.
(free_bb): Use delete occ instead of manually removing
from the pool.
Richard Biener [Thu, 4 Jun 2020 11:44:58 +0000 (13:44 +0200)]
middle-end/95493 - bogus MEM_ATTRS for variable array access
The following patch avoids keeping the inherited MEM_ATTRS when
set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF.
The inherited ones may not reflect the correct offset and neither
does the updated alias-set match the inherited MEM_EXPR. This all
ends up confusing path-based alias-analysis, causing wrong-code.
The fix is to stop not adopting a MEM_EXPR for certain kinds of
expressions and instead handle everything we can. There's still
the constant kind trees case which I'm too lazy to look into right
now. I did refrain from adding SSA_NAME there and instead avoided
calling set_mem_attributes_minus_bitpos when debug expression
expansion ended up expanding a SSA definition RHS which should
already have taken care of setting the appropriate MEM_ATTRS.
2020-06-04 Richard Biener <rguenther@suse.de>
PR middle-end/95493
* cfgexpand.c (expand_debug_expr): Avoid calling
set_mem_attributes_minus_bitpos when we were expanding
an SSA name.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Remove
ARRAY_REF special-casing, add CONSTRUCTOR to the set of
special-cases we do not want MEM_EXPRs for. Assert
we end up with reasonable MEM_EXPRs.
Jonathan Wakely [Thu, 4 Jun 2020 22:20:49 +0000 (23:20 +0100)]
libstdc++: Remove workarounds for constrained nested class templates
With PR c++/92078 and PR c++/92103 both fixed, nested class templates
can now be constrained. That means a number of namespace-scope helpers
can be moved to the class scope, so they're only visible where they're
needed.
* include/bits/iterator_concepts.h (__detail::__ptr, __detail::__ref)
(__detail::__cat, __detail::__diff): Move to class scope in the
relevant __iterator_traits specializations.
(__iterator_traits<>): Use nested class templates instead of ones from
namespace __detail.
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move to
class scope in iterator_traits<common_iterator<I, S>>.
(iterator_traits<common_iterator<I, S>>): Use nested class template
instead of __detail::__common_iter_ptr.
Martin Sebor [Thu, 4 Jun 2020 22:06:10 +0000 (16:06 -0600)]
Implement a solution for PR middle-end/10138 and PR middle-end/95136.
PR middle-end/10138 - warn for uninitialized arrays passed as const arguments
PR middle-end/95136 - missing -Wuninitialized on an array access with a variable offset
François Dumont [Wed, 22 Jan 2020 17:21:28 +0000 (18:21 +0100)]
libstdc++: Specialize copy/copy_n for istreambuf_iterator and deque iterators
Add __copy_n_a overloads for std::deque iterators to replace with C memmove
when possible. Expose std::copy_n implementation details in pre-C++11 modes
and use it for std::copy overloads.
The code in constexpr for looking up the actual type of the object and then
getting the virtual function from there broke for both of these tests: for
16, it assumed incorrectly that the DECL_VINDEX would apply to the most
derived type's vtable; for 17, it failed to consider that during
construction the base subobject is treated as being of the base type.
Fixed by just doing constant evaluation of the expression that looks up the
function in the vtable. This means that a virtual call will involve loading
the vptr, so we will reject some calls through non-constexpr variables that
we previously accepted, but this seems appropriate to me. None of our
testcases were affected.
Jason Merrill [Thu, 4 Jun 2020 03:50:06 +0000 (23:50 -0400)]
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code that the PR67184 patch moved to
build_over_call, and instead looking up the overrider in BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
Iain Sandoe [Thu, 4 Jun 2020 16:14:37 +0000 (17:14 +0100)]
coroutines: Fix missed ramp function return copy elision [PR95346].
Confusingly, "get_return_object ()" can do two things:
- Firstly it can provide the return object for the ramp function (as
the name suggests).
- Secondly if the type of the ramp function is different from that
of the get_return_object call, this is used as a single parameter
to a CTOR for the ramp's return type.
In the first case we can rely on finish_return_stmt () to do the
necessary processing for copy elision.
In the second case, we should have passed a prvalue to the CTOR as
per the standard comment, but I had omitted the rvalue () call. Fixed
thus.
gcc/cp/ChangeLog:
PR c++/95346
* coroutines.cc (morph_fn_to_coro): Ensure that the get-
return-object is constructed correctly; When it is not the
final return value, pass it to the CTOR of the return type
as an rvalue, per the standard comment.
gcc/testsuite/ChangeLog:
PR c++/95346
* g++.dg/coroutines/pr95346.C: New test.
Thomas Schwinge [Thu, 4 Jun 2020 14:13:35 +0000 (16:13 +0200)]
[OpenACC 'exit data'] Evaluate 'copyfrom' individually for 'GOMP_MAP_STRUCT' entries
Currently, we don't at all evaluate 'copyfrom' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'copyfrom' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: Update.
Thomas Schwinge [Thu, 4 Jun 2020 14:01:07 +0000 (16:01 +0200)]
[OpenACC 'exit data'] Evaluate 'finalize' individually for 'GOMP_MAP_STRUCT' entries
Currently, we don't at all evaluate 'finalize' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'finalize' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: New file.
* testsuite/libgomp.oacc-c-c++-common/struct-refcount-1.c: Remove
file.
Thomas Schwinge [Wed, 6 May 2020 08:05:49 +0000 (10:05 +0200)]
'libgomp.oacc-fortran/{error_,}stop-{1,2,3}.f': initialize before the checkpoint
If, for example, GCC is configured such that 'libgomp-plugin-nvptx.so.1'
dynamically links against 'libcuda.so.1', but testing is run on a system where
there is no 'libcuda.so.1', this produces output such as:
PASS: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O0 (test for excess errors)
PASS: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O0 execution test
FAIL: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O0 output pattern test, is CheCKpOInT
libgomp: while loading libgomp-plugin-nvptx.so.1: libcuda.so.1: cannot open shared object file: No such file or directory
ERROR STOP
Error termination. Backtrace: [...]
, should match CheCKpOInT(
|
|^M)+ERROR STOP (
|
|^M)+Error termination.*
..., where after 'CheCKpOInT' we got 'libgomp: while loading [...]' injected
before the expected 'ERROR STOP'.
Add processing STRICT_LOW_PART for matched reloads.
2020-06-04 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/95464
* lra.c (lra_emit_move): Add processing STRICT_LOW_PART.
* lra-constraints.c (match_reload): Use STRICT_LOW_PART in output
reload if the original insn has it too.
Richard Biener [Thu, 4 Jun 2020 15:26:36 +0000 (16:26 +0100)]
aarch64: PR target/95526: Fix gimplification of varargs
This patch fixes a latent bug exposed by eb72dc663e9070b281be83a80f6f838a3a878822 in the aarch64 backend that was
causing wrong codegen and several testsuite failures. See the discussion
on the bug for details.
Bootstrapped and regtested on aarch64-linux-gnu. Cleaned up several
failing tests and no new fails introduced.
2020-06-04 Richard Biener <rguenther@suse.de>
gcc/:
* config/aarch64/aarch64.c (aarch64_gimplify_va_arg_expr):
Ensure that tmp_ha is marked TREE_ADDRESSABLE.
Martin Jambor [Thu, 4 Jun 2020 15:03:27 +0000 (17:03 +0200)]
ipa-sra: Do not remove statements necessary because of non-call EH (PR 95113)
PR 95113 revealed that when reasoning about which parameters are dead,
IPA-SRA does not perform the same check related to non-call exceptions
as tree DCE. It most certainly should and so this patch moves the
condition used in tree-ssa-dce.c into a separate predicate (in
tree-eh.c) and uses it from both places.
gcc/ChangeLog:
2020-05-27 Martin Jambor <mjambor@suse.cz>
PR ipa/95113
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Move non-call
exceptions check to...
* tree-eh.c (stmt_unremovable_because_of_non_call_eh_p): ...this
new function.
* tree-eh.h (stmt_unremovable_because_of_non_call_eh_p): Declare it.
* ipa-sra.c (isra_track_scalar_value_uses): Use it. New parameter
fun.
[ARM]: Correct the grouping of operands in MVE vector scatter store intrinsics (PR94735).
The operands in RTL patterns of MVE vector scatter store intrinsics are wrongly grouped,
because of which few vector loads and stores instructions are wrongly getting optimized
out with -O2.
A new predicate "mve_scatter_memory" is defined in this patch, this predicate returns TRUE on
matching: (mem(reg)) for MVE scatter store intrinsics.
This patch fixes the issue by adding define_expand pattern with "mve_scatter_memory" predicate
and calls the corresponding define_insn by passing register_operand as first argument.
This register_operand is extracted from the operand with "mve_scatter_memory" predicate in
define_expand pattern.
Richard Biener [Thu, 4 Jun 2020 12:59:16 +0000 (14:59 +0200)]
add vect_get_slp_vect_def
This adds vect_get_slp_vect_def to get at a SLP nodes vectorized def,
abstracting away the details. It also fixes one stray failure to
use SLP_TREE_REPRESENTATIVE.
2020-05-04 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (vect_get_slp_vect_def): Declare.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use it.
* tree-vect-stmts.c (vect_transform_stmt): Likewise.
(vect_is_simple_use): Use SLP_TREE_REPRESENTATIVE.
* tree-vect-slp.c (vect_get_slp_vect_defs): Fold into single
use ...
(vect_get_slp_defs): ... here.
(vect_get_slp_vect_def): New function.
Jonathan Wakely [Thu, 4 Jun 2020 12:52:21 +0000 (13:52 +0100)]
libstdc++: Make std::copy_n work with negative and non-integral sizes
Since it was added in C++11, std::copy_n and std::ranges::copy_n should
do nothing given a negative size, but for random access iterators we add
the size to the iterator, possibly resulting in undefined behaviour.
Also, C++20 clarified that std::copy_n requires the Size type to be
convertible to an integral type. We previously assumed that it could be
directly used in arithmetic expressions, without conversion to an
integral type.
This also fixes a bug in the random_access_iterator_wrapper helper adds
some convenience aliases for using the iterator wrappers.
libstdc++-v3/ChangeLog:
* include/bits/ranges_algobase.h (__copy_n_fn): Only call
ranges::copy for positive values.
* include/bits/stl_algo.h (copy_n): Convert Size argument to an
integral type and only call __copy_n for positive values.
* testsuite/util/testsuite_iterators.h
(random_access_iterator_wrapper::operator+=): Fix range check for
negative values.
(output_container, input_container, forward_container)
(bidirectional_container, random_access_container): New alias
templates.
* testsuite/25_algorithms/copy_n/5.cc: New test.
Richard Biener [Thu, 4 Jun 2020 12:17:21 +0000 (14:17 +0200)]
Simplify SLP code wrt SLP_TREE_DEF_TYPE
The following removes the ugly pushing of SLP_TREE_DEF_TYPE to
stmt_infos and instead makes sure to handle invariants fully
in vect_is_simple_use plus adjusting a few places I refrained
from touching when enforcing vector types for them.
It also simplifies building SLP nodes with all external operands
from scalars by not doing that in the parent but instead not
building those from the start. That also gets rid of
vect_update_all_shared_vectypes.
2020-06-04 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_update_all_shared_vectypes): Remove.
(vect_build_slp_tree_2): Simplify building all external op
nodes from scalars.
(vect_slp_analyze_node_operations): Remove push/pop of
STMT_VINFO_DEF_TYPE.
(vect_schedule_slp_instance): Likewise.
* tree-vect-stmts.c (ect_check_store_rhs): Pass in the
stmt_info, use the vect_is_simple_use overload combining
SLP and stmt_info analysis.
(vect_is_simple_cond): Likewise.
(vectorizable_store): Adjust.
(vectorizable_condition): Likewise.
(vect_is_simple_use): Fully handle invariant SLP nodes
here. Amend stmt_info operand extraction with COND_EXPR
and masked stores.
* tree-vect-loop.c (vectorizable_reduction): Deal with
COND_EXPR representation ugliness.
liuhongt [Fri, 29 May 2020 05:38:49 +0000 (13:38 +0800)]
Fix zero-masking for vcvtps2ph when dest operand is memory.
When dest is memory, zero-masking is not valid, only merging-masking is available,
2020-06-24 Hongtao Liu <hongtao.liu@inte.com>
gcc/ChangeLog:
PR target/95254
* config/i386/sse.md (*vcvtps2ph_store<merge_mask_name>):
Refine from *vcvtps2ph_store<mask_name>.
(vcvtps2ph256<mask_name>): Refine constraint from vm to v.
(<mask_codefor>avx512f_vcvtps2ph512<mask_name>): Ditto.
(*vcvtps2ph256<merge_mask_name>): New define_insn.
(*avx512f_vcvtps2ph512<merge_mask_name>): Ditto.
* config/i386/subst.md (merge_mask): New define_subst.
(merge_mask_name): New define_subst_attr.
(merge_mask_operand3): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512f-vcvtps2ph-pr95254.c: New test.
* gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c: Ditto.
Ed Schonberg [Fri, 24 Jan 2020 19:14:14 +0000 (14:14 -0500)]
[Ada] Ada_2020: contracts for formal subprograms
2020-06-04 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Build_Suprogram_Body_Wrapper,
Build_Subprogram_Decl_Wrapper): New suprograms, to create the
wrappers needed to implement contracts on formsl subprograms at
the point of instantiation.
(Build_Subprogram_Wrappers): New subprogram within
Analyze_Associations, calls the above when the formal subprogram
has contracts, and expansion is enabled.
(Instantiate_Formal_Subprogram): If the actual is not an entity,
such as a function attribute, or a synchronized operation,
create a function with an internal name and call it within the
wrapper.
(Analyze_Generic_Formal_Part): Analyze contracts at the end of
the list of formal declarations.
* sem_prag.adb (Analyze_Pre_Post_Condtion): In Ada_2020 the
aspect and corresponding pragma can appear on a formal
subprogram declaration.
(Find_Related_Declaration_Or_Body): Ditto.
Bob Duff [Tue, 28 Jan 2020 20:06:41 +0000 (15:06 -0500)]
[Ada] Put_Image attribute
2020-06-04 Bob Duff <duff@adacore.com>
gcc/ada/
* libgnat/a-stobbu.adb, libgnat/a-stobbu.ads,
libgnat/a-stobfi.adb, libgnat/a-stobfi.ads,
libgnat/a-stoubu.adb, libgnat/a-stoubu.ads,
libgnat/a-stoufi.adb, libgnat/a-stoufi.ads,
libgnat/a-stoufo.adb, libgnat/a-stoufo.ads,
libgnat/a-stouut.adb, libgnat/a-stouut.ads,
libgnat/a-stteou.ads, libgnat/s-putaim.adb,
libgnat/s-putaim.ads, libgnat/s-putima.adb, libgnat/s-putima.ads
(Ada.Strings.Text_Output and children, System.Put_Images): New
runtime support for Put_Image.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add
exp_put_image.o.
* exp_put_image.adb, exp_put_image.ads: New compiler package
that generates calls to runtime routines that implement
Put_Image.
* Makefile.rtl: Add object files for Ada.Strings.Text_Output and
children and System.Put_Images.
* aspects.adb: Simplify initialization of Canonical_Aspect.
* aspects.ads: Improve documentation. Add Aspect_Put_Image.
* exp_attr.adb: Add support for Put_Image, by calling routines
in Exp_Put_Image.
* sem_util.adb (Is_Predefined_Dispatching_Operation): Return
True for new TSS_Put_Image operation.
* exp_ch3.adb: For tagged types, build a dispatching
TSS_Put_Image operation by calling routines in Exp_Put_Image.
* exp_disp.adb, exp_disp.ads: Make TSS_Put_Image be number 10,
adjusting other operations' numbers after 10. We choose 10
because that's the last number shared by all runtimes.
* exp_strm.adb: Use named notation as appropriate.
* exp_cg.adb, exp_tss.ads: Add TSS_Put_Image.
* libgnat/a-tags.ads: Modify Max_Predef_Prims for the new
TSS_Put_Image.
* impunit.adb: Add new runtime packages.
* rtsfind.adb, rtsfind.ads: Add support for
Ada.Strings.Text_Output, Ada.Strings.Text_Output.Utils, and
System.Put_Images.
* sem_attr.adb: Error checking for Put_Image calls.
* sem_ch12.adb (Valid_Default_Attribute): Support for passing
Put_Image as a generic formal parameter.
* sem_ch13.adb: Analysis of Put_Image aspect. Turn it into a
Put_Image attribute definition clause.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Support for
renaming of the Put_Image attribute.
* snames.adb-tmpl: Fix comments.
* snames.ads-tmpl (Name_Put_Image): New Name_Id.
(Attribute_Put_Image): New Attribute_Id.
* tbuild.adb, tbuild.ads (Make_Increment): New utility.