- Dec 21, 2021
-
-
Martin Liska authored
ChangeLog: * config.sub: Change mode back to 755.
-
Xionghu Luo authored
v8 changes: 1. Use hotter_than_inner_loop instead of colder to store a hotter loop nearest to loop. 2. Update the logic in fill_coldest_and_hotter_out_loop and get_coldest_out_loop to make common case O(1). 3. Update function argument bb_colder_than_loop_preheader. 4. Make cached array to vec<class *loop> for index checking. v7 changes: 1. Refine get_coldest_out_loop to replace loop with checking pre-computed coldest_outermost_loop and colder_than_inner_loop. 2. Add function fill_cold_out_loop, compute coldest_outermost_loop and colder_than_inner_loop recursively without loop. v6 changes: 1. Add function fill_coldest_out_loop to pre compute the coldest outermost loop for each loop. 2. Rename find_coldest_out_loop to get_coldest_out_loop. 3. Add testcase ssa-lim-22.c to differentiate with ssa-lim-19.c. v5 changes: 1. Refine comments for new functions. 2. Use basic_block instead of count in bb_colder_than_loop_preheader to align with function name. 3. Refine with simpler implementation for get_coldest_out_loop and ref_in_loop_hot_body::operator for better understanding. v4 changes: 1. Sort out profile_count comparision to function bb_cold_than_loop_preheader. 2. Update ref_in_loop_hot_body::operator () to find cold_loop before compare. 3. Split RTL invariant motion part out. 4. Remove aux changes. v3 changes: 1. Handle max_loop in determine_max_movement instead of outermost_invariant_loop. 2. Remove unnecessary changes. 3. Add for_all_locs_in_loop (loop, ref, ref_in_loop_hot_body) in can_sm_ref_p. 4. "gsi_next (&bsi);" in move_computations_worker is kept since it caused infinite loop when implementing v1 and the iteration is missed to be updated actually. v1: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576488.html v2: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579086.html v3: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580211.html v4: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581231.html v5: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581961.html ... v8: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586209.html There was a patch trying to avoid move cold block out of loop: https://gcc.gnu.org/pipermail/gcc/2014-November/215551.html Richard suggested to "never hoist anything from a bb with lower execution frequency to a bb with higher one in LIM invariantness_dom_walker before_dom_children". In gimple LIM analysis, add get_coldest_out_loop to move invariants to expected target loop, if profile count of the loop bb is colder than target loop preheader, it won't be hoisted out of loop. Likely for store motion, if all locations of the REF in loop is cold, don't do store motion of it. SPEC2017 performance evaluation shows 1% performance improvement for intrate GEOMEAN and no obvious regression for others. Especially, 500.perlbench_r +7.52% (Perf shows function S_regtry of perlbench is largely improved.), and 548.exchange2_r+1.98%, 526.blender_r +1.00% on P8LE. gcc/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * tree-ssa-loop-im.c (bb_colder_than_loop_preheader): New function. (get_coldest_out_loop): New function. (determine_max_movement): Use get_coldest_out_loop. (move_computations_worker): Adjust and fix iteration udpate. (class ref_in_loop_hot_body): New functor. (ref_in_loop_hot_body::operator): New. (can_sm_ref_p): Use for_all_locs_in_loop. (fill_coldest_and_hotter_out_loop): New. (tree_ssa_lim_finalize): Free coldest_outermost_loop and hotter_than_inner_loop. (loop_invariant_motion_in_fun): Call fill_coldest_and_hotter_out_loop. gcc/testsuite/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * gcc.dg/tree-ssa/recip-3.c: Adjust. * gcc.dg/tree-ssa/ssa-lim-19.c: New test. * gcc.dg/tree-ssa/ssa-lim-20.c: New test. * gcc.dg/tree-ssa/ssa-lim-21.c: New test. * gcc.dg/tree-ssa/ssa-lim-22.c: New test. * gcc.dg/tree-ssa/ssa-lim-23.c: New test.
-
Xionghu Luo authored
In tree-ssa-loop-split.c, split_loop and split_loop_on_cond does two kind of split. split_loop only works for single loop and insert edge at exit when split, while split_loop_on_cond is not limited to single loop and insert edge at latch when split. Both split behavior should consider loop count and probability update. For split_loop, loop split condition is moved in front of loop1 and loop2; But split_loop_on_cond moves the condition between loop1 and loop2, this patch does: 1) profile count proportion for both original loop and copied loop without dropping down the true branch's count; 2) probability update in the two loops and between the two loops. Regression tested pass. Changes diff for split_loop and split_loop_on_cond cases: 1) diff base/loop-split.c.151t.lsplit patched/loop-split.c.152t.lsplit ... <bb 2> [local count: 118111600]: if (beg_5(D) < end_8(D)) goto <bb 14>; [89.00%] else goto <bb 6>; [11.00%] <bb 14> [local count: 105119324]: if (beg2_6(D) < c_9(D)) - goto <bb 15>; [100.00%] + goto <bb 15>; [33.00%] else - goto <bb 16>; [100.00%] + goto <bb 16>; [67.00%] - <bb 15> [local count: 105119324]: + <bb 15> [local count: 34689377]: _25 = beg_5(D) + 1; _26 = end_8(D) - beg_5(D); _27 = beg2_6(D) + _26; _28 = MIN_EXPR <c_9(D), _27>; - <bb 3> [local count: 955630225]: + <bb 3> [local count: 315357973]: # i_16 = PHI <i_11(8), beg_5(D)(15)> # j_17 = PHI <j_12(8), beg2_6(D)(15)> printf ("a: %d %d\n", i_16, j_17); i_11 = i_16 + 1; j_12 = j_17 + 1; if (j_12 < _28) - goto <bb 8>; [89.00%] + goto <bb 8>; [29.37%] else - goto <bb 17>; [11.00%] + goto <bb 17>; [70.63%] - <bb 8> [local count: 850510901]: + <bb 8> [local count: 280668596]: goto <bb 3>; [100.00%] - <bb 16> [local count: 105119324]: + <bb 16> [local count: 70429947]: # i_22 = PHI <beg_5(D)(14), i_29(17)> # j_23 = PHI <beg2_6(D)(14), j_30(17)> <bb 10> [local count: 955630225]: # i_2 = PHI <i_22(16), i_20(13)> # j_1 = PHI <j_23(16), j_21(13)> i_20 = i_2 + 1; j_21 = j_1 + 1; if (end_8(D) > i_20) - goto <bb 13>; [89.00%] + goto <bb 13>; [59.63%] else - goto <bb 9>; [11.00%] + goto <bb 9>; [40.37%] - <bb 13> [local count: 850510901]: + <bb 13> [local count: 569842305]: goto <bb 10>; [100.00%] <bb 17> [local count: 105119324]: # i_29 = PHI <i_11(3)> # j_30 = PHI <j_12(3)> if (end_8(D) > i_29) goto <bb 16>; [80.00%] else goto <bb 9>; [20.00%] <bb 9> [local count: 105119324]: <bb 6> [local count: 118111600]: return 0; } <bb 2> [local count: 118111600]: - if (beg_5(D) < end_8(D)) + _1 = end_6(D) - beg_7(D); + j_9 = _1 + beg2_8(D); + if (end_6(D) > beg_7(D)) goto <bb 14>; [89.00%] else goto <bb 6>; [11.00%] <bb 14> [local count: 105119324]: - if (beg2_6(D) < c_9(D)) - goto <bb 15>; [100.00%] + if (j_9 >= c_11(D)) + goto <bb 15>; [33.00%] else - goto <bb 16>; [100.00%] + goto <bb 16>; [67.00%] - <bb 15> [local count: 105119324]: - _25 = beg_5(D) + 1; - _26 = end_8(D) - beg_5(D); - _27 = beg2_6(D) + _26; - _28 = MIN_EXPR <c_9(D), _27>; - - <bb 3> [local count: 955630225]: - # i_16 = PHI <i_11(8), beg_5(D)(15)> - # j_17 = PHI <j_12(8), beg2_6(D)(15)> - printf ("a: %d %d\n", i_16, j_17); - i_11 = i_16 + 1; - j_12 = j_17 + 1; - if (j_12 < _28) - goto <bb 8>; [89.00%] + <bb 15> [local count: 34689377]: + _27 = end_6(D) + -1; + _28 = beg_7(D) - end_6(D); + _29 = j_9 + _28; + _30 = _29 + 1; + _31 = MAX_EXPR <c_11(D), _30>; + + <bb 3> [local count: 315357973]: + # i_18 = PHI <i_13(8), end_6(D)(15)> + # j_19 = PHI <j_14(8), j_9(15)> + printf ("a: %d %d\n", i_18, j_19); + i_13 = i_18 + -1; + j_14 = j_19 + -1; + if (j_14 >= _31) + goto <bb 8>; [29.37%] else - goto <bb 17>; [11.00%] + goto <bb 17>; [70.63%] - <bb 8> [local count: 850510901]: + <bb 8> [local count: 280668596]: goto <bb 3>; [100.00%] - <bb 16> [local count: 105119324]: - # i_22 = PHI <beg_5(D)(14), i_29(17)> - # j_23 = PHI <beg2_6(D)(14), j_30(17)> + <bb 16> [local count: 70429947]: + # i_24 = PHI <end_6(D)(14), i_32(17)> + # j_25 = PHI <j_9(14), j_33(17)> <bb 10> [local count: 955630225]: - # i_2 = PHI <i_22(16), i_20(13)> - # j_1 = PHI <j_23(16), j_21(13)> - i_20 = i_2 + 1; - j_21 = j_1 + 1; - if (end_8(D) > i_20) + # i_3 = PHI <i_24(16), i_22(13)> + # j_2 = PHI <j_25(16), j_23(13)> + i_22 = i_3 + -1; + j_23 = j_2 + -1; + if (beg_7(D) < i_22) goto <bb 13>; [89.00%] else goto <bb 9>; [11.00%] - <bb 13> [local count: 850510901]: + <bb 13> [local count: 569842305]: goto <bb 10>; [100.00%] <bb 17> [local count: 105119324]: - # i_29 = PHI <i_11(3)> - # j_30 = PHI <j_12(3)> - if (end_8(D) > i_29) + # i_32 = PHI <i_13(3)> + # j_33 = PHI <j_14(3)> + if (beg_7(D) < i_32) goto <bb 16>; [80.00%] else goto <bb 9>; [20.00%] <bb 9> [local count: 105119324]: <bb 6> [local count: 118111600]: return 0; } 2) diff base/loop-cond-split-1.c.151t.lsplit patched/loop-cond-split-1.c.151t.lsplit: ... <bb 2> [local count: 118111600]: if (n_7(D) > 0) goto <bb 4>; [89.00%] else goto <bb 3>; [11.00%] <bb 3> [local count: 118111600]: return; <bb 4> [local count: 105119324]: pretmp_3 = ga; - <bb 5> [local count: 955630225]: + <bb 5> [local count: 315357973]: # i_13 = PHI <i_10(20), 0(4)> # prephitmp_12 = PHI <prephitmp_5(20), pretmp_3(4)> if (prephitmp_12 != 0) goto <bb 6>; [33.00%] else goto <bb 7>; [67.00%] <bb 6> [local count: 315357972]: _2 = do_something (); ga = _2; - <bb 7> [local count: 955630225]: + <bb 7> [local count: 315357973]: # prephitmp_5 = PHI <prephitmp_12(5), _2(6)> i_10 = inc (i_13); if (n_7(D) > i_10) goto <bb 21>; [89.00%] else goto <bb 11>; [11.00%] <bb 11> [local count: 105119324]: goto <bb 3>; [100.00%] - <bb 21> [local count: 850510901]: + <bb 21> [local count: 280668596]: if (prephitmp_12 != 0) - goto <bb 20>; [100.00%] + goto <bb 20>; [33.00%] else - goto <bb 19>; [INV] + goto <bb 19>; [67.00%] - <bb 20> [local count: 850510901]: + <bb 20> [local count: 280668596]: goto <bb 5>; [100.00%] - <bb 19> [count: 0]: + <bb 19> [local count: 70429947]: # i_23 = PHI <i_10(21)> # prephitmp_25 = PHI <prephitmp_5(21)> - <bb 12> [local count: 955630225]: + <bb 12> [local count: 640272252]: # i_15 = PHI <i_23(19), i_22(16)> # prephitmp_16 = PHI <prephitmp_25(19), prephitmp_16(16)> i_22 = inc (i_15); if (n_7(D) > i_22) goto <bb 16>; [89.00%] else goto <bb 11>; [11.00%] - <bb 16> [local count: 850510901]: + <bb 16> [local count: 569842305]: goto <bb 12>; [100.00%] } gcc/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * tree-ssa-loop-split.c (split_loop): Fix incorrect profile_count and probability. (do_split_loop_on_cond): Likewise.
-
Xionghu Luo authored
r12-4526 cancelled jump thread path rotates loop. It exposes a issue in profile-estimate when predict_extra_loop_exits, outer loop's exit edge is marked as inner loop's extra loop exit and set with incorrect prediction, then a hot inner loop will become cold loop finally through optimizations, this patch add loop check when searching extra exit edges to avoid unexpected predict_edge from predict_paths_for_bb. Regression tested on P8LE. gcc/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> PR middle-end/103270 * predict.c (predict_extra_loop_exits): Add loop parameter. (predict_loops): Call with loop argument. gcc/testsuite/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> PR middle-end/103270 * gcc.dg/pr103270.c: New test.
-
Xionghu Luo authored
These four UNSPECS seems could be replaced with native RTL. For "(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))": Quoted David's explanation: "The design came from the early implementation of Altivec: https://gcc.gnu.org/pipermail/gcc-patches/2002-May/077409.html If one later checks for saturation (reads VSCR), one needs a corresponding SET of the value. It's set in an architecture-specific manner that isn't described to GCC, but it's set, not just clobbered and in an undefined state. The RTL does not describe that VSCR is set to the value 0. The (const_int 0) is not the value set. You can think of the (const_int 0) as a dummy RTL argument to the VSCR UNSPEC. UNSPEC requires at least one argument and the pattern doesn't try to express the argument, so it uses a dummy RTL constant. It's part of a PARALLEL and the plus or minus already expresses the data dependency of the pattern on the input operands." gcc/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * config/rs6000/altivec.md (altivec_vaddu<VI_char>s): Replace UNSPEC_VADDU with us_plus. (altivec_vadds<VI_char>s): Replace UNSPEC_VADDS with ss_plus. (altivec_vsubu<VI_char>s): Replace UNSPEC_VSUBU with us_minus. (altivec_vsubs<VI_char>s): Replace UNSPEC_VSUBS with ss_minus. (altivec_abss_<mode>): Likewise.
-
GCC Administrator authored
-
- Dec 20, 2021
-
-
Joseph Myers authored
* es.po: Update.
-
Uros Bizjak authored
The clever trick to duplicate the value of the input operand into itself proved not so clever after all. The splitter should not clobber the input operand in any case, since the register can hold the value outside the HImode lowpart when accessed as subreg. Use the standard earlyclobber approach instead. The testcase fails with avx2 ISA, but I was not able to create the testcase that wouldn't require -mavx512fp16 compile flag. 2021-12-20 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: PR target/103772 * config/i386/sse.md (<sse2p4_1>_pinsr<ssemodesuffix>): Add earlyclobber to (x,x,x,i) alternative. (<sse2p4_1>_pinsr<ssemodesuffix> peephole2): Remove. (<sse2p4_1>_pinsr<ssemodesuffix> splitter): Use output operand as a temporary register. Split after reload_completed.
-
Patrick Palka authored
When instantiating a call to a member function of a class template, we repeat the member function lookup in order to obtain the corresponding partially instantiated functions. Within an incomplete-class context however, we need to be more careful when repeating the lookup because we don't want to introduce later-declared member functions that weren't visible at template definition time. We're currently not careful enough in this respect, which causes us to reject memfn1.C below. This patch fixes this issue by making tsubst_baselink filter out from the instantiation-time lookup those member functions that were invisible at template definition time. This is really only necessary within an incomplete-class context, so this patch adds a heuristic flag to BASELINK to help us avoid needlessly performing this filtering step (which would be a no-op) in complete-class contexts. This is also necessary for the ahead-of-time overload set pruning implemented in r12-6075 to be effective for member functions within class templates. gcc/cp/ChangeLog: * call.c (build_new_method_call): Set BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P on the pruned baselink. * cp-tree.h (BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P): Define. * pt.c (filter_memfn_lookup): New subroutine of tsubst_baselink. (tsubst_baselink): Use filter_memfn_lookup on the new lookup result when BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P is set on the old baselink. Remove redundant BASELINK_P check. * search.c (build_baselink): Set BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P appropriately. gcc/testsuite/ChangeLog: * g++.dg/lookup/memfn1.C: New test. * g++.dg/template/non-dependent16b.C: New test.
-
Iain Buclaw authored
D front-end changes: - Import dmd v2.098.1 - Remove calling of _d_delstruct from code generator. Druntime changes: - Import druntime v2.098.1 Phobos changes: - Import phobos v2.098.1 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ad8412530. * expr.cc (ExprVisitor::visit (DeleteExp *)): Remove code generation of _d_delstruct. * runtime.def (DELSTRUCT): Remove. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime fd9a4544. * src/MERGE: Merge upstream phobos 495e835c2.
-
Olivier Hainque authored
10000 / 78 is strictly greater than 128 so we will actually do 128+1 strides in foo() for s == 78 and p[] needs to be dimensioned accordingly. 2021-12-20 Olivier Hainque <hainque@adacore.com> gcc/testsuite/ * gcc.dg/vect/vect-simd-20.c: Fix size of p[] to accommodate the number of strides performed by foo() for s == 78.
-
Roger Sayle authored
While working on a middle-end patch to more aggressively use highpart multiplications on targets that support them, I noticed that the RTL expanded by the x86 backend interacts poorly with register allocation leading to suboptimal code. For the testcase, typedef int __attribute ((mode(TI))) ti_t; long foo(long x) { return ((ti_t)x * 19065) >> 64; } we'd like to avoid: foo: movq %rdi, %rax movl $19065, %edx imulq %rdx movq %rdx, %rax ret and would prefer: foo: movl $19065, %eax imulq %rdi movq %rdx, %rax ret This patch provides a pair of peephole2 transformations to tweak the spills generated by reload, and at the same time replaces the current define_expand with a define_insn pattern using the new [su]mul_highpart RTX codes. 2021-12-20 Roger Sayle <roger@nextmovesoftware.com> Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog * config/i386/i386.md (any_mul_highpart): New code iterator. (sgnprefix, s): Add attribute support for [su]mul_highpart. (<s>mul<mode>3_highpart): Delete expander. (<s>mul<mode>3_highpart, <s>mulsi32_highpart_zext): New define_insn patterns. (define_peephole2): Tweak the register allocation for the above instructions after reload. gcc/testsuite/ChangeLog * gcc.target/i386/smuldi3_highpart.c: New test case.
-
Joel Sherrill authored
2021-12-20 Joel Sherrill <joel@rtems.org> gcc/ * config.gcc: Obsolete m32c-*-rtems* target.
-
Patrick Palka authored
This patch makes us remember the function selected by overload resolution during ahead of time processing of a non-dependent call expression, so that at instantiation time we avoid repeating some of the work of overload resolution for the call. Note that we already do this for non-dependent operator expressions via build_min_non_dep_op_overload. Some caveats: * When processing ahead of time a non-dependent call to a member function template of a currently open class template (as in g++.dg/template/deduce4.C), we end up generating an "inside-out" partial instantiation such as S<T>::foo<int, int>(), the likes of which we're apparently not prepared to fully instantiate. So in this situation, we instead prune to the selected template instead of the specialization in this situation. * This change triggered a latent FUNCTION_DECL pretty printing issue in cpp0x/error2.C -- since we now resolve the call to foo<0> ahead of time, the error now looks like: error: expansion pattern ‘foo()()=0’ contains no parameter pack where the FUNCTION_DECL for foo<0> is clearly misprinted. But this pretty-printing issue could be reproduced without this patch if we define foo as a non-template function. Since this testcase was added to verify pretty printing of TEMPLATE_ID_EXPR, I work around this test failure by making the call to foo type-dependent and thus immune to this ahead of time pruning. * We now reject parts of cpp0x/fntmp-equiv1.C because we notice that the non-dependent call d(f, b) in int d(int, int); template <unsigned long f, unsigned b, typename> e<d(f, b)> d(); is non-constexpr. Since this testcase is about equivalency of dependent names in the context of declaration matching, it seems the best fix here is to make the calls to d, d2 and d3 within the function signatures dependent. gcc/cp/ChangeLog: * call.c (build_new_method_call): For a non-dependent call expression inside a template, returning a templated tree whose overload set contains just the selected function. * semantics.c (finish_call_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/error2.C: Make the call to foo type-dependent in order to avoid latent pretty-printing issue for FUNCTION_DECL inside MODOP_EXPR. * g++.dg/cpp0x/fntmp-equiv1.C: Make the calls to d, d2 and d3 within the function signatures dependent. * g++.dg/template/non-dependent16.C: New test. * g++.dg/template/non-dependent16a.C: New test. * g++.dg/template/non-dependent17.C: New test.
-
Martin Liska authored
gcc/jit/libgccjit.c:3957:8: warning: type 'struct version_info' violates the C++ One Definition Rule [-Wodr] ../../gcc/jit/libgccjit.c:3957:8: warning: type 'struct version_info' violates the C++ One Definition Rule [-Wodr] 3957 | struct version_info ../../gcc/tree-ssa-loop-ivopts.c:181: note: a different type is defined in another translation unit 181 | struct version_info gcc/jit/ChangeLog: * libgccjit.c (struct version_info): Rename to jit_version_info. (struct jit_version_info): Likewise. (gcc_jit_version_major): Likewise. (gcc_jit_version_minor): Likewise. (gcc_jit_version_patchlevel): Likewise.
-
Martin Liska authored
gcc/ChangeLog: * opts.c (default_options_optimization): Support -Oz in -Ox option hints.
-
Jan Hubicka authored
In the testcase we fail to analyze SSA name because flag do_dataflow is set and thus triggers early exist in analyze_ssa_name. Fixed by disabling early exits when handling deferred names. gcc/ChangeLog: 2021-12-20 Jan Hubicka <hubicka@ucw.cz> PR ipa/103669 * ipa-modref.c (modref_eaf_analysis::analyze_ssa_name): Add deferred parameter. (modref_eaf_analysis::propagate): Use it. gcc/testsuite/ChangeLog: 2021-12-20 Jan Hubicka <hubicka@ucw.cz> PR ipa/103669 * g++.dg/torture/pr103669.C: New test.
-
liuhongt authored
gcc/ChangeLog: PR target/98468 * config/i386/sse.md (*bit_and_float_vector_all_ones): New pre-reload splitter. gcc/testsuite/ChangeLog: * gcc.target/i386/pr98468.c: New test.
-
GCC Administrator authored
-
- Dec 19, 2021
-
-
Francois-Xavier Coudert authored
This enables IEEE support on the upcoming aarch64-apple-darwin target, and has been tested for some time in an external port. libgfortran/ChangeLog: * configure.host: Add aarch64-apple-darwin support. * config/fpu-aarch64.h: New file.
-
Andrew Pinski authored
With the recent PHI-OPT patch for line numbers, I had missed this testcase was now failing. The uninitialized warning was there before my recent patch, just was on the wrong line. The testcase had added an xfail in r12-4698-gf6d012338 (though a bug report was not filed to record it). This patch changes the dg-bogus messages around to catch both locations and xfail both of them. At least there is now a patch for the correct line numbers for the phi-opt. Committed after testing the testcase. gcc/testsuite/ChangeLog: * gcc.dg/uninit-pr89230-1.c: Change the dg-bogus messages around and xfail both of them.
-
Jan Hubicka authored
When adding support for static chain and return slot flags I forgot to update early exit condition in modref_merge_call_site_flags. This yields to wrong code as demonstrated by the Fortran testcase attached to PR (which I hope someone will help me to turn into testuite one). gcc/ChangeLog: 2021-12-19 Jan Hubicka <hubicka@ucw.cz> PR ipa/103766 * ipa-modref.c (modref_merge_call_site_flags): Fix early exit condition
-
Matthias Kretz authored
Code like void swap() { namespace __variant = __detail::__variant; ... } create a NAMESPACE_DECL where the CP_DECL_CONTEXT is a FUNCTION_DECL. DECL_TEMPLATE_INFO fails on NAMESPACE_DECL and therefore must be handled first in the assertion. Signed-off-by:
Matthias Kretz <m.kretz@gsi.de> gcc/cp/ChangeLog: * module.cc (trees_out::get_merge_kind): NAMESPACE_DECLs also cannot have a DECL_TEMPLATE_INFO.
-
Patrick Palka authored
The r12-5403 fix apparently doesn't handle the case where the inner lambda explicitly rather than implicitly captures the capture proxy from the outer lambda, which causes us to reject the first example in the testcase below. This is because compared to an implicit capture, the effective initializer for an explicit capture is wrapped in a location wrapper (pointing to within the capture list), and this wrapper foils the is_capture_proxy check added in r12-5403. The simplest fix appears to be to strip location wrappers accordingly before checking is_capture_proxy. And to help prevent against this kind of bug, this patch also makes is_capture_proxy assert it doesn't see a location wrapper. PR c++/94376 gcc/cp/ChangeLog: * lambda.c (lambda_capture_field_type): Strip location wrappers before checking for a capture proxy. (is_capture_proxy): Assert that we don't see a location wrapper. (mark_const_cap_r): Don't call is_constant_capture_proxy on a location wrapper. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-nested9a.C: New test.
-
Patrick Palka authored
gcc/ChangeLog: * print-tree.c (print_node) <case tcc_declaration>: Dump DECL_LANG_FLAG_8.
-
Patrick Palka authored
Here during constraint checking for the inner call to A<0>::f<0>, substitution into the PARM_DECL d in the atomic constraint yields the wrong local specialization because local_specializations at this point is nonempty, and contains specializations for the caller A<0>::f<1>. This patch makes us call push_to_top_level during satisfaction, which'll temporarily clear local_specializations for us. PR c++/103714 gcc/cp/ChangeLog: * constraint.cc (satisfy_declaration_constraints): Do push_to_top_level and pop_from_top_level around the call to satisfy_normalized_constraints. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-uneval5.C: New test.
-
Francois-Xavier Coudert authored
gcc/testsuite/ChangeLog: * gcc.dg/pr100509.c: Needs alias. * gcc.dg/pragma-diag-10.c: Needs alias.
-
Andrew Pinski authored
Before match-and-simplify was used in phiot, the location of the new stamtents were all of that of the conditional, this adds that back as I did not realize gimple_simplify didn't do that for you. OK? Bootstrapped and tested on x86_64 with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.c (gimple_simplify_phiopt): Annotate the new sequence with the location of the conditional statement.
-
GCC Administrator authored
-
- Dec 18, 2021
-
-
Harald Anlauf authored
gcc/fortran/ChangeLog: PR fortran/103412 * check.c (gfc_check_sizeof): Reject BOZ type argument. gcc/testsuite/ChangeLog: PR fortran/103412 * gfortran.dg/illegal_boz_arg_2.f90: New test.
-
Roger Sayle authored
A common idiom is to create a DImode value from the "concat" of two SImode values, using "(long long)hi << 32 | (long long)lo", where the operation may be ior, xor or plus. On x86, with -m32, the high and low parts of a DImode register are actually different SImode registers (typically %edx and %eax) so ideally this idiom should reduce to two move instructions (or optimally, just clever register allocation). Unfortunately, GCC currently performs the IOR operation above on -m32, and worse allocates DImode registers (split to SImode register pairs) for both the zero extended HI and LO values. Hence, for test1 from the new test case below: typedef int __v4si __attribute__ ((__vector_size__ (16))); long long test1(__v4si v) { unsigned int loVal = (unsigned int)v[0]; unsigned int hiVal = (unsigned int)v[1]; return (long long)(loVal) | ((long long)(hiVal) << 32); } we currently generate (with -m32 -O2 -msse4.1): test1: subl $28, %esp pextrd $1, %xmm0, %eax pmovzxdq %xmm0, %xmm1 movq %xmm1, 8(%esp) movl %eax, %edx movl 8(%esp), %eax orl 12(%esp), %edx addl $28, %esp orb $0, %ah ret with this patch we now generate: test1: pextrd $1, %xmm0, %edx movd %xmm0, %eax ret The fix is to recognize and split the idiom (hi<<32)|zext(lo) prior to register allocation on !TARGET_64BIT, simplifying this sequence to "highpart(dst) = hi; lowpart(dst) = lo". The one minor complication is that sse.md's define_insn for *vec_extractv4si_0_zext_sse4 can sometimes interfere with this optimization. It turns out that on !TARGET_64BIT, the zero_extend:DI following vec_select:SI isn't free, and this insn gets split back into multiple instructions during later passes, but too late to be optimized away by this patch/reload. Hence the last hunk of this patch is to restrict *vec_extractv4si_0_zext_sse4 to TARGET_64BIT. Checking PR target/80286, where *vec_extractv4si_0_zext_sse4 was first added, this seems reasonable. 2021-12-18 Roger Sayle <roger@nextmovesoftware.com> Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog PR target/103611 * config/i386/i386.md (any_or_plus): New code iterator. (define_split): Split (HI<<32)|zext(LO) into piece-wise move instructions on !TARGET_64BIT. * config/i386/sse.md (*vec_extractv4si_0_zext_sse4): Restrict to TARGET_64BIT. gcc/testsuite/ChangeLog PR target/103611 * gcc.target/i386/pr103611-2.c: New test case.
-
Roger Sayle authored
This patch adds support for an -Oz command line option, aggressively optimizing for size at the expense of performance. GCC's current -Os provides a reasonable balance of size and performance, whereas -Oz is probably only useful for code size benchmarks such as CSiBE. Or so I thought until I read in https://news.ycombinator.com/item?id=25408853 that clang's -Oz sometimes outperforms -O[23s]; I suspect modern instruction decode stages can treat "pushq $1; popq %rax" as a short uop encoding. Instead of introducing a new global variable, this patch simply abuses the existing optimize_size by setting its value to 2. The only change in behaviour is the tweak to the i386 backend implementing the suggestion in PR target/32803 to use a short push/pop sequence for loading small immediate values (-128..127) on x86, matching the behaviour of LLVM. On x86_64, the simple function: int foo() { return 25; } currently generates with -Os: foo: movl $25, %eax // 5 bytes ret With the proposed -Oz, it generates: foo: pushq $25 // 2 bytes popq %rax // 1 byte ret On CSiBE, this results in a 0.94% improvement (3703513 bytes total down to 3668516 bytes). 2021-12-18 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/32803 * common.opt (Oz): New command line option. * doc/invoke.texi: Document the new -Oz option. * lto-wrapper.c (merge_and_complain, append_compiler_options): Treat OPT_Oz as synonymous with OPT_Os. * optc-save-gen.awk: Increase maximum value of optimize_size to 2. * opts.c (default_options_optimization) [OPT_Oz]: Handle OPT_Oz just like OPT_Os, except set opt->x_optimize_size to 2. (common_handle_option): Skip OPT_Oz just like OPT_Os. * config/i386/i386.md (*movdi_internal): Use a push/pop sequence for suitable SImode TYPE_IMOV moves when optimize_size > 1. (*movsi_internal): Likewise. gcc/testsuite/ChangeLog PR target/32803 * gcc.target/i386/pr32803.c: New test case.
-
Siddhesh Poyarekar authored
Since all computations in tree-object-size are now done in sizetype and not HOST_WIDE_INT, comparisons with HOST_WIDE_INT based unknown and initval would be incorrect. Instead, use the sizetype trees directly to generate and evaluate initval and unknown size values. gcc/ChangeLog: PR tree-optimization/103759 * tree-object-size.c (unknown, initval): Remove functions. (size_unknown, size_initval, size_unknown_p): Operate directly on trees. Signed-off-by:
Siddhesh Poyarekar <siddhesh@gotplt.org>
-
François-Xavier Coudert authored
Functions from <ctype.h> should only be called on values that can be represented by unsigned char. On targets where char is a signed type, some of libgfortran calls have undefined behaviour. The solution is to cast the argument to unsigned char type. I’ve defined macros in libgfortran.h to do so, to retain legibility of the library code. PR libfortran/95177 libgfortran/ChangeLog * libgfortran.h: include ctype.h, provide safe macros. * io/format.c: use safe macros. * io/list_read.c: use safe macros. * io/read.c: use safe macros. * io/write.c: use safe macros. * runtime/environ.c: use safe macros.
-
François-Xavier Coudert authored
The current GCC branch will become 12.1.0, which will be the stable version of GCC when the next macOS version is released. There are some places in GCC that don’t handle darwin22 as a version, so we need to future-proof it (gcc/config.gcc and gcc/config/darwin-driver.c). We align that code with what Apple clang does, i.e. accept all potential major macOS versions until 99. This patch also homogenises the handling of darwin version numbers, where the majority of places use darwin2*, but some used darwin2[0-9]*. Since there never was a darwin2.x version, the two are equivalent, and we prefer the simpler darwin2* gcc/ChangeLog: * config/darwin-driver.c: Make version code more future-proof. * config.gcc: Homogeneize darwin versions. * configure.ac: Homogeneize darwin versions. * configure: Regenerate. gcc/testsuite/ChangeLog: * gcc.dg/darwin-minversion-link.c: Test darwin21. * obj-c++.dg/cxx-ivars-3.mm: Homogeneize darwin versions. * obj-c++.dg/objc-gc-3.mm: Homogeneize darwin versions. * objc.dg/objc-gc-4.m: Homogeneize darwin versions.
-
GCC Administrator authored
-
- Dec 17, 2021
-
-
Marek Polacek authored
My patch to implement -Wno-attribute=A::b caused a bogus error when parsing [[foo::bar(1, 2)]]; when -Wno-attributes=foo::bar was specified on the command line, because when we create a fake foo::bar attribute and insert it into our attribute table, it is created with max_length == 0 which doesn't allow any args. That is wrong -- we know nothing about the attribute, so we shouldn't require any specific number of arguments. And since unknown attributes can be rather complex (see for example omp::{directive,sequence}), we must skip parsing their arguments. To that end, I'm using max_length with value -2. Also let's not warn about things like [[vendor::assume(true)]]; because they may have some meaning (this is reminiscent of C++ Portable Assumptions). PR c/103649 gcc/ChangeLog: * attribs.c (handle_ignored_attributes_option): Create the fake attribute with max_length == -2. (attribute_ignored_p): New overloads. * attribs.h (attribute_ignored_p): Declare them. * tree-core.h (struct attribute_spec): Document that max_length can be -2. gcc/c/ChangeLog: * c-decl.c (c_warn_unused_attributes): Don't warn for attribute_ignored_p. * c-parser.c (c_parser_std_attribute): Skip parsing of the attribute arguments when the attribute is ignored. gcc/cp/ChangeLog: * parser.c (cp_parser_declaration): Don't warn for attribute_ignored_p. (cp_parser_std_attribute): Skip parsing of the attribute arguments when the attribute is ignored. gcc/testsuite/ChangeLog: * c-c++-common/Wno-attributes-6.c: New test.
-
David Edelsohn authored
gcc/testsuite/ChangeLog: * gcc.target/powerpc/fold-vec-insert-float-p9.c
-
Olivier Hainque authored
To match the tests expectations for toolchains configured to default to not so capable cpus. 2021-12-17 Olivier Hainque <hainque@adacore.com> gcc/testsuite/ * gcc.target/powerpc/pr97142.c: Add -mdejagnu-cpu=power7 to the dg-options.
-
Marek Polacek authored
For code like template<typename> struct bar; struct bar { int baz; }; bar var; we emit a fairly misleading and unwieldy diagnostic: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ g++ -c u.cc u.cc:6:8: error: template argument required for 'struct bar' 6 | struct bar { | ^~~ u.cc:10:5: error: class template argument deduction failed: 10 | bar var; | ^~~ u.cc:10:5: error: no matching function for call to 'bar()' u.cc:3:17: note: candidate: 'template<class> bar()-> bar< <template-parameter-1-1> >' 3 | friend struct bar; | ^~~ u.cc:3:17: note: template argument deduction/substitution failed: u.cc:10:5: note: couldn't deduce template parameter '<template-parameter-1-1>' 10 | bar var; | ^~~ u.cc:3:17: note: candidate: 'template<class> bar(bar< <template-parameter-1-1> >)-> bar< <template-parameter-1-1> >' 3 | friend struct bar; | ^~~ u.cc:3:17: note: template argument deduction/substitution failed: u.cc:10:5: note: candidate expects 1 argument, 0 provided 10 | bar var; | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ but with this patch we get: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ z.C:4:10: error: class template 'bar' redeclared as non-template 4 | struct bar { | ^~~ z.C:2:10: note: previous declaration here 2 | struct bar; | ^~~ z.C:8:7: error: 'bar<...auto...> var' has incomplete type 8 | bar var; | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ which is clearer about what the problem is. I thought it'd be nice to avoid printing the messages about failed CTAD, too. To that end, I'm using CLASSTYPE_ERRONEOUS to suppress CTAD. Not sure if that's entirely kosher. The other direction (first a non-template class declaration followed by a class template definition) we handle quite well: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ z.C:11:8: error: 'bar' is not a template 11 | struct bar {}; | ^~~ z.C:8:8: note: previous declaration here 8 | struct bar; | ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PR c++/103749 gcc/cp/ChangeLog: * decl.c (lookup_and_check_tag): Give an error when a class was declared as template but no template header has been provided. * pt.c (do_class_deduction): Don't deduce CLASSTYPE_ERRONEOUS types. gcc/testsuite/ChangeLog: * g++.dg/template/redecl4.C: Adjust dg-error. * g++.dg/diagnostic/redeclaration-2.C: New test.
-