Re: C++ delayed folding branch review
On 06/12/2015 12:11 PM, Kai Tietz wrote: @@ -589,9 +589,9 @@ null_member_pointer_value_p (tree t) return false; else if (TYPE_PTRMEMFUNC_P (type)) return (TREE_CODE (t) == CONSTRUCTOR - && integer_zerop (CONSTRUCTOR_ELT (t, 0)->value)); + && integer_zerop (fold (CONSTRUCTOR_ELT (t, 0)->value))); else if (TYPE_PTRDATAMEM_P (type)) -return integer_all_onesp (t); +return integer_all_onesp (fold (t)); Again, calling fold here is wrong; it doesn't handle constexpr, and we should have folded before we got here. Agreed. I will commit change for this. Nevertheless CONSTRUCTOR_ELT's value might still be prefixed by nops due possible overflows, or by negative sign/invert/etc. It shouldn't in any calls to this function; the argument to this function should have already been folded. @@ -5090,9 +5090,9 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, valid_operands: result = build3 (COND_EXPR, result_type, arg1, arg2, arg3); - if (!cp_unevaluated_operand) + if (!cp_unevaluated_operand && !processing_template_decl) /* Avoid folding within decltype (c++/42013) and noexcept. */ -result = fold_if_not_in_template (result); +result = fold (result); This seems related to your status report note: Additionally addressed issue about cond_expr, as we want to fold cases with a constant-condition. Here we need to use "fold_to_constant" so that we just fold things to constant-value, if possible and otherwise don't modify anything. But why do you say we want to fold cases with a constant condition? We certainly want to avoid warning about the dead branch in that case, but it would be better if we can do that folding only in the warning code. Issue is that we otherwise detect in conditions that expressions aren't constant due never-executed-code-path. How so? The code for determining whether an expression is constant should do the folding. I think the way to avoid warnings about dead code paths is to do the folding in cp_parser_question_colon_clause and in tsubst_copy_and_build, case COND_EXPR. The diagnostics we can deal differently, but this was actually the reason for doing this. I can remove this here, but we still need a place to avoid ill detection of constexpr (or invalid code) on dead code-branch. Eg. (1 ? 0/0 : 1) etc @@ -7382,8 +7383,13 @@ build_over_call (struct z_candidate *cand, int flags, tsu bst_flags_t complain) gcc_assert (j <= nargs); nargs = j; + { +tree *fargs = (!nargs ? argarray : (tree *) alloca (nargs * sizeof (tree))) ; +for (j = 0; j < nargs; j++) + fargs[j] = fold_non_dependent_expr (argarray[j]); No change needed here, but I notice that fold_non_dependent_expr is still using maybe_constant_value; it should probably use cp_fully_fold instead. Hmm, maybe we should limit this folding on constants. So cp_fold_to_constant ()? This folding is just for diagnostics, so I think cp_fully_fold is the right choice. @@ -1052,6 +1054,9 @@ adjust_temp_type (tree type, tree temp) { if (TREE_TYPE (temp) == type) return temp; + STRIP_NOPS (temp); + if (TREE_TYPE (temp) == type) +return temp; @@ -1430,6 +1438,8 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, bool reduced_constant_expression_p (tree t) { + /* Make sure we remove useless initial NOP_EXPRs. */ + STRIP_NOPS (t); Within the constexpr code we should be folding away NOPs as they are generated, they shouldn't live this long. Well, we might see them on overflows ... We shouldn't within the constexpr code. NOPs for expressions that are non-constant due to overflow are added in cxx_eval_outermost_constant_expr, so we shouldn't see them in the middle of constexpr evaluation. @@ -1088,7 +1093,10 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t, && is_dummy_object (x)) { x = ctx->object; - x = cp_build_addr_expr (x, tf_warning_or_error); + if (x) + x = cp_build_addr_expr (x, tf_warning_or_error); + else + x = get_nth_callarg (t, i); This still should not be necessary. Yeah, most likely. But I got initially here some issues, so I don't see that this code would worsen things. If this code path is hit, that means something has broken my design, and I don't want to just paper over that. Please revert this change. @@ -1576,13 +1586,15 @@ cxx_eval_unary_expression (const constexpr_ctx *ctx, tre e t, enum tree_code code = TREE_CODE (t); tree type = TREE_TYPE (t); r = fold_unary_loc (loc, code, type, arg); - if (r == NULL_TREE) + if (r == NULL_TREE || !CONSTANT_CLASS_P (r)) { if (arg == orig_arg) r = t; else r = build1_loc (loc, code, type, arg); } + else +r = unify_constant (ctx, r, overflow_p); This still should not be necessary. Well, I just wanted to make sure that if arg i
Re: [PATCH] Fix PR66509
On Jun 12, 2015, at 8:25 PM, Jack Howarth wrote: > The attached patch revises the tests for the filds and fists > mnemonics to use the assembly... > > filds mem(%rip); fists mem(%rip) > Okay for gcc trunk? Fine from a darwin perspective, but I would like an x86 binutils person to weigh in to make sure we aren’t turning off detection on some system that supports the previous version but not the new spelling.
[PATCH] Fix PR66509
The attached patch revises the tests for the filds and fists mnemonics to use the assembly... filds mem(%rip); fists mem(%rip) and the test for the fildq and fistq mnemonics to use the assembly... fildq mem(%rip); fistpq mem(%rip) which will assemble for both 64-bit and 32-bit mode. This is required to avoid "ambiguous instructions require an explicit suffix" errors from the clang-based assembler in Xcode 7. The change also has the side-benefit of allowing the legacy GNU assembler from Xcode 6.3 or earlier to properly detect that the filds, fists, fildq and fistq mnemonics are available on x86_64-apple-darwin. Bootstrapped tested on x86_64-apple-darwin14 against the Apple Inc version cctools-870, GNU assembler version 1.38 and on x86_64-apple-darwin15 against the new clang-based assembler. Okay for gcc trunk? Jack PR66509.patch Description: Binary data
Re: [PATCH] fix final piece of PR66448 (Bootstrap fail on Darwin, after 224161).
OK. Jason
Re: [PATCH] Adding warning for constexpr's
On Fri, 12 Jun 2015, Andres Tiraboschi wrote: > Hi, this patch is for adding a warning when a constexpr cannot be evaluated > at compile time. > This is a single case: > type var = fun(args...), with fun declared as a constexpr. All options need documenting in invoke.texi. All diagnostics need testcases added to the testsuite. C++-specific options go in c.opt and should be listed as C++ ObjC++, not Common. All new diagnostics should use warning_at etc. with explicit locations passed, unless there is some strong reason it's hard to get the relevant location when the warning is given. -- Joseph S. Myers jos...@codesourcery.com
[PATCH] Adding warning for constexpr's
Hi, this patch is for adding a warning when a constexpr cannot be evaluated at compile time. This is a single case: type var = fun(args...), with fun declared as a constexpr. diff --git a/gcc/common.opt b/gcc/common.opt index b49ac46..88374b1 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -581,6 +581,10 @@ Winline Common Var(warn_inline) Warning Warn when an inlined function cannot be inlined +Wconstexpr +Common Var(warn_constexpr) Warning +Warn when a constexpr function is not evaluated at compile time + Winvalid-memory-model Common Var(warn_invalid_memory_model) Init(1) Warning Warn when an atomic memory model parameter is known to be outside the valid range. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 80a6939..e25c240 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -842,6 +842,15 @@ store_init_value (tree decl, tree init, vec** cleanups, int flags) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = const_init; TREE_CONSTANT (decl) = const_init && decl_maybe_constant_var_p (decl); } + else if (TREE_CODE(init) == CALL_EXPR) +{ + tree fn = TREE_OPERAND(CALL_EXPR_FN(init), 0); + if (DECL_DECLARED_CONSTEXPR_P(fn) && warn_constexpr) +{ + warning (OPT_Wconstexpr, "function %q+F cannot be evaluated at compile time", fn); + warning (OPT_Wconstexpr, "called from here"); +} +} if (cxx_dialect >= cxx14) /* Handle aggregate NSDMI in non-constant initializers, too. */
fix PR46029: reimplement if conversion of loads and stores
Hi everybody! In the current implementation of if conversion, loads and stores are if-converted in a thread-unsafe way: * loads were always executed, even when they should have not been. Some source code could be rendered invalid due to null pointers that were OK in the original program because they were never dereferenced. * writes were if-converted via load/maybe-modify/store, which renders some code multithreading-unsafe. This patch reimplements if-conversion of loads and stores in a safe way using a scratchpad allocated by the compiler on the stack: * loads are done through an indirection, reading either the correct data from the correct source [if the condition is true] or reading from the scratchpad and later ignoring this read result [if the condition is false]. * writes are also done through an indirection, writing either to the correct destination [if the condition is true] or to the scratchpad [if the condition is false]. Vectorization of "if-cvt-stores-vect-ifcvt-18.c" disabled because the old if-conversion resulted in unsafe code that could fail under multithreading even though the as-written code _was_ thread-safe. Passed regression testing and bootstrap on amd64-linux. Is this OK to commit to trunk? Regards, Abe 2015-06-12 Sebastian Pop Abe Skolnik PR tree-optimization/46029 * tree-data-ref.c (struct data_ref_loc_d): Moved... (get_references_in_stmt): Exported. * tree-data-ref.h (struct data_ref_loc_d): ... here. (get_references_in_stmt): Declared. * doc/invoke.texi (-ftree-loop-if-convert-stores): Update description. * tree-if-conv.c (struct ifc_dr): Removed. (IFC_DR): Removed. (DR_WRITTEN_AT_LEAST_ONCE): Removed. (DR_RW_UNCONDITIONALLY): Removed. (memrefs_read_or_written_unconditionally): Removed. (write_memrefs_written_at_least_once): Removed. (ifcvt_could_trap_p): Does not take refs parameter anymore. (ifcvt_memrefs_wont_trap): Removed. (has_non_addressable_refs): New. (if_convertible_gimple_assign_stmt_p): Call has_non_addressable_refs. Removed use of refs. (if_convertible_stmt_p): Removed use of refs. (if_convertible_gimple_assign_stmt_p): Same. (if_convertible_loop_p_1): Removed use of refs. Remove initialization of dr->aux, DR_WRITTEN_AT_LEAST_ONCE, and DR_RW_UNCONDITIONALLY. (insert_address_of): New. (create_scratchpad): New. (create_indirect_cond_expr): New. (predicate_mem_writes): Call create_indirect_cond_expr. Take an extra parameter for scratch_pad. (combine_blocks): Same. (tree_if_conversion): Same. testsuite/ * g++.dg/tree-ssa/ifc-pr46029.C: New. * gcc.dg/tree-ssa/ifc-5.c: Make it exactly like the FFmpeg kernel. * gcc.dg/tree-ssa/ifc-8.c: New. * gcc.dg/tree-ssa/ifc-9.c: New. * gcc.dg/tree-ssa/ifc-10.c: New. * gcc.dg/tree-ssa/ifc-11.c: New. * gcc.dg/tree-ssa/ifc-12.c: New. * gcc.dg/vect/if-cvt-stores-vect-ifcvt-18.c: Disabled. * gcc.dg/vect/if-cvt-stores-vect-ifcvt-19.c: New. --- gcc/ChangeLog | 28 ++ gcc/doc/invoke.texi| 18 +- gcc/testsuite/g++.dg/tree-ssa/ifc-pr46029.C| 76 gcc/testsuite/gcc.dg/tree-ssa/ifc-10.c | 17 + gcc/testsuite/gcc.dg/tree-ssa/ifc-11.c | 16 + gcc/testsuite/gcc.dg/tree-ssa/ifc-12.c | 13 + gcc/testsuite/gcc.dg/tree-ssa/ifc-5.c | 19 +- gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c | 29 ++ gcc/testsuite/gcc.dg/tree-ssa/ifc-9.c | 17 + .../gcc.dg/vect/if-cvt-stores-vect-ifcvt-18.c | 10 +- .../gcc.dg/vect/if-cvt-stores-vect-ifcvt-19.c | 46 +++ gcc/tree-data-ref.c| 13 +- gcc/tree-data-ref.h| 14 + gcc/tree-if-conv.c | 392 + 14 files changed, 460 insertions(+), 248 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/ifc-pr46029.C create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ifc-10.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ifc-11.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ifc-12.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ifc-8.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ifc-9.c create mode 100644 gcc/testsuite/gcc.dg/vect/if-cvt-stores-vect-ifcvt-19.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3dec6b1..70af07c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2015-05-18 Sebastian Pop + + PR tree-optimization/46029 + * doc/invoke.texi (-ftree-loop-if-convert-stores): Update description. + * tree-if-conv.c (has_unaligned_memory_refs): New. + (if_convertible_gimple_assign_stmt_p): Call has_unali
[PATCH, AARCH64] movi type attribute confusion
We have 5 patterns that can emit the movi instruction. These patterns map it to 4 different type attributes. The mov_aarch64 pattern uses mov_imm. The movdi_aarch64 pattern uses fmov. The movtf_aarch64 pattern uses fconstd. And the two aarch64_simd_mov patterns for VD and VQ use neon_move. Bitwise identical instructions should always map to the same attribute type, so we need to change these patterns to agree on the right attribute. movi is an integer simd instruction, so neon_move is the only choice that makes sense. The following patch corrects the first 3 patterns to use neon_move like the last two. We could optionally create a new type attribute, e.g. neon_move_imm. I can do that if people think it would be better. This patch was tested with a make bootstrap and make check on an APM box running Ubuntu 14.04. FYI This patch overlaps with my movtf-zero patch which is still waiting review, but the overlap is trivial to resolve so this should not be a problem. Jim 2015-06-12 Jim Wilson * config/aarch64/aarch64.md (mov_aarch64): Change alternative 2 to use neon_move instead of mov_imm. (movdi_aarch64): Change alternative 14 to use neon_move not fmov. (movtf_aarch64): Change alternative 4 to use neon_move_q not fconstd. Index: config/aarch64/aarch64.md === --- config/aarch64/aarch64.md (revision 224441) +++ config/aarch64/aarch64.md (working copy) @@ -827,7 +827,7 @@ (define_insn "*mov_aarch64" gcc_unreachable (); } } - [(set_attr "type" "mov_reg,mov_imm,mov_imm,load1,load1,store1,store1,\ + [(set_attr "type" "mov_reg,mov_imm,neon_move,load1,load1,store1,store1,\ neon_to_gp,neon_from_gp,neon_dup") (set_attr "simd" "*,*,yes,*,*,*,*,yes,yes,yes")] ) @@ -912,7 +912,7 @@ (define_insn_and_split "*movdi_aarch64" DONE; }" [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,mov_imm,load1,load1,store1,store1,\ - adr,adr,f_mcr,f_mrc,fmov,fmov") + adr,adr,f_mcr,f_mrc,fmov,neon_move") (set_attr "fp" "*,*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes,*") (set_attr "simd" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes")] ) @@ -1063,7 +1063,7 @@ (define_insn "*movtf_aarch64" str\\t%q1, %0 ldp\\t%0, %H0, %1 stp\\t%1, %H1, %0" - [(set_attr "type" "logic_reg,multiple,f_mcr,f_mrc,fconstd,fconstd,\ + [(set_attr "type" "logic_reg,multiple,f_mcr,f_mrc,neon_move_q,fconstd,\ f_loadd,f_stored,neon_load1_2reg,neon_store1_2reg") (set_attr "length" "4,8,8,8,4,4,4,4,4,4") (set_attr "fp" "*,*,yes,yes,*,yes,yes,yes,*,*")
Re: [PATCH, AARCH64] improve long double 0.0 support
On 06/03/2015 05:35 PM, Jim Wilson wrote: > I noticed that poor code is emitted for a long double 0.0. ping https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00370.html Jim
C++ PATCH for c++/65719 (link error with constexpr variable template)
In this testcase, the problem is that const variables are implicitly static, and static variables get DECL_INTERFACE_KNOWN set. Then when instantiating the variable we set DECL_EXTERNAL, with the effect that we are saying that we know that we aren't defining the variable in the current translation unit. We ought to set DECL_NOT_REALLY_EXTERN at the same time, as we do various other places. Tested x86_64-pc-linux-gnu, applying to trunk and 5. commit ce66414682d1e895700ae8cc96bad49d876db23a Author: Jason Merrill Date: Fri Jun 12 11:41:24 2015 -0400 PR c++/65719 * pt.c (tsubst_decl) [VAR_DECL]: Mark namespace-scope variables as DECL_NOT_REALLY_EXTERN. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7f04fe6..ea8c8b6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11306,8 +11306,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) { /* T is a static data member or namespace-scope entity. We have to substitute into namespace-scope variables - (even though such entities are never templates) because - of cases like: + (not just variable templates) because of cases like: template void f() { extern T t; } @@ -11468,6 +11467,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) initializer is present. We mimic the non-template processing here. */ DECL_EXTERNAL (r) = 1; + if (DECL_NAMESPACE_SCOPE_P (t)) + DECL_NOT_REALLY_EXTERN (r) = 1; DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec); SET_DECL_IMPLICIT_INSTANTIATION (r); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ29.C b/gcc/testsuite/g++.dg/cpp1y/var-templ29.C new file mode 100644 index 000..22f5b0b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ29.C @@ -0,0 +1,13 @@ +// PR c++/65719 +// { dg-do link { target c++14 } } + +struct FunctionObject { +void operator()() const { } +}; + +template +constexpr FunctionObject f{}; + +int main() { +f(); +}
Debug mode enhancements
Hi This is a patch to: - Enhance __get_distance to get a better feedback about distance between iterators so that we can take sharper decision about what is right or not. This function is now aware about safe iterators and leverage on those a little like std::distance does with C++ 11 list::iterator. - Make debug mode aware about iterator adapters reverse_iterator and move_iterator. - Thanks to previous points this patch also extend situations where it is possible to remove debug layers on iterators to lower performance hint of this mode. We now detect at runtime if we know enough about the iterator range to get rid of the potential debug layer. For the last point I introduced __gnu_debug::__unsafe which remove debug layer unconditionally in opposition to __gnu_debug::__base which do so only for random access iterator. The latter has been kept to be used in context of constructors. I had to introduced new debug headers to limit impact in stl_iterator.h. We shall not include debug.h here as the purpose is not to inject debug checks in the normal code. Note that the new __get_distance will be very useful to implement proper debug algos Here is the tricky part for me, the ChangeLog entry, much more complicated than the code :-) * include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode. * include/debug/functions.h (__gnu_debug::__valid_range, __gnu_debug::__base): Move... * include/debug/safe_iterator.h (__gnu_debug::_Sequence_traits): New. (__gnu_debug::__get_distance_from_begin): New. (__gnu_debug::__get_distance_to_end): New. (__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range distance information. Add optional check_dereferenceable parameter, default true. (__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move default definition... (__gnu_debug::__get_distance): New overload for _Safe_iterator. (__gnu_debug::__unsafe): Likewise. * include/debug/helper_functions.h: ...here. New. (__gnu_debug::__unsafe): New helper function to remove safe iterator layer. * include/debug/stl_iterator.h: New. Include latter. * include/bits/stl_iterator.h: Include latter in debug mode. * include/debug/stl_iterator.tcc: Adapt. * include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add overload for _Safe_local_iterator. (__gnu_debug::__unsafe): Likewise. * include/debug/safe_local_iterator.tcc: Adapt. * include/debug/macros.h (__glibcxx_check_valid_range2): New. (__glibcxx_check_insert_range): Add _Dist parameter. (__glibcxx_check_insert_range_after): Likewise. * include/debug/deque (deque<>::assign): Remove iterator debug layer when possible. (deque<>::insert): Likewise. * include/debug/forward_list (__glibcxx_check_valid_fl_range): New. (forward_list<>::splice_after): Use latter. (forward_list<>::assign): Remove iterator debug layer when possible. (forward_list<>::insert_after): Likewise. (__gnu_debug::_Sequence_traits<>): Partial specialization. * include/debug/list (list<>::assign): Remove iterator debug layer when possible. (list<>::insert): Likewise. [__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI. * include/debug/map.h (map<>::insert): Remove iterator debug layer when possible. * include/debug/multimap.h (multimap<>::insert): Likewise. * include/debug/set.h (set<>::insert): Likewise. * include/debug/multiset.h (multiset<>::insert): Likewise. * include/debug/string (basic_string<>::append, basic_string<>::assign, basic_string<>::insert, basic_string<>::replace): Likewise. * include/debug/unordered_map (unordered_map<>::insert, unordered_multimap<>::insert): Likewise. * include/debug/unordered_set (unordered_set<>::insert, unordered_multiset<>insert): Likewise. * include/debug/vector (vector<>::assign, vector<>::insert): Likewise. * include/Makefile.am: Add new debug headers. * include/Makefile.in: Regenerate. Being fully tested under Linux x86_64. François Index: include/Makefile.am === --- include/Makefile.am (revision 224246) +++ include/Makefile.am (working copy) @@ -766,6 +766,7 @@ ${debug_srcdir}/formatter.h \ ${debug_srcdir}/forward_list \ ${debug_srcdir}/functions.h \ + ${debug_srcdir}/helper_functions.h \ ${debug_srcdir}/list \ ${debug_srcdir}/map \ ${debug_srcdir}/macros.h \ @@ -785,6 +786,7 @@ ${debug_srcdir}/safe_unordered_container.tcc \ ${debug_srcdir}/set \ ${debug_srcdir}/set.h \ + ${debug_srcdir}/stl_iterator.h \ ${debug_srcdir}/string \ ${debug_srcdir}/unordered_map \ ${debug_srcdir}/unordered_set \ Index: include/Makefile.in === --- include/Makefile.in (revision 224246) +++ include/Makefile.in (working copy) @
[patch] PR debug/66482: Do not ICE in gen_formal_parameter_die
Sigh. I must say my head is spinning with this testcase and what we do with it (-O3), even prior to the debug-early work: void f(int p) {} int g() { void f(int p); g(); return 0; } The inliner recursively inlines this function up to a certain depth, but the useless inlining gets cleaned up shortly afterwards. However, the BLOCK_SOURCE_LOCATION are still set throughout which is technically correct. Eventually late dwarf gets a hold of all this and we end up calling dwarf2out_abstract_function to build debug info for the abstract instance of a function for which we have already generated a DIE for. Basically, a similar issue to what we encountered for template parameter packs. Or at least, that's my understanding, because as I've said, I admit to being slightly confused here. Since technically this is all going away when we remove dwarf2out_abstract_function, I suggest we remove the assert and avoid sudden death. It's not like the we generated useful debugging for this testcase anyhow. Aldy commit 80f8e8aefc3c628ad22cd2b17b28beb8bf4f3523 Author: Aldy Hernandez Date: Fri Jun 12 09:53:44 2015 -0700 * dwarf2out.c (gen_formal_parameter_die): Remove assert. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d2c516a..57a8e52 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -18023,18 +18023,14 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, { /* FIXME: Reuse DIE even with a differing context. -This happens when called through -dwarf2out_abstract_function for formal parameter -packs. The issue is that we're calling +This can happen when calling dwarf2out_abstract_function to build debug info for the abstract instance of a function for which we have already generated a DIE in dwarf2out_early_global_decl. -Once we remove dwarf2out_abstract_function, this -gcc_assert should be a gcc_unreachable. */ - gcc_assert (parm_die->die_parent->die_tag - == DW_TAG_GNU_formal_parameter_pack); +Once we remove dwarf2out_abstract_function, we should +have a call to gcc_unreachable here. */ } } diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr66482.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr66482.c new file mode 100644 index 000..880791c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr66482.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -gdwarf" } */ + +void f(int p) {} +int g() { + void f(); + g(); + return 0; +}
Re: [PATCH, rs6000, testsuite, PR65456] Changes for unaligned vector load/store support on POWER8
On Thu, Apr 30, 2015 at 01:34:18PM +0100, Bill Schmidt wrote: > On Thu, 2015-04-30 at 18:26 +0800, Bin.Cheng wrote: > > On Mon, Apr 27, 2015 at 9:26 PM, Bill Schmidt > > wrote: > > > On Mon, 2015-04-27 at 14:23 +0800, Bin.Cheng wrote: > > >> On Mon, Mar 30, 2015 at 1:42 AM, Bill Schmidt > > >> wrote: > > > > > >> > > >> > Index: gcc/testsuite/gcc.dg/vect/vect-33.c > > >> > === > > >> > --- gcc/testsuite/gcc.dg/vect/vect-33.c (revision 221118) > > >> > +++ gcc/testsuite/gcc.dg/vect/vect-33.c (working copy) > > >> > @@ -36,9 +36,10 @@ int main (void) > > >> >return main1 (); > > >> > } > > >> > > > >> > +/* vect_hw_misalign && { ! vect64 } */ > > >> > > > >> > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } > > >> > } */ > > >> > -/* { dg-final { scan-tree-dump "Vectorizing an unaligned access" > > >> > "vect" { target { vect_hw_misalign && { {! vect64} || > > >> > vect_multiple_sizes } } } } } */ > > >> > +/* { dg-final { scan-tree-dump "Vectorizing an unaligned access" > > >> > "vect" { target { { { ! powerpc*-*-* } && vect_hw_misalign } && { { ! > > >> > vect64 } || vect_multiple_sizes } } } } } */ > > >> > /* { dg-final { scan-tree-dump "Alignment of access forced using > > >> > peeling" "vect" { target { vector_alignment_reachable && { vect64 && > > >> > {! vect_multiple_sizes} } } } } } */ > > >> > /* { dg-final { scan-tree-dump-times "Alignment of access forced > > >> > using versioning" 1 "vect" { target { { {! vector_alignment_reachable} > > >> > || {! vect64} } && {! vect_hw_misalign} } } } } */ > > >> > /* { dg-final { cleanup-tree-dump "vect" } } */ > > >> > > >> Hi Bill, > > >> With this change, the test case is skipped on aarch64 now. Since it > > >> passed before, Is it expected to act like this on 64bit platforms? > > > > > > Hi Bin, > > > > > > No, that's a mistake on my part -- thanks for the report! That first > > > added line was not intended to be part of the patch: > > > > > > +/* vect_hw_misalign && { ! vect64 } */ > > > > > > Please try removing that line and verify that the patch succeeds again > > > for ARM. Assuming so, I'll prepare a patch to fix this. > > > > > > It looks like this mistake was introduced only in this particular test, > > > but please let me know if you see any other anomalies. > > Hi Bill, > > I chased the wrong branch. The test disappeared on fsf-48 branch in > > out build, rather than trunk. I guess it's not your patch's fault. > > Will follow up and get back to you later. > > Sorry for the inconvenience. > > OK, thanks for letting me know! There was still a bad line in this > patch, although it was only introduced in 5.1 and trunk, so I guess that > wasn't responsible in this case. Thanks for checking! Hi Bill, In 4.8 branch, you have changed: -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! vect_hw_misalign } } } } */ Whereas your comment says: 2015-04-24 Bill Schmidt Backport from mainline r222349 2015-04-22 Bill Schmidt PR target/65456 [...] * gcc.dg/vect/vect-33.c: Exclude unaligned access test for POWER8. [...] There wasn't an unaligned access test in the first place. But if you wanted to introduce it and exclude it for POWER8 then it should've been: ... { { ! powerpc*-*-* } && vect_hw_misalign } ... like you have done for the trunk. At the moment, this change has made the test to be skipped for AArch64. It should've been skipped for x86_64-*-* and i*86-*-* as well. I believe it wasn't intended to be skipped so? Regards VP. > > Bill > > > > > Thanks, > > bin > > > > > > Thanks very much! > > > > > > Bill > > >> > > >> PASS->NA: gcc.dg/vect/vect-33.c -flto -ffat-lto-objects > > >> scan-tree-dump-times vect "Vectorizing an unaligned access" 0 > > >> PASS->NA: gcc.dg/vect/vect-33.c scan-tree-dump-times vect "Vectorizing > > >> an unaligned access" 0 > > >> > > >> Thanks, > > >> bin > > >> > > > > > > > > > >
[gomp4.1] Parsing of critical construct with hint, and some locks with hint library changes
Hi! I've committed following parsing support for #pragma omp criticial (foobar) hint (omp_lock_hint_uncontended) and a header only change in libgomp for the omp_init*lock_with_hint APIs. We'll need to decide if we want to implement the hinted locks and how first I guess (I believe Intel is using HLE (or HTM?) for the omp_lock_hint_speculative, and I bet for omp_lock_hint_uncontended simple spinlock without futex, or at least for a while). Next issue is that omp_lock_t right now is just 32-bit and omp_nest_lock_t is 64-bit, I guess we can increase it with symbol versioning another set of lock entrypoints, but the question is what exactly we want to store (just the current 32-bit lock, for nested locks 32-bit counter and 32-bit hint, something else?). There is another issue, because e.g. on 32-bit arches only kind=4 and kind=8 are supported, so I'm afraid at least for nest locks we'll need to malloc something (unless we decide to ignore the hints for now). 2015-06-12 Jakub Jelinek * tree.def (OMP_CRITICAL): Move before OMP_SINGLE. Add OMP_CRITICAL_CLAUSES operand. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_HINT. * tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP. (OMP_CRITICAL_CLAUSES): Define. (OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd. (OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix. (OMP_CLAUSE_HINT_EXPR): Define. * tree.c (omp_clause_num_ops): Add entry for OMP_CLAUSE_HINT. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_HINT clause. * tree-pretty-print.c (dump_omp_clause): Likewise. (dump_generic_node): Dump OMP_CRITICAL_CLAUSES for OMP_CRITICAL. * gimple.h (gomp_critical): Add clauses field before name. (gimple_build_omp_critical): Adjust prototype. (gimple_omp_critical_name_ptr, gimple_omp_critical_set_name): Fix up function comments. (gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr, gimple_omp_critical_set_clauses): New functions. * gimple.c (gimple_build_omp_critical): Add CLAUSES argument, set it. (gimple_copy): Unshare and copy gimple_omp_critical_clauses. * gimple-pretty-print.c (dump_gimple_omp_critical): Print gimple_omp_critical_clauses. * gimple-walk.c (walk_gimple_op): Walk gimple_omp_critical_clauses_ptr. * gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_HINT. (gimplify_expr): Gimplify OMP_CRITICAL_CLAUSES, adjust gimple_build_omp_critical caller. * tree-inline.c (remap_gimple_stmt): Adjust gimple_build_omp_critical caller. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_HINT clause. gcc/c-family/ * c-common.h (c_finish_omp_critical): Add CLAUSES argument to the prototype. * c-omp.c (c_finish_omp_critical): Likewise. Set OMP_CRITICAL_CLAUSES to it. * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_HINT. gcc/c/ * c-parser.c (c_parser_omp_clause_name): Parse hint clause. (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize, c_parser_omp_clause_priority): Fix up pastos in *_loc variable names. (c_parser_omp_clause_hint): New function. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_HINT. (OMP_CRITICAL_CLAUSE_MASK): Define. (c_parser_omp_critical): Parse optional hint clause. Adjust c_finish_omp_critical caller. * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_HINT. gcc/cp/ * parser.c (cp_parser_omp_clause_name): Parse hint clause. (cp_parser_omp_clause_hint): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_HINT. (OMP_CRITICAL_CLAUSE_MASK): Define. (cp_parser_omp_critical): Parse optional hint clause. Adjust c_finish_omp_critical caller. * pt.c (tsubst_expr): Handle OMP_CRITICAL like OMP_SECTIONS. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_HINT. gcc/fortran/ * trans-openmp.c (gfc_trans_omp_critical): Adjust building OMP_CRITICAL trees. libgomp/ * omp.h.in (omp_lock_hint_t): New type. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint): New prototypes. * omp_lib.f90.in (omp_lock_hint_kind): New kind parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculative): New parameters. (omp_init_lock_with_hint, omp_init_nest_lock_with_hint): New interfaces. * omp_lib.h.in (omp_lock_hint_kind): New kind parameter. (omp_lock_hint_none, omp_lock_hint_uncontended, omp_lock_hint_contended, omp_lock_hint_nonspeculative, omp_lock_hint_speculativ
Re: C++ delayed folding branch review
Hello Jason, Thanks for the review. I addressed a lot of your comments directly on svn-branch. See revision r224439. - Ursprüngliche Mail - > Generally, it seems like most of my comments from April haven't been > addressed yet. Yes, most of them. > > @@ -3023,13 +3023,14 @@ conversion_warning (location_t loc, tree type, tree > > expr > > Instead of adding folds here, let's make sure that the argument we pass > (e.g. from cp_convert_and_check to warnings_for_convert_and_check) is > fully folded. I looked for dependencies, and address this. > > @@ -589,9 +589,9 @@ null_member_pointer_value_p (tree t) > > return false; > >else if (TYPE_PTRMEMFUNC_P (type)) > > return (TREE_CODE (t) == CONSTRUCTOR > > - && integer_zerop (CONSTRUCTOR_ELT (t, 0)->value)); > > + && integer_zerop (fold (CONSTRUCTOR_ELT (t, 0)->value))); > >else if (TYPE_PTRDATAMEM_P (type)) > > -return integer_all_onesp (t); > > +return integer_all_onesp (fold (t)); > > Again, calling fold here is wrong; it doesn't handle constexpr, and we > should have folded before we got here. Agreed. I will commit change for this. Nevertheless CONSTRUCTOR_ELT's value might still be prefixed by nops due possible overflows, or by negative sign/invert/etc. This is caused by non-constant-folding of values. I removed for now those folds, as I agree we should address this at place of value-assignment. Nevertheless we still have this issue > > @@ -5090,9 +5090,9 @@ build_conditional_expr_1 (location_t loc, tree arg1, > > tree arg2, tree arg3, > > > > valid_operands: > >result = build3 (COND_EXPR, result_type, arg1, arg2, arg3); > > - if (!cp_unevaluated_operand) > > + if (!cp_unevaluated_operand && !processing_template_decl) > > /* Avoid folding within decltype (c++/42013) and noexcept. */ > > -result = fold_if_not_in_template (result); > > +result = fold (result); > > This seems related to your status report note: > > > Additionally addressed issue about cond_expr, as we want to fold cases with > > a constant-condition. Here we need to use "fold_to_constant" so that we > > just fold things to constant-value, if possible and otherwise don't modify > > anything. > > But why do you say we want to fold cases with a constant condition? We > certainly want to avoid warning about the dead branch in that case, but > it would be better if we can do that folding only in the warning code. Issue is that we otherwise detect in conditions that expressions aren't constant due never-executed-code-path. The diagnostics we can deal differently, but this was actually the reason for doing this. I can remove this here, but we still need a place to avoid ill detection of constexpr (or invalid code) on dead code-branch. Eg. (1 ? 0/0 : 1) etc > > @@ -5628,8 +5628,8 @@ build_new_op_1 (location_t loc, enum tree_code code, > > int f > > lags, tree arg1, > > decaying an enumerator to its value. */ > > if (complain & tf_warning) > > warn_logical_operator (loc, code, boolean_type_node, > > - code_orig_arg1, arg1, > > - code_orig_arg2, arg2); > > + code_orig_arg1, fold (arg1), > > + code_orig_arg2, fold (arg2)); > > > > arg2 = convert_like (conv, arg2, complain); > > } > > @@ -5666,7 +5666,8 @@ build_new_op_1 (location_t loc, enum tree_code code, > > int f > > lags, tree arg1, > > case TRUTH_AND_EXPR: > > case TRUTH_OR_EXPR: > >warn_logical_operator (loc, code, boolean_type_node, > > -code_orig_arg1, arg1, code_orig_arg2, arg2); > > +code_orig_arg1, fold (arg1), > > +code_orig_arg2, fold (arg2)); > >/* Fall through. */ > > case GT_EXPR: > > case LT_EXPR: > > @@ -5676,7 +5677,7 @@ build_new_op_1 (location_t loc, enum tree_code code, > > int f > > lags, tree arg1, > > case NE_EXPR: > >if ((code_orig_arg1 == BOOLEAN_TYPE) > > ^ (code_orig_arg2 == BOOLEAN_TYPE)) > > - maybe_warn_bool_compare (loc, code, arg1, arg2); > > + maybe_warn_bool_compare (loc, code, fold (arg1), fold (arg2)); > >/* Fall through. */ > > case PLUS_EXPR: > > case MINUS_EXPR: > > I still think these fold calls should be cp_fully_fold. Ok, modified here use of fold to cp_fully_fold. > > > @@ -7382,8 +7383,13 @@ build_over_call (struct z_candidate *cand, int > > flags, tsu > > bst_flags_t complain) > > > >gcc_assert (j <= nargs); > >nargs = j; > > + { > > +tree *fargs = (!nargs ? argarray : (tree *) alloca (nargs * sizeof > > (tree))) > > ; > > +for (j = 0; j < nargs; j++) > > + fargs[j] = fold_non_dependent_expr (argarray[j]); > > No change needed here, but I notice that fold_non_dependent_expr is >
[PATCH] fix final piece of PR66448 (Bootstrap fail on Darwin, after 224161).
Hi, Since debug is not initialised at the time built-ins are initialised, whilst the latter may make forward declarations, those should not be considered for early debug, bootstrapped / tested on x86_64-darwin12 and x86_64-linux-gnu. OK? Iain gcc: PR bootstrap/66448 * passes.c (rest_of_decl_compilation): Do not register globals for early debug if they are declared in built-ins. diff --git a/gcc/passes.c b/gcc/passes.c index d3ffe33..1bc8a36 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -332,7 +332,7 @@ rest_of_decl_compilation (tree decl, */ && !decl_function_context (decl) && !current_function_decl - + && DECL_SOURCE_LOCATION (decl) != BUILTINS_LOCATION && !decl_type_context (decl)) (*debug_hooks->early_global_decl) (decl); }
Re: [Patch libstdc++] Rewrite cpu/generic/atomic_word.h
On Fri, 2015-06-12 at 10:30 +0100, Ramana Radhakrishnan wrote: > On Fri, Jun 12, 2015 at 10:06 AM, Jonathan Wakely wrote: > > On 11/06/15 23:56 +0200, Torvald Riegel wrote: > >>> > >>> > On Fri, 2015-05-22 at 12:37 +0100, Ramana Radhakrishnan wrote: > >>> I don't think we can remove _GLIBCXX_READ_MEM_BARRIER and > >>> _GLIBCXX_WRITE_MEM_BARRIER from atomic_word.h even though they are > >>> superseded by the atomics as it is published in the documentation as > >>> available macros. > >> > >> > >> I see. We should at least update the documentation of those, as the > >> current one isn't a really portable specification. If we can, I'd > >> deprecate them. Jonathan, what do you think? > > > > > > Yes, I'm in favour of deprecating them. They are GCC-specific anyway, > > so there is no reason to prefer them to std::atomic_ or __atomic_ > > fences. > > I'll treat it as a follow-up. Thanks. > Can I get an ack for this patch though ? The above comment was of a general nature, not specifically about this patch or meant as a precondition for this patch. Sorry if that wasn't clear :) To me, your patch looks good.
Re: Backport PR63623 (debug info) to 4.8, 4.9
On Fri, Jun 12, 2015 at 03:56:10PM +0200, Michael Matz wrote: > Hi, > > this backports the fix for debug info of PR63623 to the 4.8 and 4.9 > branches. Without this shrink-wrapped functions often have invalid debug > info for parameters. Bootstrapped and regtested 4.8 and 4.9 with this on > x86_64-linux, no regressions (for my machine/gdb combination 4.8 has two > more xpasses and 4.9 has two fails less in guality). > > Okay for both? > > > Ciao, > Michael. > > backport from mainline Capital B for consistency with other ChangeLog entries. > 2014-10-23 Jakub Jelinek > > PR debug/63623 > * var-tracking.c (stack_adjust_offset_pre_post_cb): New function. > (stack_adjust_offset_pre_post): Use it through for_each_inc_dec, > instead of only handling autoinc in dest if it is a MEM. Ok. Jakub
Backport PR63623 (debug info) to 4.8, 4.9
Hi, this backports the fix for debug info of PR63623 to the 4.8 and 4.9 branches. Without this shrink-wrapped functions often have invalid debug info for parameters. Bootstrapped and regtested 4.8 and 4.9 with this on x86_64-linux, no regressions (for my machine/gdb combination 4.8 has two more xpasses and 4.9 has two fails less in guality). Okay for both? Ciao, Michael. backport from mainline 2014-10-23 Jakub Jelinek PR debug/63623 * var-tracking.c (stack_adjust_offset_pre_post_cb): New function. (stack_adjust_offset_pre_post): Use it through for_each_inc_dec, instead of only handling autoinc in dest if it is a MEM. Index: var-tracking.c === --- var-tracking.c (revision 224331) +++ var-tracking.c (working copy) @@ -592,6 +592,39 @@ static void vt_add_function_parameters ( static bool vt_initialize (void); static void vt_finalize (void); +/* Callback for stack_adjust_offset_pre_post, called via for_each_inc_dec. */ + +static int +stack_adjust_offset_pre_post_cb (rtx, rtx op, rtx dest, rtx src, rtx srcoff, +void *arg) +{ + if (dest != stack_pointer_rtx) +return 0; + + switch (GET_CODE (op)) +{ +case PRE_INC: +case PRE_DEC: + ((HOST_WIDE_INT *)arg)[0] -= INTVAL (srcoff); + return 0; +case POST_INC: +case POST_DEC: + ((HOST_WIDE_INT *)arg)[1] -= INTVAL (srcoff); + return 0; +case PRE_MODIFY: +case POST_MODIFY: + /* We handle only adjustments by constant amount. */ + gcc_assert (GET_CODE (src) == PLUS + && CONST_INT_P (XEXP (src, 1)) + && XEXP (src, 0) == stack_pointer_rtx); + ((HOST_WIDE_INT *)arg)[GET_CODE (op) == POST_MODIFY] + -= INTVAL (XEXP (src, 1)); + return 0; +default: + gcc_unreachable (); +} +} + /* Given a SET, calculate the amount of stack adjustment it contains PRE- and POST-modifying stack pointer. This function is similar to stack_adjust_offset. */ @@ -617,68 +650,12 @@ stack_adjust_offset_pre_post (rtx patter *post += INTVAL (XEXP (src, 1)); else *post -= INTVAL (XEXP (src, 1)); + return; } - else if (MEM_P (dest)) -{ - /* (set (mem (pre_dec (reg sp))) (foo)) */ - src = XEXP (dest, 0); - code = GET_CODE (src); - - switch (code) - { - case PRE_MODIFY: - case POST_MODIFY: - if (XEXP (src, 0) == stack_pointer_rtx) - { - rtx val = XEXP (XEXP (src, 1), 1); - /* We handle only adjustments by constant amount. */ - gcc_assert (GET_CODE (XEXP (src, 1)) == PLUS && - CONST_INT_P (val)); - - if (code == PRE_MODIFY) - *pre -= INTVAL (val); - else - *post -= INTVAL (val); - break; - } - return; - - case PRE_DEC: - if (XEXP (src, 0) == stack_pointer_rtx) - { - *pre += GET_MODE_SIZE (GET_MODE (dest)); - break; - } - return; - - case POST_DEC: - if (XEXP (src, 0) == stack_pointer_rtx) - { - *post += GET_MODE_SIZE (GET_MODE (dest)); - break; - } - return; - - case PRE_INC: - if (XEXP (src, 0) == stack_pointer_rtx) - { - *pre -= GET_MODE_SIZE (GET_MODE (dest)); - break; - } - return; - - case POST_INC: - if (XEXP (src, 0) == stack_pointer_rtx) - { - *post -= GET_MODE_SIZE (GET_MODE (dest)); - break; - } - return; - - default: - return; - } -} + HOST_WIDE_INT res[2] = { 0, 0 }; + for_each_inc_dec (&pattern, stack_adjust_offset_pre_post_cb, res); + *pre += res[0]; + *post += res[1]; } /* Given an INSN, calculate the amount of stack adjustment it contains
Re: [PATCH][PR debug/65549] Restore DW_AT_abstract_origin for cross-unit call sites
On 06/12/2015 01:11 PM, Richard Biener wrote: By the way, I think we should apply this fix to the GCC 5 branch as well. May I? Yes Done. Thanks again! -- Pierre-Marie de Rodat
Re: [patch] fix darwin bootstrap by avoiding duplicate DIE attributes
On 06/12/2015 12:22 AM, Andreas Schwab wrote: ../../gcc/dwarf2out.c:5693:1: error: 'void check_die(dw_die_ref)' defined but not used [-Werror=unused-function] Andreas. Committed as obvious. commit 76da2378b15ad786e8c2c64ddd8b39c132947738 Author: Aldy Hernandez Date: Fri Jun 12 06:42:08 2015 -0700 * dwarf2out.c (check_die): Protect with ENABLE_CHECKING. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 92fa340..d2c516a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5687,6 +5687,7 @@ debug_dwarf (void) print_die (comp_unit_die (), stderr); } +#ifdef ENABLE_CHECKING /* Sanity checks on DIEs. */ static void @@ -5749,6 +5750,7 @@ check_die (dw_die_ref die) && a->dw_attr != DW_AT_GNU_all_call_sites); } } +#endif /* Start a new compilation unit DIE for an include file. OLD_UNIT is the CU for the enclosing include file, if any. BINCL_DIE is the DW_TAG_GNU_BINCL
[PATCH][ifcvt][obvious] Use std::swap instead of manually swapping
Hi all, Here is the next battle in the war against manual swapping, this time in ifcvt. Bootstrapped and tested on aarch64, x86_64. Committed as obvious with r224429. Thanks, Kyrill 2015-06-12 Kyrylo Tkachov * ifcvt.c (noce_try_store_flag_constants): Use std::swap instead of manually swapping. (noce_try_cmove_arith): Likewise. (noce_get_alt_condition): Likewise. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 9475c00..986f28f 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -1227,7 +1227,7 @@ noce_try_store_flag_constants (struct noce_if_info *if_info) if (reversep) { - tmp = itrue; itrue = ifalse; ifalse = tmp; + std::swap (itrue, ifalse); diff = trunc_int_for_mode (-(unsigned HOST_WIDE_INT) diff, mode); } @@ -1689,11 +1689,9 @@ noce_try_cmove_arith (struct noce_if_info *if_info) if (reversep) { - rtx tmp; - rtx_insn *tmp_insn; code = reversed_comparison_code (if_info->cond, if_info->jump); - tmp = a, a = b, b = tmp; - tmp_insn = insn_a, insn_a = insn_b, insn_b = tmp_insn; + std::swap (a, b); + std::swap (insn_a, insn_b); } } @@ -1875,9 +1873,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target, if (CONST_INT_P (op_a)) { - rtx tmp = op_a; - op_a = op_b; - op_b = tmp; + std::swap (op_a, op_b); code = swap_condition (code); } }
[gomp4] error on duplicate acc device_type entries
This patch teaches all of the front ends how to error on duplicate device_type entries such as #pragma acc parallel device_type (nvidia) num_gangs (1) \ device_type (nvidia) num_gangs (20) Before such clauses were silently ignored. I also fixed how invalid device_type claues are reported in the fortran front end. It used report "Invalid character" and now it states "Unclassifiable OpenACC directive". I applied this patch to gomp-4_0-branch. Cesar 2015-06-12 Cesar Philippidis gcc/c-family/ * c-omp.c (oacc_extract_device_id): Recognize GOMP_DEVICE_DEFAULT. (struct identifier_hasher): New struct declaration. (oacc_filter_device_types): Report errors on duplicate device_type entries. gcc/c/ * c-parser.c (c_parser_oacc_clause_device_type): Switch OMP_CLAUSE_DEVICE_TYPE_DEVICES to tree instead of an int. gcc/cp/ * parser.c (cp_parser_oacc_clause_device_type): Likewise. gcc/fortran/ * openmp.c (gfc_match_omp_clauses): Report errors on duplicate device_type entries. gcc/testsuite/ * c-c++-common/goacc/dtype-4.c: New test. * gfortran.dg/goacc/dtype-2.f95: Update error messages. * gfortran.dg/goacc/dtype-3.f: New test. diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index c30e0d8..bcb6ff4 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "omp-low.h" #include "gomp-constants.h" +#include "tree-hasher.h" /* Complete a #pragma oacc wait construct. LOC is the location of @@ -1097,9 +1098,20 @@ oacc_extract_device_id (const char *device) { if (!strcasecmp (device, "nvidia")) return GOMP_DEVICE_NVIDIA_PTX; + else if (!strcmp (device, "*")) +return GOMP_DEVICE_DEFAULT; return GOMP_DEVICE_NONE; } +struct identifier_hasher : ggc_cache_hasher +{ + static hashval_t hash (tree t) { return htab_hash_pointer (t); } + static bool equal (tree a, tree b) + { +return !strcmp(IDENTIFIER_POINTER (a), IDENTIFIER_POINTER (b)); + } +}; + /* Filter out the list of unsupported OpenACC device_types. */ tree @@ -1109,56 +1121,55 @@ oacc_filter_device_types (tree clauses) tree dtype = NULL_TREE; tree seen_nvidia = NULL_TREE; tree seen_default = NULL_TREE; - int device = 0; + hash_table *dt_htab += hash_table::create_ggc (10); /* First scan for all device_type clauses. */ for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) { if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEVICE_TYPE) { - int code = TREE_INT_CST_LOW (OMP_CLAUSE_DEVICE_TYPE_DEVICES (c)); + tree t; - if (code == GOMP_DEVICE_DEFAULT) + for (t = OMP_CLAUSE_DEVICE_TYPE_DEVICES (c); t; t = TREE_CHAIN (t)) { - if (device & (1 << GOMP_DEVICE_DEFAULT)) + if (dt_htab->find (t)) { - seen_default = NULL_TREE; error_at (OMP_CLAUSE_LOCATION (c), - "duplicate device_type (*)"); - goto filter_error; + "duplicate device_type (%s)", + IDENTIFIER_POINTER (t)); + goto filter_dtype; } - seen_default = OMP_CLAUSE_DEVICE_TYPE_CLAUSES (c); - } - else if (code & (1 << GOMP_DEVICE_NVIDIA_PTX)) - { - if (device & code) - { - seen_nvidia = NULL_TREE; - error_at (OMP_CLAUSE_LOCATION (c), - "duplicate device_type (nvidia)"); - goto filter_error; - } + int code = oacc_extract_device_id (IDENTIFIER_POINTER (t)); - seen_nvidia = OMP_CLAUSE_DEVICE_TYPE_CLAUSES (c); - } - else - { - if (device & (1 << code)) + if (code == GOMP_DEVICE_DEFAULT) + seen_default = OMP_CLAUSE_DEVICE_TYPE_CLAUSES (c); + else if (code == GOMP_DEVICE_NVIDIA_PTX) + seen_nvidia = OMP_CLAUSE_DEVICE_TYPE_CLAUSES (c); + else { - error_at (OMP_CLAUSE_LOCATION (c), - "duplicate device_type"); - goto filter_error; + /* The OpenACC technical committee advises compilers + to silently ignore unknown devices. */ } + + tree *slot = dt_htab->find_slot (t, INSERT); + *slot = t; } - device |= (1 << code); } } /* Don't do anything if there aren't any device_type clauses. */ - if (device == 0) + if (dt_htab->elements () == 0) return clauses; + if (seen_nvidia) +dtype = seen_nvidia; + else if (seen_default) +dtype = seen_default; + else +goto filter_dtype; + dtype = seen_nvidia ? seen_nvidia : seen_default; /* Now filter out clauses if necessary. */ @@ -1186,7 +1197,7 @@ oacc_filter_device_types (tree clauses) prev = c; } - filter_error: + filter_dtype: /* Remove all device_type clauses. Those clauses are located at the beginning of the clause list. */ for (c = clauses; c && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEVICE_TYPE; diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index cef56dc..f37a8f7 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -11246,7 +11246,7 @@ c_parser_oacc_clause_device_type (c_parser *parser, omp_clause_mask mask, { tree c, clauses
[patch] Add missing C++11 and C++14 headers to bits/stdc++.h
and were not included in the precompiled headers. Tested powerpc64le-linux, committed to trunk. commit 66c9926b63b5dd333f310fa621d5c495deb77681 Author: Jonathan Wakely Date: Fri Jun 12 12:42:41 2015 +0100 * include/precompiled/stdc++.h: Include and . diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h index 8449ec0..693391a 100644 --- a/libstdc++-v3/include/precompiled/stdc++.h +++ b/libstdc++-v3/include/precompiled/stdc++.h @@ -98,6 +98,7 @@ #include #include #include +#include #include #include #include @@ -115,3 +116,7 @@ #include #include #endif + +#if __cplusplus >= 201402L +#include +#endif
[gomp4.1] Parsing of schedule(simd:...)
Hi! I've committed following patch to add C/C++ parsing of simd: schedule clause modifier, and a very rough implementation of it for schedule with chunk and dynamic schedule kinds. No idea what to do about runtime schedule, because there we don't pass a chunk size to the library routine. And for nochunk static it will need more work (well, for chunk static likely too). Best would be to arrange for the vectorizer to be able to communicate its decisions back into the schedule static decisions - the spec allows the first iteration to have even more than chunk_size rounded up to a multiple of (estimated) vectorization factor, so best would be if we e.g. decide to peel the loop for alignment etc. to schedule those iterations in the first thread and then full portion of chunk_size rounded up to vf, then second up to (last - 1)th thread doing anything always run exactly chunk_size rounded up to vf iterations and last iteration doing what is left. Any help with that would be appreciated. Also, not sure if we shouldn't replace here omp_max_vf with the OMP_CLAUSE_SIMDLEN value if specified, that is the desired vectorization factor, so perhaps it is enough to use that. Also, omp_max_vf might be too high, it assumes the loop might contain some QImode types that would need vectorization, while if it is e.g. fully SImode+, the guess will be 4x higher than needed. Perhaps walk the loop and collect narrowest type used in there? 2015-06-12 Jakub Jelinek * tree.h (OMP_CLAUSE_SCHEDULE_SIMD): Define. * omp-low.c (struct omp_for_data): Add simd_schedule field. (extract_omp_for_data): Initialize it. (omp_adjust_chunk_size): New function. (get_ws_args_for, expand_omp_for_generic, expand_omp_for_static_chunk): Use it. * tree-pretty-print.c (dump_omp_clause): Print simd: modifier on OMP_CLAUSE_SCHEDULE. c-family/ * c-omp.c (c_omp_split_clauses): Clear OMP_CLAUSE_SCHEDULE_SIMD when not combined with simd construct. c/ * c-parser.c (c_parser_omp_clause_schedule): Parse optional simd: modifier in schedule clause. cp/ * parser.c (cp_parser_omp_clause_schedule): Parse optional simd: modifier in schedule clause. testsuite/ * c-c++-common/gomp/schedule-simd-1.c: New test. --- gcc/tree.h.jj 2015-06-11 14:36:37.0 +0200 +++ gcc/tree.h 2015-06-11 18:22:28.413686564 +0200 @@ -1526,6 +1526,10 @@ extern void protected_set_expr_location #define OMP_CLAUSE_SCHEDULE_KIND(NODE) \ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->omp_clause.subcode.schedule_kind) +/* True if a SCHEDULE clause has the simd modifier on it. */ +#define OMP_CLAUSE_SCHEDULE_SIMD(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->base.public_flag) + #define OMP_CLAUSE_DEFAULT_KIND(NODE) \ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind) --- gcc/omp-low.c.jj2015-06-11 11:35:02.0 +0200 +++ gcc/omp-low.c 2015-06-12 12:23:06.857019167 +0200 @@ -251,7 +251,7 @@ struct omp_for_data gomp_for *for_stmt; tree pre, iter_type; int collapse; - bool have_nowait, have_ordered; + bool have_nowait, have_ordered, simd_schedule; enum omp_clause_schedule_kind sched_kind; struct omp_for_data_loop *loops; }; @@ -514,6 +514,7 @@ extract_omp_for_data (gomp_for *for_stmt fd->have_ordered = false; fd->sched_kind = OMP_CLAUSE_SCHEDULE_STATIC; fd->chunk_size = NULL_TREE; + fd->simd_schedule = false; if (gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_CILKFOR) fd->sched_kind = OMP_CLAUSE_SCHEDULE_CILKFOR; collapse_iter = NULL; @@ -532,6 +533,7 @@ extract_omp_for_data (gomp_for *for_stmt gcc_assert (!distribute && !taskloop); fd->sched_kind = OMP_CLAUSE_SCHEDULE_KIND (t); fd->chunk_size = OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t); + fd->simd_schedule = OMP_CLAUSE_SCHEDULE_SIMD (t); break; case OMP_CLAUSE_DIST_SCHEDULE: gcc_assert (distribute); @@ -870,6 +872,29 @@ workshare_safe_to_combine_p (basic_block } +static int omp_max_vf (void); + +/* Adjust CHUNK_SIZE from SCHEDULE clause, depending on simd modifier + presence (SIMD_SCHEDULE). */ + +static tree +omp_adjust_chunk_size (tree chunk_size, bool simd_schedule) +{ + if (!simd_schedule) +return chunk_size; + + int vf = omp_max_vf (); + if (vf == 1) +return chunk_size; + + tree type = TREE_TYPE (chunk_size); + chunk_size = fold_build2 (PLUS_EXPR, type, chunk_size, + build_int_cst (type, vf - 1)); + return fold_build2 (BIT_AND_EXPR, type, chunk_size, + build_int_cst (type, -vf)); +} + + /* Collect additional arguments needed to emit a combined parallel+workshare call. WS_STMT is the workshare directive being expanded. */ @@ -917,6 +942,7 @@ get_ws_args_for (gimple par_stmt, gimple if (fd.chunk_size) { t = fold_convert_loc (loc
match.pd: Three new patterns
This patch brings three new patterns for match.pd. I think these are rare, but it shouldn't hurt to have them. (I suppose you'd be happier if I was moving patterns from fold-const to match.pd. I'll work on that as well.) Given previous discussion, I don't think there's much to say otherwise, but I'd appreciate if someone could glance over this. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-06-12 Marek Polacek * match.pd ((x & y) + (x ^ y) -> x | y, (x & y) + (x | y) -> x + y, (x | y) - (x ^ y) -> x & y): New patterns. * gcc.dg/fold-plus-1.c: New test. * gcc.dg/fold-plus-2.c: New test. * gcc.dg/fold-minus-2.c: New test. --- gcc/match.pd +++ gcc/match.pd @@ -325,6 +325,21 @@ along with GCC; see the file COPYING3. If not see (bit_xor:c (bit_and @0 @1) (bit_ior @0 @1)) (bit_xor @0 @1)) +/* (x & y) + (x ^ y) -> x | y */ +(simplify + (plus:c (bit_and @0 @1) (bit_xor @0 @1)) + (bit_ior @0 @1)) + +/* (x & y) + (x | y) -> x + y */ +(simplify + (plus:c (bit_and @0 @1) (bit_ior @0 @1)) + (plus @0 @1)) + +/* (x | y) - (x ^ y) -> x & y */ +(simplify + (minus (bit_ior @0 @1) (bit_xor @0 @1)) + (bit_and @0 @1)) + (simplify (abs (negate @0)) (abs @0)) --- gcc/testsuite/gcc.dg/fold-plus-1.c +++ gcc/testsuite/gcc.dg/fold-plus-1.c @@ -0,0 +1,70 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ + +int +fn1 (int a, int b) +{ + int tem1 = a & b; + int tem2 = a ^ b; + return tem1 + tem2; +} + +int +fn2 (int a, int b) +{ + int tem1 = b & a; + int tem2 = a ^ b; + return tem1 + tem2; +} + +int +fn3 (int a, int b) +{ + int tem1 = a & b; + int tem2 = b ^ a; + return tem1 + tem2; +} + +int +fn4 (int a, int b) +{ + int tem1 = b & a; + int tem2 = b ^ a; + return tem1 + tem2; +} + +int +fn5 (int a, int b) +{ + int tem1 = a ^ b; + int tem2 = a & b; + return tem1 + tem2; +} + +int +fn6 (int a, int b) +{ + int tem1 = b ^ a; + int tem2 = a & b; + return tem1 + tem2; +} + +int +fn7 (int a, int b) +{ + int tem1 = a ^ b; + int tem2 = b & a; + return tem1 + tem2; +} + +int +fn8 (int a, int b) +{ + int tem1 = b ^ a; + int tem2 = b & a; + return tem1 + tem2; +} + +/* { dg-final { scan-tree-dump-not " & " "cddce1" } } */ +/* { dg-final { scan-tree-dump-not " \\^ " "cddce1" } } */ +/* { dg-final { scan-tree-dump-not " \\+ " "cddce1" } } */ --- gcc/testsuite/gcc.dg/fold-plus-2.c +++ gcc/testsuite/gcc.dg/fold-plus-2.c @@ -0,0 +1,69 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ + +int +fn1 (int a, int b) +{ + int tem1 = a & b; + int tem2 = a | b; + return tem1 + tem2; +} + +int +fn2 (int a, int b) +{ + int tem1 = b & a; + int tem2 = a | b; + return tem1 + tem2; +} + +int +fn3 (int a, int b) +{ + int tem1 = a & b; + int tem2 = b | a; + return tem1 + tem2; +} + +int +fn4 (int a, int b) +{ + int tem1 = b & a; + int tem2 = b | a; + return tem1 + tem2; +} + +int +fn5 (int a, int b) +{ + int tem1 = a | b; + int tem2 = a & b; + return tem1 + tem2; +} + +int +fn6 (int a, int b) +{ + int tem1 = b | a; + int tem2 = a & b; + return tem1 + tem2; +} + +int +fn7 (int a, int b) +{ + int tem1 = a | b; + int tem2 = b & a; + return tem1 + tem2; +} + +int +fn8 (int a, int b) +{ + int tem1 = b | a; + int tem2 = b & a; + return tem1 + tem2; +} + +/* { dg-final { scan-tree-dump-not " & " "cddce1" } } */ +/* { dg-final { scan-tree-dump-not " \\| " "cddce1" } } */ --- gcc/testsuite/gcc.dg/fold-minus-2.c +++ gcc/testsuite/gcc.dg/fold-minus-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ + +int +fn1 (int a, int b) +{ + int tem1 = a | b; + int tem2 = a ^ b; + return tem1 - tem2; +} + +int +fn2 (int a, int b) +{ + int tem1 = b | a; + int tem2 = a ^ b; + return tem1 - tem2; +} + +int +fn3 (int a, int b) +{ + int tem1 = a | b; + int tem2 = b ^ a; + return tem1 - tem2; +} + +int +fn4 (int a, int b) +{ + int tem1 = b | a; + int tem2 = b ^ a; + return tem1 - tem2; +} + +/* { dg-final { scan-tree-dump-not " \\^ " "cddce1" } } */ +/* { dg-final { scan-tree-dump-not " \\| " "cddce1" } } */ Marek
Re: [4.8, 4.9] Backport IRA rtx_movable_p fix (PR target/62642)
On June 12, 2015 1:19:15 PM GMT+02:00, Jakub Jelinek wrote: >Hi! > >Is this ok to apply to 4.8 and 4.9 branches? >Successfully bootstrapped/regtested on these branches on x86_64-linux >and >i686-linux, testcase is fixed. OK. Thanks, Richard. >2015-06-12 Jakub Jelinek > > Backported from mainline > 2014-12-15 Vladimir Makarov > > PR target/62642 > * ira.c (rtx_moveable_p): Prevent UNSPEC_VOLATILE moves. > >--- gcc/ira.c (revision 218760) >+++ gcc/ira.c (revision 218761) >@@ -4358,6 +4358,12 @@ rtx_moveable_p (rtx *loc, enum op_type t > case CLOBBER: > return rtx_moveable_p (&SET_DEST (x), OP_OUT); > >+case UNSPEC_VOLATILE: >+ /* It is a bad idea to consider insns with with such rtl >+ as moveable ones. The insn scheduler also considers them as barrier >+ for a reason. */ >+ return false; >+ > default: > break; > } > > Jakub
Re: [4.8, 4.9] fold-const.c fix (PR middle-end/63608)
On June 12, 2015 1:17:14 PM GMT+02:00, Jakub Jelinek wrote: >Hi! > >The following testcase ICEs in 4.8/4.9. The problem is that we don't >fold >NON_LVALUE_EXPR of INTEGER_CST into the INTEGER_CST, but it seems huge >amount of fold-const.c code has the assumption that if >argN = opN; >... >STRIP_NOPS (argN); >... >if (TREE_CODE (argN) == INTEGER_CST) > >then argN == opN, so passes e.g. argN instead of opN, assuming that >argN must have type already. Eric has fixed this for 5+ already >by dropping the NON_LVALUE_EXPR if the argument is isn't a possible >lvalue. > >Bootstrapped/regtested on x86_64-linux and i686-linux on both 4.9 and >4.8 >branches with --enable-checking=yes,rtl, ok for those branches? >Is the testcase alone ok for 5.2/trunk? OK and yes. Thanks, Richard. >A safer alternative would be just to fold NON_LVALUE_EXPR of >INTEGER_CST >into the INTEGER_CST. > >2015-06-12 Jakub Jelinek > > PR middle-end/63608 > * gcc.c-torture/compile/pr63608.c: New test. > > Backported from mainline > 2014-05-16 Eric Botcazou > > * fold-const (fold_unary_loc) : New case. > : Pass arg0 instead of op0 to fold_convert_const. > >--- gcc/fold-const.c (revision 210517) >+++ gcc/fold-const.c (revision 210518) >@@ -7850,6 +7850,11 @@ fold_unary_loc (location_t loc, enum tre > return fold_convert_loc (loc, type, op0); > return NULL_TREE; > >+case NON_LVALUE_EXPR: >+ if (!maybe_lvalue_p (op0)) >+ return fold_convert_loc (loc, type, op0); >+ return NULL_TREE; >+ > CASE_CONVERT: > case FLOAT_EXPR: > case FIX_TRUNC_EXPR: >@@ -8113,7 +8118,7 @@ fold_unary_loc (location_t loc, enum tre > } > } > >- tem = fold_convert_const (code, type, op0); >+ tem = fold_convert_const (code, type, arg0); > return tem ? tem : NULL_TREE; > > case ADDR_SPACE_CONVERT_EXPR: >--- gcc/testsuite/gcc.c-torture/compile/pr63608.c.jj 2015-06-12 >10:55:16.484746890 +0200 >+++ gcc/testsuite/gcc.c-torture/compile/pr63608.c 2015-06-12 >10:53:58.0 +0200 >@@ -0,0 +1,14 @@ >+/* PR middle-end/63608 */ >+ >+typedef long T; >+typedef unsigned long U; >+unsigned long a; >+ >+unsigned long >+foo (int b) >+{ >+ T c = 0; >+ const U d = 2248593032UL; >+ a = (c = +d) | (~4L & ~b); >+ return c; >+} > > Jakub
Re: [4.8, 4.9] Backport a PCH fix (PR pch/65550)
On June 12, 2015 1:20:19 PM GMT+02:00, Jakub Jelinek wrote: >Hi! > >Bootstrapped/regtested on 4.8 and 4.9 branches on x86_64-linux and >i686-linux, ok for 4.8/4.9? OK. Thanks, Richard. >2015-06-12 Jakub Jelinek > > Backported from mainline > 2015-04-09 Richard Biener > > PR pch/65550 > * files.c (pch_open_file): Allow main and pre-included files > when trying to open a PCH. > >--- libcpp/files.c (revision 221948) >+++ libcpp/files.c (revision 221949) >@@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_f > >/* If the file is not included as first include from either the >toplevel > file or the command-line it is not a valid use of PCH. */ >- if (pfile->all_files >- && pfile->all_files->next_file >- && !(pfile->all_files->implicit_preinclude >- || pfile->all_files->next_file->implicit_preinclude)) >-return false; >+ for (_cpp_file *f = pfile->all_files; f; f = f->next_file) >+if (f->implicit_preinclude) >+ continue; >+else if (f->main_file) >+ break; >+else >+ return false; > > flen = strlen (path); > len = flen + sizeof (extension); > > Jakub
[4.8, 4.9] Backport a PCH fix (PR pch/65550)
Hi! Bootstrapped/regtested on 4.8 and 4.9 branches on x86_64-linux and i686-linux, ok for 4.8/4.9? 2015-06-12 Jakub Jelinek Backported from mainline 2015-04-09 Richard Biener PR pch/65550 * files.c (pch_open_file): Allow main and pre-included files when trying to open a PCH. --- libcpp/files.c (revision 221948) +++ libcpp/files.c (revision 221949) @@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_f /* If the file is not included as first include from either the toplevel file or the command-line it is not a valid use of PCH. */ - if (pfile->all_files - && pfile->all_files->next_file - && !(pfile->all_files->implicit_preinclude - || pfile->all_files->next_file->implicit_preinclude)) -return false; + for (_cpp_file *f = pfile->all_files; f; f = f->next_file) +if (f->implicit_preinclude) + continue; +else if (f->main_file) + break; +else + return false; flen = strlen (path); len = flen + sizeof (extension); Jakub
[4.8, 4.9] Backport IRA rtx_movable_p fix (PR target/62642)
Hi! Is this ok to apply to 4.8 and 4.9 branches? Successfully bootstrapped/regtested on these branches on x86_64-linux and i686-linux, testcase is fixed. 2015-06-12 Jakub Jelinek Backported from mainline 2014-12-15 Vladimir Makarov PR target/62642 * ira.c (rtx_moveable_p): Prevent UNSPEC_VOLATILE moves. --- gcc/ira.c (revision 218760) +++ gcc/ira.c (revision 218761) @@ -4358,6 +4358,12 @@ rtx_moveable_p (rtx *loc, enum op_type t case CLOBBER: return rtx_moveable_p (&SET_DEST (x), OP_OUT); +case UNSPEC_VOLATILE: + /* It is a bad idea to consider insns with with such rtl +as moveable ones. The insn scheduler also considers them as barrier +for a reason. */ + return false; + default: break; } Jakub
[4.8, 4.9] fold-const.c fix (PR middle-end/63608)
Hi! The following testcase ICEs in 4.8/4.9. The problem is that we don't fold NON_LVALUE_EXPR of INTEGER_CST into the INTEGER_CST, but it seems huge amount of fold-const.c code has the assumption that if argN = opN; ... STRIP_NOPS (argN); ... if (TREE_CODE (argN) == INTEGER_CST) then argN == opN, so passes e.g. argN instead of opN, assuming that argN must have type already. Eric has fixed this for 5+ already by dropping the NON_LVALUE_EXPR if the argument is isn't a possible lvalue. Bootstrapped/regtested on x86_64-linux and i686-linux on both 4.9 and 4.8 branches with --enable-checking=yes,rtl, ok for those branches? Is the testcase alone ok for 5.2/trunk? A safer alternative would be just to fold NON_LVALUE_EXPR of INTEGER_CST into the INTEGER_CST. 2015-06-12 Jakub Jelinek PR middle-end/63608 * gcc.c-torture/compile/pr63608.c: New test. Backported from mainline 2014-05-16 Eric Botcazou * fold-const (fold_unary_loc) : New case. : Pass arg0 instead of op0 to fold_convert_const. --- gcc/fold-const.c(revision 210517) +++ gcc/fold-const.c(revision 210518) @@ -7850,6 +7850,11 @@ fold_unary_loc (location_t loc, enum tre return fold_convert_loc (loc, type, op0); return NULL_TREE; +case NON_LVALUE_EXPR: + if (!maybe_lvalue_p (op0)) + return fold_convert_loc (loc, type, op0); + return NULL_TREE; + CASE_CONVERT: case FLOAT_EXPR: case FIX_TRUNC_EXPR: @@ -8113,7 +8118,7 @@ fold_unary_loc (location_t loc, enum tre } } - tem = fold_convert_const (code, type, op0); + tem = fold_convert_const (code, type, arg0); return tem ? tem : NULL_TREE; case ADDR_SPACE_CONVERT_EXPR: --- gcc/testsuite/gcc.c-torture/compile/pr63608.c.jj2015-06-12 10:55:16.484746890 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr63608.c 2015-06-12 10:53:58.0 +0200 @@ -0,0 +1,14 @@ +/* PR middle-end/63608 */ + +typedef long T; +typedef unsigned long U; +unsigned long a; + +unsigned long +foo (int b) +{ + T c = 0; + const U d = 2248593032UL; + a = (c = +d) | (~4L & ~b); + return c; +} Jakub
Re: [PATCH][PR debug/65549] Restore DW_AT_abstract_origin for cross-unit call sites
On June 12, 2015 12:31:02 PM GMT+02:00, Pierre-Marie de Rodat wrote: >On 06/12/2015 07:41 AM, Richard Biener wrote: >> On June 12, 2015 2:30:36 AM GMT+02:00, David Edelsohn > wrote: >>> This patch broke AIX bootstrap because dbxout.c was not updated for >>> the XCOFF_DEBUGGING_INFO case. >> >> OK. >> Thanks >> Richard. > >By the way, I think we should apply this fix to the GCC 5 branch as >well. May I? Yes
RE: backport the fixes of PR target/64011 and /61749 to 4.9 gcc
I didn't drop the test case and i have tested that case on my manchine(aarch64-linux) with qemu. I am sorry I forgot to add the testcase in the last patch. A new patch was added to the accessory. I am a new guy to the community and I will try my best to accord with the norm of the community next time. Sorry for my careless. Many thanks /Xiangyu Wei > -Original Message- > From: Marcus Shawcroft [mailto:marcus.shawcr...@gmail.com] > Sent: Thursday, June 11, 2015 5:25 PM > To: weixiangyu > Cc: James Greenhalgh; gcc-patches@gcc.gnu.org; Marcus Shawcroft; Richard > Earnshaw > Subject: Re: backport the fixes of PR target/64011 and /61749 to 4.9 gcc > > On 10 June 2015 at 03:46, weixiangyu wrote: > > Updated patches were attached. Rebased on the latest 4.9 branch. > > Tested on aarch64-linux (big-endian and little-endian) with qemu. > > OK for 4.9? > > > Hi, > > > And the second one: > > The original r215046 mainline commit contains a test case that is omitted from > the proposed back port, can you elaborate why you have chosen to drop the > test case? > > The usual convention on this list is to post one patch per email such that > each > email thread discusses just one patch. > > Thanks > /Marcus > > > > Index: gcc/ChangeLog > > > > === > > --- gcc/ChangeLog (revision 223867) > > +++ gcc/ChangeLog (working copy) > > @@ -1,3 +1,28 @@ > > +2015-06-09 Xiangyu Wei > > + > > + Backport from mainline r215046: > > + 2014-09-09 Kyrylo Tkachov > > + PR target/61749 > > + * config/aarch64/aarch64-builtins.c > (aarch64_types_quadop_qualifiers): > > + Use qualifier_immediate for last operand. Rename to... > > + (aarch64_types_ternop_lane_qualifiers): ... This. > > + (TYPES_QUADOP): Rename to... > > + (TYPES_TERNOP_LANE): ... This. > > + (aarch64_simd_expand_args): Return const0_rtx when > encountering user > > + error. Change return of 0 to return of NULL_RTX. > > + (aarch64_crc32_expand_builtin): Likewise. > > + (aarch64_expand_builtin): Return NULL_RTX instead of 0. > > + ICE when expanding unknown builtin. > > + * config/aarch64/aarch64-simd-builtins.def (sqdmlal_lane): Use > > + TERNOP_LANE qualifiers. > > + (sqdmlsl_lane): Likewise. > > + (sqdmlal_laneq): Likewise. > > + (sqdmlsl_laneq): Likewise. > > + (sqdmlal2_lane): Likewise. > > + (sqdmlsl2_lane): Likewise. > > + (sqdmlal2_laneq): Likewise. > > + (sqdmlsl2_laneq): Likewise. > > + * gcc.target/aarch64/vqdml_lane_intrinsics-bad_1.c: New test. > > Index: gcc/config/aarch64/aarch64-builtins.c > > > > === > > --- gcc/config/aarch64/aarch64-builtins.c (revision 223867) > > +++ gcc/config/aarch64/aarch64-builtins.c (working copy) > > @@ -172,10 +172,10 @@ > > aarch64_types_ternopu_qualifiers[SIMD_MAX_BUILTIN_ > > #define TYPES_TERNOPU (aarch64_types_ternopu_qualifiers) > > > > static enum aarch64_type_qualifiers > > -aarch64_types_quadop_qualifiers[SIMD_MAX_BUILTIN_ARGS] > > +aarch64_types_ternop_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] > >= { qualifier_none, qualifier_none, qualifier_none, > > - qualifier_none, qualifier_none }; > > -#define TYPES_QUADOP (aarch64_types_quadop_qualifiers) > > + qualifier_none, qualifier_immediate }; #define > > +TYPES_TERNOP_LANE (aarch64_types_ternop_lane_qualifiers) > > > > static enum aarch64_type_qualifiers > > aarch64_types_getlane_qualifiers[SIMD_MAX_BUILTIN_ARGS] > > @@ -818,8 +818,11 @@ aarch64_simd_expand_args (rtx target, int icode, i > > case SIMD_ARG_CONSTANT: > > if (!(*insn_data[icode].operand[argc + > have_retval].predicate) > > (op[argc], mode[argc])) > > - error_at (EXPR_LOCATION (exp), "incompatible type for > argument %d, " > > + { > > + error_at (EXPR_LOCATION (exp), "incompatible type > for argument %d, " > >"expected %", argc + 1); > > + return const0_rtx; > > + } > > break; > > > > case SIMD_ARG_STOP: > > @@ -886,7 +889,7 @@ aarch64_simd_expand_args (rtx target, int icode, i > >} > > > >if (!pat) > > -return 0; > > +return NULL_RTX; > > > >> -Original Message- > >> From: James Greenhalgh [mailto:james.greenha...@arm.com] > >> Sent: Thursday, May 28, 2015 9:58 PM > >> To: weixiangyu > >> Cc: gcc-patches@gcc.gnu.org; Marcus Shawcroft; Richard Earnshaw; > >> Yangfei > >> (Felix) > >> Subject: Re: backport the fixes of PR target/64011 and /61749 to 4.9 > >> gcc > >> > >> On Wed, May 27, 2015 at 03:49:24AM +0100, weixiangyu wrote: > >> > Hi, > >> > >> Hi, > >> > >> > The first patch backports the fix of PR > >> > target/64011(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64011) to > >> > the 4.
Re: [PATCH] [X86_64]: Add support for MONITORX and MWAITX ISA
On Fri, Jun 12, 2015 at 12:27 PM, Kumar, Venkataramanan wrote: >> > Ok for trunk ? >> >> OK for mainline with a small improvement below. >> >> +case IX86_BUILTIN_MONITORX: >> + arg0 = CALL_EXPR_ARG (exp, 0); >> + arg1 = CALL_EXPR_ARG (exp, 1); >> + arg2 = CALL_EXPR_ARG (exp, 2); >> + op0 = expand_normal (arg0); >> + op1 = expand_normal (arg1); >> + op2 = expand_normal (arg2); >> + if (!REG_P (op0)) >> + op0 = ix86_zero_extend_to_Pmode (op0); >> + if (!REG_P (op1)) >> + op1 = copy_to_mode_reg (SImode, op1); >> + if (!REG_P (op2)) >> + op2 = copy_to_mode_reg (SImode, op2); >> + emit_insn (ix86_gen_monitorx (op0, op1, op2)); >> + return 0; >> >> Please merge the above with existing IX86_BUILTIN_MONITOR. You can use >> emit_insn (fcode == IX86_BUILTIN_MONITOR >> ? ix86_gen_monitor (...) >> : ix86_gen_monitorx (...)); >> >> Thanks, >> Uros. > > Thank you. I committed the patch along with your suggestion. > Ref: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=224414 > > We would like to get this ISA support into next release compiler based on GCC > 5. > > Is this ok for gcc-5-branch? Should be OK (the branch has not diverged too much from the trunk yet), but please wait a week to see if any problem arises in the trunk, and to give some time for release managers to eventually object. Thanks, Uros.
Re: [PATCH][PR debug/65549] Restore DW_AT_abstract_origin for cross-unit call sites
On 06/12/2015 07:41 AM, Richard Biener wrote: On June 12, 2015 2:30:36 AM GMT+02:00, David Edelsohn wrote: This patch broke AIX bootstrap because dbxout.c was not updated for the XCOFF_DEBUGGING_INFO case. OK. Thanks Richard. By the way, I think we should apply this fix to the GCC 5 branch as well. May I? -- Pierre-Marie de Rodat
RE: [PATCH] [X86_64]: Add support for MONITORX and MWAITX ISA
Hi Uros, > -Original Message- > From: Uros Bizjak [mailto:ubiz...@gmail.com] > Sent: Thursday, June 11, 2015 3:50 PM > To: Kumar, Venkataramanan > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] [X86_64]: Add support for MONITORX and MWAITX ISA > > On Thu, Jun 11, 2015 at 11:49 AM, Kumar, Venkataramanan > wrote: > > Hi Maintainers, > > > > Ok for trunk ? > > OK for mainline with a small improvement below. > > +case IX86_BUILTIN_MONITORX: > + arg0 = CALL_EXPR_ARG (exp, 0); > + arg1 = CALL_EXPR_ARG (exp, 1); > + arg2 = CALL_EXPR_ARG (exp, 2); > + op0 = expand_normal (arg0); > + op1 = expand_normal (arg1); > + op2 = expand_normal (arg2); > + if (!REG_P (op0)) > + op0 = ix86_zero_extend_to_Pmode (op0); > + if (!REG_P (op1)) > + op1 = copy_to_mode_reg (SImode, op1); > + if (!REG_P (op2)) > + op2 = copy_to_mode_reg (SImode, op2); > + emit_insn (ix86_gen_monitorx (op0, op1, op2)); > + return 0; > > Please merge the above with existing IX86_BUILTIN_MONITOR. You can use > emit_insn (fcode == IX86_BUILTIN_MONITOR > ? ix86_gen_monitor (...) > : ix86_gen_monitorx (...)); > > Thanks, > Uros. Thank you. I committed the patch along with your suggestion. Ref: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=224414 We would like to get this ISA support into next release compiler based on GCC 5. Is this ok for gcc-5-branch? Regards, Venkat.
[patch] libstdc++/66464 fix codecvt_utf16::max_length()
Fixes a silly copy&paste error. Tested powerpc64le-linux, committing to trunk and gcc-5-branch. commit c7bb5649cc5706117a724dff484ecae8382279e1 Author: Jonathan Wakely Date: Fri Jun 12 10:44:50 2015 +0100 PR libstdc++/66464 * src/c++11/codecvt.cc (codecvt_utf16_base::do_max_length): Return 4 not 3. diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc index 2a11ca3..6b82aa8 100644 --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -1124,7 +1124,7 @@ do_length(state_type&, const extern_type* __from, int __codecvt_utf16_base::do_max_length() const throw() -{ return 3; } +{ return 4; } #ifdef _GLIBCXX_USE_WCHAR_T // Define members of codecvt_utf16 base class implementation.
RE: [PATCH, AArch64] [4.9] Backport
Sorry about that. The new patch contains code diff. The ICE i want to fix: (aarch64_strip_extend_or_extend): ...this, don't strip shifts, check RTX is well formed. If the patch is not applied,the following compilation will cause a Seg fault: ../../install/bin/aarch64-linux-gnu-gcc -w -O2 /home/wxy/tmp/test.i EMI_29344640_0_rd.c: In function 'main': EMI_29344640_0_rd.c:4005:1: internal compiler error: Segmentation fault 0x9aeb8f crash_signal /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/toplev.c:337 0xc7866e aarch64_is_extend_from_extract(machine_mode, rtx_def*, rtx_def*) /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:454 0xc78759 aarch64_strip_shift_or_extend /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:4474 0xc7e097 aarch64_rtx_costs /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:4614 0x95727f rtx_cost(rtx_def*, rtx_code, int, bool) /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/rtlanal.c:3879 0xc7dbe3 aarch64_rtx_costs /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:4693 0x95727f rtx_cost(rtx_def*, rtx_code, int, bool) /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/rtlanal.c:3879 0xc7dbe3 aarch64_rtx_costs /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:4693 0x95727f rtx_cost(rtx_def*, rtx_code, int, bool) /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/rtlanal.c:3879 0xc7dbe3 aarch64_rtx_costs /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/config/aarch64/aarch64.c:4693 0x95727f rtx_cost(rtx_def*, rtx_code, int, bool) /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/rtlanal.c:3879 0xd736fd set_src_cost /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/rtl.h:1370 0xd736fd distribute_and_simplify_rtx /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:9308 0xd73899 simplify_logical /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:6620 0xd7b837 combine_simplify_rtx /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:5869 0xd7dc04 subst /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:5176 0xd7da2f subst /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:5121 0xd7fbf5 try_combine /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:3144 0xd84c38 combine_instructions /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:1392 0xd84ea2 rest_of_handle_combine /home/wxy/SDK_V1R5_trunk/SDK/build/script/cpu_hcc/p660/p660_build_dir/src/gcc-4.9/gcc/combine.c:13876 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. Cheers /XIangyu Wei -Original Message- From: Marcus Shawcroft [mailto:marcus.shawcr...@gmail.com] Sent: Thursday, June 11, 2015 4:42 PM To: weixiangyu Cc: gcc-patches@gcc.gnu.org; James Greenhalgh; marcus.shawcr...@arm.com; richard.earns...@arm.com; Yangfei (Felix) Subject: Re: [PATCH, AArch64] [4.9] Backport On 10 June 2015 at 11:06, weixiangyu wrote: > Another backport patch which fixes a csmith ICE problem. Rebased on the > latest 4.9 branch. > Tested ok on aarch64-linux with qemu. > Hi, The attached patch contains a ChangeLog diff but no code diff. The patch r210497 on mainline is an adjustment to the cost model. If this patch fixes an ICE than I suspect the underlying issue is not resolved but instead changing the cost model slightly just hides the issue. Can you elaborate what is happening in the ICE you are trying to fix? Cheers /Marcus r210497_v2.diff Description: r210497_v2.diff
Re: [PATCH][PR debug/65549] Restore DW_AT_abstract_origin for cross-unit call sites
On 06/12/2015 07:41 AM, Richard Biener wrote: On June 12, 2015 2:30:36 AM GMT+02:00, David Edelsohn wrote: This patch broke AIX bootstrap because dbxout.c was not updated for the XCOFF_DEBUGGING_INFO case. OK. Thanks Richard. Sorry about that and thank you for the fix! -- Pierre-Marie de Rodat
Re: [Patch libstdc++] Rewrite cpu/generic/atomic_word.h
On 12/06/15 10:30 +0100, Ramana Radhakrishnan wrote: On Fri, Jun 12, 2015 at 10:06 AM, Jonathan Wakely wrote: On 11/06/15 23:56 +0200, Torvald Riegel wrote: > On Fri, 2015-05-22 at 12:37 +0100, Ramana Radhakrishnan wrote: I don't think we can remove _GLIBCXX_READ_MEM_BARRIER and _GLIBCXX_WRITE_MEM_BARRIER from atomic_word.h even though they are superseded by the atomics as it is published in the documentation as available macros. I see. We should at least update the documentation of those, as the current one isn't a really portable specification. If we can, I'd deprecate them. Jonathan, what do you think? Yes, I'm in favour of deprecating them. They are GCC-specific anyway, so there is no reason to prefer them to std::atomic_ or __atomic_ fences. I'll treat it as a follow-up. Sure. Can I get an ack for this patch though ? I could backport this as is to fix the problems on ARM / AArch64 (PR target/66200) - alternatively I'll provide header implementations of the same for the release branches. Yes, OK for trunk, thanks. I think it's safer if the backport only changes the ARM and AArch64 implementations, at least for now. If no problems are found on trunk we could consider backporting the whole thing for all targets, but it may not be worth it if the other targets are working OK.
Re: [PATCH] PR33661 Fix problem with register asm in templates
On 06/12/2015 11:24 AM, Jakub Jelinek wrote: > Looks mostly good, just wonder about the powerpc scan-assembler. > Shouldn't that be "reg: (%r)?8" instead? I think powerpc has -mregnames > option, dunno if some target doesn't even use it by default. Good catch. I'll change that. -Andreas-
Re: [Patch libstdc++] Rewrite cpu/generic/atomic_word.h
On Fri, Jun 12, 2015 at 10:06 AM, Jonathan Wakely wrote: > On 11/06/15 23:56 +0200, Torvald Riegel wrote: >>> >>> > On Fri, 2015-05-22 at 12:37 +0100, Ramana Radhakrishnan wrote: >>> I don't think we can remove _GLIBCXX_READ_MEM_BARRIER and >>> _GLIBCXX_WRITE_MEM_BARRIER from atomic_word.h even though they are >>> superseded by the atomics as it is published in the documentation as >>> available macros. >> >> >> I see. We should at least update the documentation of those, as the >> current one isn't a really portable specification. If we can, I'd >> deprecate them. Jonathan, what do you think? > > > Yes, I'm in favour of deprecating them. They are GCC-specific anyway, > so there is no reason to prefer them to std::atomic_ or __atomic_ > fences. I'll treat it as a follow-up. Can I get an ack for this patch though ? I could backport this as is to fix the problems on ARM / AArch64 (PR target/66200) - alternatively I'll provide header implementations of the same for the release branches. regards Ramana
Re: [PATCH] PR33661 Fix problem with register asm in templates
On Fri, Jun 12, 2015 at 10:52:56AM +0200, Andreas Krebbel wrote: > Yes that's better. I've adjusted the testcase as you proposed and > have tested it on x86_64, ppc, and s390x with -m32(-m31) and -m64. As I said earlier, talking just about the testcase, leaving review to Jason. > --- /dev/null > +++ b/gcc/testsuite/g++.dg/pr33661.C > @@ -0,0 +1,31 @@ > +/* PR c++/33661 */ > + > +/* { dg-do compile } */ > +/* { dg-options "-O1" } */ > +/* { dg-final { scan-assembler "reg: %r8" { target { { x86_64*-*-* i?86-*-* > } && lp64 } } } } */ > +/* { dg-final { scan-assembler "reg: %ecx" { target { { x86_64*-*-* i?86-*-* > } && ia32 } } } } */ > +/* { dg-final { scan-assembler "reg: 8" { target { powerpc*-*-* } } } } */ Looks mostly good, just wonder about the powerpc scan-assembler. Shouldn't that be "reg: (%r)?8" instead? I think powerpc has -mregnames option, dunno if some target doesn't even use it by default. Jakub
RE: [RFC] Sanitize rtx_addr_can_trap_p_1
Hi, On Thu, 11 Jun 2015 13:17:47 +0200, Eric Botcazou wrote: > >> Other than that, as I said already in the PR, I'm in favor of applying it to >> the trunk (only, not release branches) and watching for performance and/or >> wrong-code issues, but Eric is against it. What do others think about it? > > Yes, I'm against it, I think that the patch will introduce more issues, and on > real-life software this time, than it fixes, but you just need to a second > maintainer to overrule me. > I think I can say, my patch does not change the return value on frame_pointer_rtx. So that will stay as before (identical as with your patch). BTW: meanwhile I found out, that all these 2930 accesses to frame_pointer_rtx with positive offset seem to happen in the reload pass. That's funny, because I think that did not happen when I looked at it the last time, and I do not yet understand why this happens now. The worst thing that can happen on the other base registers, would be a few disabled if conversions, on offsets that exceed the safety margins... Of course, it would be good if some one with deeper insight than myself would look at the patch in detail if the assumptions are actually safe. I believe they are. But one thing is sure, really nonsense values like 0xDEADBEEF will be outside the margins, and that is not the case right now. Thanks Bernd.
Re: [PATCH, RTL-optimization]: Optimize need_atomic_barrier_p a bit
On Thu, Jun 11, 2015 at 11:35 AM, Uros Bizjak wrote: > Hello! > > We can use MEMMODEL_BASE_MASK here to avoid a couple of similar cases. > > 2015-06-11 Uros Bizjak > > * emit-rtl.c (need_atomic_barrier_p): Mask model with > MEMMODEL_BASE_MASK. Remove MEMMODEL_SYNC_* cases. > > Tested on x86_64-linux-gnu {,-m32}. > > OK for mainline? I went ahead and committed the patch to mainline. It is obvious, after all. Uros.
Re: [C/C++ PATCH] Implement -Wshift-overflow (PR c++/55095) (take 3)
Ping. On Fri, Jun 05, 2015 at 10:55:08AM +0200, Marek Polacek wrote: > On Thu, Jun 04, 2015 at 09:04:19PM +, Joseph Myers wrote: > > The C changes are OK. > > Jason, do you want to approve the C++ parts? > > Thanks, Marek
Re: [Patch libstdc++] Rewrite cpu/generic/atomic_word.h
On 11/06/15 23:56 +0200, Torvald Riegel wrote: > On Fri, 2015-05-22 at 12:37 +0100, Ramana Radhakrishnan wrote: I don't think we can remove _GLIBCXX_READ_MEM_BARRIER and _GLIBCXX_WRITE_MEM_BARRIER from atomic_word.h even though they are superseded by the atomics as it is published in the documentation as available macros. I see. We should at least update the documentation of those, as the current one isn't a really portable specification. If we can, I'd deprecate them. Jonathan, what do you think? Yes, I'm in favour of deprecating them. They are GCC-specific anyway, so there is no reason to prefer them to std::atomic_ or __atomic_ fences.
Re: [PATCH][GSoC] Extend shared_ptr to support arrays
On 11/06/15 23:43 -0700, Tim Shen wrote: + using element_type = _Tp[N]; using element_type = typename std::remove_extent_t<_Tp>; ? Well at that point in the file we're inside the __shared_ptr<__libfund_v1<_Tp[N]> specialization, so it could be simply: + using element_type = _Tp; However, if we combine some or all of the partial specializations into one, as I suggested, then it would become simply: using element_type = std::remove_extent_t<_Tp>; (Without the 'typename', although for this to work the new partial specializations need to be surrounded in #if __cplusplus >= 201402L, otherwise the remove_extent_t alias is no available.) This is a good example of why I think we should combine the very similar specializations, and then use helper traits to define the parts that vary depending on _Tp, instead of duplicating the entire class template. using _Deleter_type = typename conditional::value, _Normal_deleter, _Array_deleter>::type; Sadly std::default_delete doesn't support _Tp[N]. It will also works to create a std::default_delete-ish helper trait, with _Tp[N] specialized to `delete []` as well. Yes. Another point I missed in my review is that 'N' is not a reserved identifier, it needs to be changed to _Nm or something else in the implementation namespace, so that it still works even if users do: #define N "Boom!" :-P #include
Re: match.pd: Optimize (x & y) ^ (x | y)
On Fri, Jun 12, 2015 at 08:44:45AM +0200, Marc Glisse wrote: > On Fri, 12 Jun 2015, Richard Biener wrote: > > >>Not judging at all whether it is desirable or not, but you might have > >>hit the issue that when you want several convert?, you need to use the > >>spelling convert1?, convert2?, and it stops there, while here you would > >>probably want at least 4 (maybe 6?) for this case. You might be able to > >>work around it with a user-defined predicate, but I keep getting errors > >>like > >>generic-match.c:6655:16: error: redeclaration of ‘tree_node* o20_pops [2]’ I remember trying convert1?, convert2?, and so on. But I gave up soon. > >>If you want to reproduce the error (this is probably not good as is, it > >>is only provided as a reproducer) > >> > >>(match (nopand @0 @1) > >> (bit_and (convert1? @0) (convert2? @1)) > >> (if (tree_nop_conversion_p (type, TREE_TYPE (@0)) > >> && tree_nop_conversion_p (type, TREE_TYPE (@1) > >>(match (nopior @0 @1) > >> (bit_ior (convert1? @0) (convert2? @1)) > >> (if (tree_nop_conversion_p (type, TREE_TYPE (@0)) > >> && tree_nop_conversion_p (type, TREE_TYPE (@1) > >>(simplify > >> (bit_xor:c (convert1? (nopand@2 @0 @1)) > >>(convert2? (nopior@3 @0 @1))) > >> (if (tree_nop_conversion_p (type, TREE_TYPE (@2)) > >> && tree_nop_conversion_p (type, TREE_TYPE (@3))) > >> (bit_xor (convert @0) (convert @1 > >> > >> > >>fold-const.c traditionally avoided the combinatorial explosion by using > >>strip_nops. > > > >Yeah. We can probably special case conditional conversions in code > >generation instead of lowering it. And then go the full way and special > >case nop conversions so you can avoid writing the predicate as well. > > Without special casing, I currently have: > > (match (nopcvt @0) > (convert? @0) > (if (tree_nop_conversion_p (type, TREE_TYPE (@0) > (simplify > (bit_xor:c (convert1? (bit_and@2 (nopcvt @0) (nopcvt @1))) > (convert2? (bit_ior:c (nopcvt @0) (nopcvt @1 > (if (tree_nop_conversion_p (type, TREE_TYPE (@2))) > (bit_xor (convert @0) (convert @1 > > which simplifies Jakub's testcase without exploding the size of *-match.c, > but it is still not very satisfying. Yeah, imagine if we'd have to change every pattern like that :-(. Marek
Re: [PATCH] PR33661 Fix problem with register asm in templates
Yes that's better. I've adjusted the testcase as you proposed and have tested it on x86_64, ppc, and s390x with -m32(-m31) and -m64. Bye, -Andreas- gcc/cp/ 2015-06-12 Andreas Krebbel PR c++/33661 * decl.c (cp_finish_decl): Set assembler name for register asm constructs. * pt.c (tsubst_decl): Do not zero out the assembler name for register asm constructs. gcc/testsuite/ 2015-06-12 Andreas Krebbel PR c++/33661 * g++.dg/pr33661.C: New test. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a8cb358..b1eb33d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6536,6 +6536,13 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, if (init) DECL_INITIAL (decl) = init; + + /* Set the DECL_ASSEMBLER_NAME for the object. */ + if (asmspec && VAR_P (decl) && DECL_REGISTER (decl)) + { + set_user_assembler_name (decl, asmspec); + DECL_HARD_REGISTER (decl) = 1; + } return; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a0c5d7c..74ec5dd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11384,7 +11384,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) cp_apply_type_quals_to_decl (cp_type_quals (type), r); DECL_CONTEXT (r) = ctx; /* Clear out the mangled name and RTL for the instantiation. */ - SET_DECL_ASSEMBLER_NAME (r, NULL_TREE); + if (!VAR_P (r) || !DECL_HARD_REGISTER (r)) + SET_DECL_ASSEMBLER_NAME (r, NULL_TREE); if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL)) SET_DECL_RTL (r, NULL); /* The initializer must not be expanded until it is required; diff --git a/gcc/testsuite/g++.dg/pr33661.C b/gcc/testsuite/g++.dg/pr33661.C new file mode 100644 index 000..2df963f --- /dev/null +++ b/gcc/testsuite/g++.dg/pr33661.C @@ -0,0 +1,31 @@ +/* PR c++/33661 */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-final { scan-assembler "reg: %r8" { target { { x86_64*-*-* i?86-*-* } && lp64 } } } } */ +/* { dg-final { scan-assembler "reg: %ecx" { target { { x86_64*-*-* i?86-*-* } && ia32 } } } } */ +/* { dg-final { scan-assembler "reg: 8" { target { powerpc*-*-* } } } } */ +/* { dg-final { scan-assembler "reg: %r8" { target { s390*-*-* } } } } */ + +typedef unsigned long long int uint64_t; + +template < typename T > static inline void +bar (T c) +{ + int a; +#if defined(__x86_64__) || defined(__PPC__) || defined(__s390__) + register unsigned long b __asm__ ("r8") = (unsigned long)&a; + __asm__ volatile ("reg: %0" : : "r" (b)); +#elif defined(__i386__) + register unsigned long b __asm__ ("ecx") = (unsigned long)&a; + __asm__ volatile ("reg: %0" : : "r" (b)); +#else + unsigned long b = (unsigned long)&a; +#endif +} + +void +foo (uint64_t c) +{ + bar (c); +}
Re: Fix verify_type ICE with -fshort-enum
On Thu, Jun 11, 2015 at 11:47:43PM +0200, Jan Hubicka wrote: > Hi, > gcc.c-torture/execute/930408-1.c currently ICE on -fshort-enum target(s) > because > TYPE_PACKED is not consistently set among type variants. I guess that's because of the forward declaration in the test. But I have no access to an ARM machine, so can't verify. > Bootstrapped/regtested ppc64le-linux, OK? > Honza > > PR middle-end/66325 > * c-decl.c (start_enum): Set TYPE_PACKED consistently among type > variants. > Index: c-decl.c > === > --- c-decl.c (revision 224250) > +++ c-decl.c (working copy) > @@ -7946,7 +7946,8 @@ >the_enum->enum_overflow = 0; > >if (flag_short_enums) > -TYPE_PACKED (enumtype) = 1; > +for (tree v = TYPE_MAIN_VARIANT (enumtype); v ;v = TYPE_NEXT_VARIANT (v)) Please fix the formatting here: no space before ;. Ok with that change. Marek
[ping] Couple of patches for -fdump-ada-spec
Add query for template-dependent arguments to -fdump-ada-spec: http://gcc.gnu.org/ml/gcc-patches/2015-06/msg00403.html Get rid of assembly file with -fdump-ada-spec: http://gcc.gnu.org/ml/gcc-patches/2015-06/msg00420.html Thanks in advance. -- Eric Botcazou
Re: [Patch, fortran, PR44672, v10] [F08] ALLOCATE with SOURCE and no array-spec
Hi Thomas, thanks for the review and valuing my effort. I am on travel over the weekend, i.e., I will commit the job earliest on Monday giving objections a bit more time. Regards and thanks, Andre On Thu, 11 Jun 2015 23:59:48 +0200 Thomas Koenig wrote: > Hi Andre, > > > please find attached an updated version of the patch. This patch simplifies > > some cases and ensures more straight line code. Furthermore was a bug in the > > interfacing routine for the _vptr->_copy() routine removed, where not the > > third and fourth arguments translated to be passed be value but the fourth > > and fifth (cs start counting at zero...). > > > > Bootstraps and regtests fine on x86_64-linux-gnu/f21. > > > > Ok for trunk? > > Following the discussions, and looking through the patch, I would say > this patch is in pretty good shape (and quite impressive, too). > > My vote would be to commit as is, unless something important comes up, > and fix smaller problems and possible corner cases afterwards, if any > exist. However, I am not really deep into these aspects of the > compiler, and I would still like to leave some time for others to > comment if they think this is appropriate. > > So, OK to commit in two days unless there are objections. > > Thanks for the patch! > > Thomas > -- Andre Vehreschild * Email: vehre ad gmx dot de
Re: [patch] fix darwin bootstrap by avoiding duplicate DIE attributes
../../gcc/dwarf2out.c:5693:1: error: 'void check_die(dw_die_ref)' defined but not used [-Werror=unused-function] Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."