[SH][committed] Fix build after changes for PR 52171
Hi, The recent changes for PR 52171 didn't update the users of the renamed function 'move_by_pieces_ninsns'. The attached patch fixes this. Tested with "make all". Committed as r237090. Cheers, Oleg gcc/ChangeLog: PR tree-optimization/52171 * config/sh/sh.c (sh_use_by_pieces_infrastructure_p): Use by_pieces_ninsns instead of move_by_pieces_ninsns.Index: gcc/config/sh/sh.c === --- gcc/config/sh/sh.c (revision 237089) +++ gcc/config/sh/sh.c (working copy) @@ -12506,11 +12506,11 @@ switch (op) { case MOVE_BY_PIECES: - return move_by_pieces_ninsns (size, align, MOVE_MAX_PIECES + 1) + return by_pieces_ninsns (size, align, MOVE_MAX_PIECES + 1, op) < (!speed_p ? 2 : (align >= 32) ? 16 : 2); case STORE_BY_PIECES: case SET_BY_PIECES: - return move_by_pieces_ninsns (size, align, STORE_MAX_PIECES + 1) + return by_pieces_ninsns (size, align, STORE_MAX_PIECES + 1, op) < (!speed_p ? 2 : (align >= 32) ? 16 : 2); default: return default_use_by_pieces_infrastructure_p (size, align,
Re: [PATCH v2] gcov: Runtime configurable destination output
> It breaks profiledbootstrap: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71400 I am including a patch that should fix the issues introduced by my patch. I have confirmed behavior on my system, and built with profiledbootstrap as well as bootstrap. libgcc/ChangeLog: 2016-06-04 Aaron Conole * libgcov-driver-system.c (gcov_error): Remove redundant assignment. (get_gcov_error_file): Invert the IN_GCOV_TOOL test (__gcov_error_file): Only use this when !IN_GCOV_TOOL --- libgcc/libgcov-driver-system.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c index ff8a521..6bfe6ba 100644 --- a/libgcc/libgcov-driver-system.c +++ b/libgcc/libgcov-driver-system.c @@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see it will either be stderr, or a file of the user's choosing. Non-static to prevent multiple gcov-aware shared objects from instantiating their own copies. */ +#if !IN_GCOV_TOOL FILE *__gcov_error_file = NULL; +#endif /* A utility function to populate the __gcov_error_file pointer. This should NOT be called outside of the gcov system driver code. */ @@ -35,7 +37,7 @@ FILE *__gcov_error_file = NULL; static FILE * get_gcov_error_file(void) { -#if !IN_GCOV_TOOL +#if IN_GCOV_TOOL return stderr; #else char *gcov_error_filename = getenv ("GCOV_ERROR_FILE"); @@ -60,11 +62,8 @@ gcov_error (const char *fmt, ...) int ret; va_list argp; - if (!__gcov_error_file) -__gcov_error_file = get_gcov_error_file (); - va_start (argp, fmt); - ret = vfprintf (__gcov_error_file, fmt, argp); + ret = vfprintf (get_gcov_error_file (), fmt, argp); va_end (argp); return ret; } -- 2.5.5
Re: [PATCH v2] gcc/config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount
On 6/3/16 09:21, Richard Henderson wrote: > On 06/02/2016 03:23 PM, cheng...@emindsoft.com.cn wrote: >>fprintf (file, >> + "\t{\n" >> + "\taddi\tsp, sp, -8\n" >> + "\tst\tsp, r10\n" >> + "\t}\n" >> "\t{\n" > > You need only do this if cfun->static_chain_decl is set. > OK, thanks, I shall send patch v3 for it, within this week end. Thanks. -- Chen Gang (陈刚) Managing Natural Environments is the Duty of Human Beings.
[PATCH v3] gcc/config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount
From: Chen Gang r10 may also be as parameter stack pointer for the nested function, so need save it before call mcount. Also clean up code: use '!' instead of "== 0" for checking static_chain_decl and compute_total_frame_size. 2016-06-04 Chen Gang gcc/ PR target/71331 * config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount. (tilegx_can_use_return_insn_p): Clean up code. --- gcc/config/tilegx/tilegx.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 06c832c..55161bb 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -3880,8 +3880,8 @@ bool tilegx_can_use_return_insn_p (void) { return (reload_completed - && cfun->static_chain_decl == 0 - && compute_total_frame_size () == 0 + && !cfun->static_chain_decl + && !compute_total_frame_size () && tilegx_current_function_is_leaf () && !crtl->profile && !df_regs_ever_live_p (TILEGX_LINK_REGNUM)); } @@ -5507,6 +5507,15 @@ tilegx_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) fprintf (file, "\t}\n"); } + if (cfun->static_chain_decl) +{ + fprintf (file, + "\t{\n" + "\taddi\tsp, sp, -8\n" + "\tst\tsp, r10\n" + "\t}\n"); +} + if (flag_pic) { fprintf (file, @@ -5524,6 +5533,13 @@ tilegx_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) "\t}\n", MCOUNT_NAME); } + if (cfun->static_chain_decl) +{ + fprintf (file, + "\taddi\tsp, sp, 8\n" + "\tld\tr10, sp\n"); +} + tilegx_in_bundle = false; } -- 1.9.3
[PATCH] Fix ICE with gimple clobber (PR tree-optimization/71405)
Hi! On this testcase execute_update_addresses_taken creates VIEW_CONVERT_EXPR of a {CLOBBER}, which is of course invalid. Instead, this patch just creates {CLOBBER} of the right type and let's the following ssa update transform that to replacing uses with default def or whatever else is appropriate. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-06-04 Jakub Jelinek PR tree-optimization/71405 * tree-ssa.c (execute_update_addresses_taken): For clobber with incompatible type, build a new clobber with the right type instead of building a VIEW_CONVERT_EXPR around it. * g++.dg/torture/pr71405.C: New test. --- gcc/tree-ssa.c.jj 2016-05-24 10:56:01.0 +0200 +++ gcc/tree-ssa.c 2016-06-04 11:59:36.561302230 +0200 @@ -1622,9 +1622,16 @@ execute_update_addresses_taken (void) if (gimple_assign_lhs (stmt) != lhs && !useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) - rhs = fold_build1 (VIEW_CONVERT_EXPR, -TREE_TYPE (lhs), rhs); - + { + if (gimple_clobber_p (stmt)) + { + rhs = build_constructor (TREE_TYPE (lhs), NULL); + TREE_THIS_VOLATILE (rhs) = 1; + } + else + rhs = fold_build1 (VIEW_CONVERT_EXPR, +TREE_TYPE (lhs), rhs); + } if (gimple_assign_lhs (stmt) != lhs) gimple_assign_set_lhs (stmt, lhs); --- gcc/testsuite/g++.dg/torture/pr71405.C.jj 2016-06-04 12:10:33.694768153 +0200 +++ gcc/testsuite/g++.dg/torture/pr71405.C 2016-06-04 12:09:28.0 +0200 @@ -0,0 +1,22 @@ +// PR tree-optimization/71405 +// { dg-do compile } + +struct C +{ + C () {} + int i; +}; + +void * +operator new (__SIZE_TYPE__ x, void *y) +{ + return y; +} + +int +main () +{ + int a; + new (&a) C; + return a; +} Jakub
Re: [Patch, avr] Fix PR 71151
Senthil Kumar Selvaraj schrieb: Hi, This patch fixes PR 71151 by eliminating the TARGET_ASM_FUNCTION_RODATA_SECTION hook and setting JUMP_TABLES_IN_TEXT_SECTION to 1. As described in the bugzilla entry, this hook assumed it will get called only for jumptable rodata for functions. This was true until 6.1, when a commit in varasm.c started calling the hook for mergeable string/constant data as well. This resulted in string constants ending up in a section intended for jumptables (flash), and broke code using those constants, which expects them to be present in rodata (SRAM). Given that the original reason for placing jumptables in a section was fixed by Johann in PR 63323, this patch restores the original behavior. Reg testing on both gcc-6-branch and trunk showed no regressions. As pointed out by Johann, this may end up increasing code size if there are lots of branches that cross the jump tables. I intend to propose a separate patch that gives additional information to the target hook (SECCAT_RODATA_{STRING,JUMPTABLE}) so it can know what type of function rodata is coming on. Johann also suggested handling jump table generation ourselves - I'll experiment with that some more. If ok, could someone commit please? Could you also backport to gcc-6-branch? Regards Senthil gcc/ChangeLog 2016-06-03 Senthil Kumar Selvaraj * config/avr/avr.c (avr_asm_function_rodata_section): Remove. * config/avr/avr.c (TARGET_ASM_FUNCTION_RODATA_SECTION): Remove. gcc/testsuite/ChangeLog 2016-06-03 Senthil Kumar Selvaraj * gcc/testsuite/gcc.target/avr/pr71151-1.c: New. * gcc/testsuite/gcc.target/avr/pr71151-2.c: New. diff --git gcc/config/avr/avr.c gcc/config/avr/avr.c index ba5cd91..3cb8cb7 100644 --- gcc/config/avr/avr.c +++ gcc/config/avr/avr.c @@ -9488,65 +9488,6 @@ avr_asm_init_sections (void) } -/* Implement `TARGET_ASM_FUNCTION_RODATA_SECTION'. */ - -static section* -avr_asm_function_rodata_section (tree decl) -{ - /* If a function is unused and optimized out by -ffunction-sections - and --gc-sections, ensure that the same will happen for its jump - tables by putting them into individual sections. */ - - unsigned int flags; - section * frodata; - - /* Get the frodata section from the default function in varasm.c - but treat function-associated data-like jump tables as code - rather than as user defined data. AVR has no constant pools. */ - { -int fdata = flag_data_sections; - -flag_data_sections = flag_function_sections; -frodata = default_function_rodata_section (decl); -flag_data_sections = fdata; -flags = frodata->common.flags; - } - - if (frodata != readonly_data_section - && flags & SECTION_NAMED) -{ - /* Adjust section flags and replace section name prefix. */ - - unsigned int i; - - static const char* const prefix[] = -{ - ".rodata", ".progmem.gcc_sw_table", - ".gnu.linkonce.r.", ".gnu.linkonce.t." -}; - - for (i = 0; i < sizeof (prefix) / sizeof (*prefix); i += 2) -{ - const char * old_prefix = prefix[i]; - const char * new_prefix = prefix[i+1]; - const char * name = frodata->named.name; - - if (STR_PREFIX_P (name, old_prefix)) -{ - const char *rname = ACONCAT ((new_prefix, -name + strlen (old_prefix), NULL)); - flags &= ~SECTION_CODE; - flags |= AVR_HAVE_JMP_CALL ? 0 : SECTION_CODE; - - return get_section (rname, flags, frodata->named.decl); -} -} -} - - return progmem_swtable_section; The progmem_swtable_section is no more needed; the code to set it up can also be removed. Johann -} - - /* Implement `TARGET_ASM_NAMED_SECTION'. */ /* Track need of __do_clear_bss, __do_copy_data for named sections. */ @@ -13747,9 +13688,6 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, #undef TARGET_FOLD_BUILTIN #define TARGET_FOLD_BUILTIN avr_fold_builtin -#undef TARGET_ASM_FUNCTION_RODATA_SECTION -#define TARGET_ASM_FUNCTION_RODATA_SECTION avr_asm_function_rodata_section - #undef TARGET_SCALAR_MODE_SUPPORTED_P #define TARGET_SCALAR_MODE_SUPPORTED_P avr_scalar_mode_supported_p diff --git gcc/config/avr/avr.h gcc/config/avr/avr.h index 01da708..ab5e465 100644 --- gcc/config/avr/avr.h +++ gcc/config/avr/avr.h @@ -391,7 +391,7 @@ typedef struct avr_args #define SUPPORTS_INIT_PRIORITY 0 -#define JUMP_TABLES_IN_TEXT_SECTION 0 +#define JUMP_TABLES_IN_TEXT_SECTION 1 #define ASM_COMMENT_START " ; " diff --git gcc/testsuite/gcc.target/avr/pr71151-1.c gcc/testsuite/gcc.target/avr/pr71151-1.c new file mode 100644 index 000..615dce8 --- /dev/null +++ gcc/testsuite/gcc.target/avr/pr71151-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -ffunction-sections -fdata-sec
Re: [PATCH] Fix ICE with gimple clobber (PR tree-optimization/71405)
On June 4, 2016 3:36:13 PM GMT+02:00, Jakub Jelinek wrote: >Hi! > >On this testcase execute_update_addresses_taken creates >VIEW_CONVERT_EXPR of a {CLOBBER}, which is of course invalid. >Instead, this patch just creates {CLOBBER} of the right type and let's >the following ssa update transform that to replacing uses with default >def >or whatever else is appropriate. > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. Thanks, Richard. >2016-06-04 Jakub Jelinek > > PR tree-optimization/71405 > * tree-ssa.c (execute_update_addresses_taken): For clobber with > incompatible type, build a new clobber with the right type instead > of building a VIEW_CONVERT_EXPR around it. > > * g++.dg/torture/pr71405.C: New test. > >--- gcc/tree-ssa.c.jj 2016-05-24 10:56:01.0 +0200 >+++ gcc/tree-ssa.c 2016-06-04 11:59:36.561302230 +0200 >@@ -1622,9 +1622,16 @@ execute_update_addresses_taken (void) > if (gimple_assign_lhs (stmt) != lhs > && !useless_type_conversion_p (TREE_TYPE (lhs), > TREE_TYPE (rhs))) >-rhs = fold_build1 (VIEW_CONVERT_EXPR, >- TREE_TYPE (lhs), rhs); >- >+{ >+ if (gimple_clobber_p (stmt)) >+{ >+ rhs = build_constructor (TREE_TYPE (lhs), NULL); >+ TREE_THIS_VOLATILE (rhs) = 1; >+} >+ else >+rhs = fold_build1 (VIEW_CONVERT_EXPR, >+ TREE_TYPE (lhs), rhs); >+} > if (gimple_assign_lhs (stmt) != lhs) > gimple_assign_set_lhs (stmt, lhs); > >--- gcc/testsuite/g++.dg/torture/pr71405.C.jj 2016-06-04 >12:10:33.694768153 +0200 >+++ gcc/testsuite/g++.dg/torture/pr71405.C 2016-06-04 >12:09:28.0 +0200 >@@ -0,0 +1,22 @@ >+// PR tree-optimization/71405 >+// { dg-do compile } >+ >+struct C >+{ >+ C () {} >+ int i; >+}; >+ >+void * >+operator new (__SIZE_TYPE__ x, void *y) >+{ >+ return y; >+} >+ >+int >+main () >+{ >+ int a; >+ new (&a) C; >+ return a; >+} > > Jakub
Dump decisions of ch pass
Hi, I was working on some issues with CH pass and found it bit hard given that the pass does not dump its decisions at all. This patch adds usual dumping. Bootstrapped/regtested x86_64-linux, comitted. Honza * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Do not check aux; dump reasons of decisions. (should_duplicate_loop_header_p): Likewise. (do_while_loop_p): Likewise. (ch_base::copy_headers): Dump asi num insns duplicated. Index: tree-ssa-loop-ch.c === --- tree-ssa-loop-ch.c (revision 237091) +++ tree-ssa-loop-ch.c (working copy) @@ -50,33 +50,61 @@ should_duplicate_loop_header_p (basic_bl gimple_stmt_iterator bsi; gimple *last; - /* Do not copy one block more than once (we do not really want to do - loop peeling here). */ - if (header->aux) -return false; + gcc_assert (!header->aux); /* Loop header copying usually increases size of the code. This used not to be true, since quite often it is possible to verify that the condition is satisfied in the first iteration and therefore to eliminate it. Jump threading handles these cases now. */ if (optimize_loop_for_size_p (loop)) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: optimizing for size.\n", +header->index); + return false; +} gcc_assert (EDGE_COUNT (header->succs) > 0); if (single_succ_p (header)) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: it is single succ.\n", +header->index); + return false; +} + if (flow_bb_inside_loop_p (loop, EDGE_SUCC (header, 0)->dest) && flow_bb_inside_loop_p (loop, EDGE_SUCC (header, 1)->dest)) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: both sucessors are in loop.\n", +loop->num); + return false; +} /* If this is not the original loop header, we want it to have just one predecessor in order to match the && pattern. */ if (header != loop->header && !single_pred_p (header)) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: it has mutiple predecestors.\n", +header->index); + return false; +} last = last_stmt (header); if (gimple_code (last) != GIMPLE_COND) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: it does not end by conditional.\n", +header->index); + return false; +} /* Approximately copy the conditions that used to be used in jump.c -- at most 20 insns and no calls. */ @@ -91,13 +119,26 @@ should_duplicate_loop_header_p (basic_bl continue; if (is_gimple_call (last)) - return false; + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i: it contains call.\n", +header->index); + return false; + } *limit -= estimate_num_insns (last, &eni_size_weights); if (*limit < 0) - return false; + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +" Not duplicating bb %i contains too many insns.\n", +header->index); + return false; + } } - + if (dump_file && (dump_flags & TDF_DETAILS)) +fprintf (dump_file, "Will duplicate bb %i\n", header->index); return true; } @@ -111,13 +152,27 @@ do_while_loop_p (struct loop *loop) /* If the latch of the loop is not empty, it is not a do-while loop. */ if (stmt && gimple_code (stmt) != GIMPLE_LABEL) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +"Loop %i is not do-while loop: latch is not empty.\n", +loop->num); + return false; +} /* If the header contains just a condition, it is not a do-while loop. */ stmt = last_and_only_stmt (loop->header); if (stmt && gimple_code (stmt) == GIMPLE_COND) -return false; +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, +"Loop %i is not do-while loop: " +"header contains just condition.\n", loop->num); + return false; +} + if (dump_file && (dump_flags & TDF_DETAILS)) +fprintf (dump_file, "Loop %i is do-while loop\n", loop->num); return true; } @@ -236,6 +291,9 @@ ch_base::copy_headers (function *fun) { /*
Re: [PATCH] Warn about return with a void expression with -Wreturn-type.
On 06/03/2016 04:12 AM, Marcin Baczyński wrote: 2016-06-03 11:36 GMT+02:00 Bernd Schmidt : On 06/02/2016 12:03 PM, Marcin Baczyński wrote: 2016-06-02 4:51 GMT+02:00 Martin Sebor : As a disclaimer, someone else endowed with those special powers will need to approve your final patch. If you don't get a timely approval please ping the patch weekly. * doc/invoke.texi (-Wreturn-type): Mention not warning on return with a void expression in a void function. If Martin is happy with this then OK. Thanks! Could someone with repository write access commit the patch, please? I committed it in r237093. Thanks Martin
[PING] [PATCH] c/69507 - bogus warning: ISO C does not allow ‘__alignof__ (expression)’
Ping: https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02216.html On 05/27/2016 11:34 AM, Martin Sebor wrote: The patch below adjusts the C alignof pedantic warning to avoid diagnosing the GCC extension (__alignof__) and only diagnose _Alignof in C99 and prior modes. This is consistent with how __attribute__ ((aligned)) and _Alignas is handled (among other extensions vs standard features). Martin PR c/69507 - bogus warning: ISO C does not allow ‘__alignof__ (expression)’ gcc/testsuite/ChangeLog: 2016-05-27 Martin Sebor PR c/69507 * gcc.dg/alignof.c: New test. gcc/c/ChangeLog: 2016-05-27 Martin Sebor PR c/69507 * c-parser.c (c_parser_alignof_expression): Avoid diagnosing __alignof__ (expression). Index: gcc/c/c-parser.c === --- gcc/c/c-parser.c(revision 232841) +++ gcc/c/c-parser.c(working copy) @@ -7019,9 +7019,10 @@ c_parser_alignof_expression (c_parser *p mark_exp_read (expr.value); c_inhibit_evaluation_warnings--; in_alignof--; - pedwarn (start_loc, - OPT_Wpedantic, "ISO C does not allow %<%E (expression)%>", - alignof_spelling); + if (is_c11_alignof) +pedwarn (start_loc, + OPT_Wpedantic, "ISO C does not allow %<%E (expression)%>", + alignof_spelling); ret.value = c_alignof_expr (start_loc, expr.value); ret.original_code = ERROR_MARK; ret.original_type = NULL; Index: gcc/testsuite/gcc.dg/alignof.c === --- gcc/testsuite/gcc.dg/alignof.c(revision 0) +++ gcc/testsuite/gcc.dg/alignof.c(working copy) @@ -0,0 +1,11 @@ +/* PR c/69507 - bogus warning: ISO C does not allow '__alignof__ (expression)' + */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -Wno-error -Wpedantic" } */ + +extern int e; + +int a[] = { +__alignof__ (e), +_Alignof (e) /* { dg-warning "ISO C does not allow ._Alignof \\(expression\\)." } */ +};