Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)
On Fri, Dec 5, 2014 at 6:15 PM, Eric Botcazou wrote: >> --quote-- >> If we want to use this pass for x86, then for 4.8 we should also fix the >> discrepancy between the compare-elim canonical >> >> [(operate) >>(set-cc)] >> >> and the combine canonical >> >> [(set-cc) >>(operate)] >> >> (Because of the simplicity of the substitution in compare-elim, I prefer >> the former as the canonical canonical.) >> --/quote-- > > I agree with the above. > >> There were some patches flowing around [2], [3] that enhanced >> compare-elim pass for x86 needs, but the target never switched to new >> pass, mostly because compare-elim pass did not catch all cases that >> traditional RTX combine pass did. > > Does [2] really work with the mode mismatch? See the pending patch at > https://gcc.gnu.org/ml/gcc-patches/2014-11/msg03458.html > >> Due to the above, I would like to propose that existing RTX compare >> pass be updated to handle [(operate)(set-cc)] patterns (exclusively?). > > That's already what it does though, did you mean the opposite? Or did you > mean to write "combine" instead of "compare"? The above should read "... that existing RTX *combine* pass be updated ...", thanks for pointing out! Uros.
Re: PATCH: PR target/64200: CE: in decide_alg, at config/i386/i386.c:24510 with -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically fails with -mcmodel=large -fpic
On Fri, Dec 5, 2014 at 9:47 PM, H.J. Lu wrote: > GCC manual says: > > '-minline-stringops-dynamically' > For string operations of unknown size, use run-time checks with > inline code for small blocks and a library call for large blocks. > > we get > > Breakpoint 5, decide_alg (count=0, expected_size=-1, min_size=0, > max_size=2147483647, memset=false, zero_memset=false, > dynamic_check=0x7fffc924, noalign=0x7fffc923) > at /export/gnu/import/git/gcc/gcc/config/i386/i386.c:24510 > 24510 if (TARGET_INLINE_STRINGOPS_DYNAMICALLY) > (gdb) p alg > $1 = libcall > (gdb) > > libcall is a valid choice here for -minline-stringops-dynamically. This > patch avoids assert "alg != libcall" for > TARGET_INLINE_STRINGOPS_DYNAMICALLY. OK for trunk and 4.9 branch? > > 2014-12-05 H.J. Lu > > PR target/64200 > * config/i386/i386.c (decide_alg): Don't assert "alg != libcall" > for TARGET_INLINE_STRINGOPS_DYNAMICALLY. > > gcc/testsuite/ > > 2014-12-05 H.J. Lu > > PR target/64200 > * gcc.target/i386/memcpy-strategy-4.c: New test. Looking at above option description, looks like a thinko in the code. Patch is OK everywhere, but should bake a couple of days in the mainline. Thanks, Uros.
Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)
On Sat, Dec 06, 2014 at 09:28:57AM +0100, Uros Bizjak wrote: > > That's already what it does though, did you mean the opposite? Or did you > > mean to write "combine" instead of "compare"? > > The above should read "... that existing RTX *combine* pass be updated > ...", thanks for pointing out! Which target actually uses the [(operation) (set (cc) ...)] order in their *.md patterns? Even aarch64 and arm use the [(set (cc) ...) (operation)] order that combine expects, I thought compare-elim was written for those targets? If the vast majority of mds use the order that combine expects, I think it should be easier to adjust compare-elim.c and those few targets that diverge. Jakub
Re: Compare-elim pass (was: Re: [PATCH] Fix PR 61225)
On Sat, Dec 06, 2014 at 09:38:43AM +0100, Jakub Jelinek wrote: > On Sat, Dec 06, 2014 at 09:28:57AM +0100, Uros Bizjak wrote: > > > That's already what it does though, did you mean the opposite? Or did you > > > mean to write "combine" instead of "compare"? > > > > The above should read "... that existing RTX *combine* pass be updated > > ...", thanks for pointing out! > > Which target actually uses the [(operation) (set (cc) ...)] order in their > *.md patterns? Even aarch64 and arm use the [(set (cc) ...) (operation)] > order that combine expects, I thought compare-elim was written for those > targets? If the vast majority of mds use the order that combine expects, > I think it should be easier to adjust compare-elim.c and those few targets > that diverge. So, any other md than rx and mn10300 that uses the non-standard order? Jakub
Re: [PATCH x86] Enable v64qi permutations.
On Fri, Dec 5, 2014 at 5:33 PM, Ilya Tocar wrote: > On 04 Dec 15:16, Uros Bizjak wrote: >> On Thu, Dec 4, 2014 at 2:53 PM, Ilya Tocar wrote: >> >> >> >>> >> Can you add a few testcases? >> >> >>> > >> >> >>> > Isn't it already covered by gcc.dg/torture/vshuf* ? >> >> >>> > >> >> >>> >> >> >>> I didn't see them fail on my machines today. >> >> >> >> >> >> Those are executable testcases, those better should not fail. >> >> >> The patch just improved code generation and the testcases test >> >> >> if the improved code generation works well. >> >> >> Did you mean some scan-assembler test that verifies the better code >> >> >> generation? Guess it is possible, though fragile. >> >> > >> >> > I think that existing executable testcases adequately cover the >> >> > functionality of the patch. >> >> > >> >> > The patch is OK. >> >> >> >> BTW, the ChangeLog is missing. >> >> >> > * config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Handle v64qi. >> > (expand_vec_perm_broadcast_1): Ditto. >> > (expand_vec_perm_vpermi2_vpshub2): New. >> > (ix86_expand_vec_perm_const_1): Use it. >> > (ix86_vectorize_vec_perm_const_ok): Handle v64qi. >> > * config/i386/sse.md (VEC_PERM_AVX2): Add v64qi. >> > (VEC_PERM_CONST): Ditto. >> >> index ca5d720..6252e7e 100644 >> >> --- a/gcc/config/i386/sse.md >> >> +++ b/gcc/config/i386/sse.md >> >> @@ -10678,7 +10678,7 @@ >> >> (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2") >> >> (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F") >> >> (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F") >> >> - (V32HI "TARGET_AVX512BW")]) >> >> + (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")]) >> >> >> >> I don't think change for VBMI target belongs in this patch. >> >> >> > Those changes enable non-const v64qi permutes >> > (via single vpermi2b insn), should I split them into separate patch? >> >> If they are not on the same topic, then please yes. Please don't mix >> separate issues together. >> > OK. > Patch bellow adds variable v64qi permutations. > OK for trunk? > > (I plan to commit both of them simultaneously, if this part is approved) > > * config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Handle v64qi. > * config/i386/sse.md (VEC_PERM_AVX2): Add v64qi. OK. Thanks, Uros.
Re: [patch, build] Restore bootstrap in building libcc1 on darwin
Hi Jeff, On 5 Dec 2014, at 22:40, Jeff Law wrote: > On 12/05/14 15:34, Dominique Dhumieres wrote: >>> As I've tried to explain, that is IMHO wrong though. >>> If what you are after is the -B stuff too, then perhaps: >>> ... >> >> Sorry but it does not work: > BTW, thanks for working with Jakub on this. We're going to be getting a > Darwin box for Jakub and other folks in the Red Hat team to use when the need > arises to dig into these kind of issues. That will be most welcome, we Darwin folks have only volunteer cycles to work on stuff, and those tend to get used up really quickly. Iain
Re: [Patch] PR 61692 - Fix for inline asm ICE
Ping? dw On 11/15/2014 7:59 PM, David Wohlferd wrote: On 9/15/2014 2:51 PM, Jeff Law wrote: Let's go with your original inputs + outputs + labels change and punt the clobbers stuff for now. jeff I have also added the test code you requested. I have a release on file with the FSF, but don't have SVN write access. Problem: extract_insn() in recog.c will ICE if (noperands > MAX_RECOG_OPERANDS). Normally this isn't a problem since expand_asm_operands() in cfgexpand.c catches and reports a proper error for this condition. However, expand_asm_operands() only checks (ninputs + noutputs) instead of (ninputs + noutputs + nlabels), so you can get the ICE when using "asm goto." ChangeLog: 2014-11-15 David Wohlferd PR target/61692 * cfgexpand.c (expand_asm_operands): Count all inline asm params. * testsuite/gcc.dg/pr61692.c: New test. dw
Re: [Patch] Improving jump-thread pass for PR 54742
Jeff Law wrote: > OK to commit. Thanks for your patience. > > Can you follow-up with a change which throttles this optimization > when -Os is in effect. You can check optimize_function_for_size_p > (cfun) and simply avoid the backward traversal or you could allow it > in that case if the amount of copying is suitably small. Your call. I think it does not make sense to duplicate paths at -Os: I disabled the FSM jump-threading when optimizing for size like this. diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 29b20c8..ce70311 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -1335,8 +1335,9 @@ thread_through_normal_block (edge e, return 1; } if (!flag_expensive_optimizations + || optimize_function_for_size_p (cfun) || TREE_CODE (cond) != SSA_NAME || e->dest->loop_father != e->src->loop_father || loop_depth (e->dest->loop_father) == 0) return 0; I will regstrap and commit the attached patch. Sebastian >From 1e2efaa2e3121170a938cd479d979b55c37cc4a4 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Fri, 26 Sep 2014 14:54:20 -0500 Subject: [PATCH] extend jump thread for finite state automata PR tree-optimization/54742 * params.def (max-fsm-thread-path-insns, max-fsm-thread-length, max-fsm-thread-paths): New. * doc/invoke.texi (max-fsm-thread-path-insns, max-fsm-thread-length, max-fsm-thread-paths): Documented. * tree-cfg.c (split_edge_bb_loc): Export. * tree-cfg.h (split_edge_bb_loc): Declared extern. * tree-ssa-threadedge.c (simplify_control_stmt_condition): Restore the original value of cond when simplification fails. (fsm_find_thread_path): New. (fsm_find_control_statement_thread_paths): New. (thread_through_normal_block): Call find_control_statement_thread_paths. * tree-ssa-threadupdate.c (dump_jump_thread_path): Pretty print EDGE_FSM_THREAD. (verify_seme): New. (duplicate_seme_region): New. (thread_through_all_blocks): Generate code for EDGE_FSM_THREAD edges calling duplicate_seme_region. * tree-ssa-threadupdate.h (jump_thread_edge_type): Add EDGE_FSM_THREAD. * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c: New test. * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c: New test. --- gcc/ChangeLog| 29 +++ gcc/doc/invoke.texi | 12 + gcc/params.def | 15 ++ gcc/testsuite/ChangeLog |8 + gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c | 43 gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c | 127 ++ gcc/tree-cfg.c |2 +- gcc/tree-cfg.h |1 + gcc/tree-ssa-threadedge.c| 278 +- gcc/tree-ssa-threadupdate.c | 203 +++- gcc/tree-ssa-threadupdate.h |1 + 11 files changed, 716 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b340b51..6cfd339 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2014-12-06 James Greenhalgh + Sebastian Pop + Brian Rzycki + + PR tree-optimization/54742 + * params.def (max-fsm-thread-path-insns, max-fsm-thread-length, + max-fsm-thread-paths): New. + + * doc/invoke.texi (max-fsm-thread-path-insns, max-fsm-thread-length, + max-fsm-thread-paths): Documented. + + * tree-cfg.c (split_edge_bb_loc): Export. + * tree-cfg.h (split_edge_bb_loc): Declared extern. + + * tree-ssa-threadedge.c (simplify_control_stmt_condition): Restore the + original value of cond when simplification fails. + (fsm_find_thread_path): New. + (fsm_find_control_statement_thread_paths): New. + (thread_through_normal_block): Call find_control_statement_thread_paths. + + * tree-ssa-threadupdate.c (dump_jump_thread_path): Pretty print + EDGE_FSM_THREAD. + (verify_seme): New. + (duplicate_seme_region): New. + (thread_through_all_blocks): Generate code for EDGE_FSM_THREAD edges + calling duplicate_seme_region. + + * tree-ssa-threadupdate.h (jump_thread_edge_type): Add EDGE_FSM_THREAD. + 2014-12-06 H.J. Lu PR target/64200 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 82f0794..70d1336 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10623,6 +10623,18 @@ large and significantly increase compile time at optimization level @option{-O1} and higher. This parameter is a maximum nubmer of statements in a single generated constructor. Default value is 5000. +@item max-fsm-thread-path-insns +Maximum number of instructions to copy when duplicating blocks on a +finite state automaton jump thread path. The default is 100. + +@item max-fsm-thread-length +Maximum number of basic blocks on a finite state automaton jump thread +path.
Re: [PATCH] PR other/63613: Add fixincludes for dejagnu.h
On 12/05/14 12:32, Jeff Law wrote:1 fixincludes/ChangeLog: PR other/63613 * inclhack.def (dejagnu_h_make_inline_functions_static): New fix. * fixincl.x: Regenerate. * tests/base/dejagnu.h: New. OK. No, actually not. +fix = { +hackname = dejagnu_h_make_inline_functions_static; +files = dejagnu.h; + +sed = 's@^inline void$' + '@static inline void@'; I guess I should elaborate on the preferred substitution mechanism: the "format" fix. This is functionally equivalent but does not require loading the "sed" program: fix = { hackname = dejagnu_static_inline; files = dejagnu.h; select = '^inline void$'; c-fix = format; c-fix-arg = 'static %0'; Thank you.
Re: [PATCH], PR 64204, Fix long double constants on powerpc little endian
On Fri, Dec 5, 2014 at 5:46 PM, Michael Meissner wrote: > After my upper regs patches went in, I noticed that the gcc.dg/c11-atomic-2.c > test would fail on a power8 host that was running in little endian mode. This > particular test only fails if you are compiling this code with no > optimization, > and power8 selected as the cpu. Ultimately, it fails in reload when an array > index is way out of bounds. > > In looking at it, it is due to rs6000_emit_move creating two separate moves of > SUBREG's of TFmode to assign a constant during RTL generation. I fixed this > so > this 'optimization' is only done if DFmode values can only go in the > traditional registers. While I was at it, I optimized setting TFmode > variables > to 0.0L to use xxlxor rather than loading up 2 double words of memory. > > I have done bootstraps on big endian power7, big endian power8, and little > endian power8 with no regressions in the test suite. I also have built the > Spec 2006 test suite for power7. Can I install these patches? > > 2014-12-05 Michael Meissner > > PR target/64204 > * config/rs6000/rs6000.c (rs6000_emit_move): Do not split TFmode > constant moves if -mupper-regs-df. > > * config/rs6000/rs6000.md (mov_64bit_dm): Optimize moving > 0.0L to TFmode. > (movtd_64bit_nodm): Likewise. > (mov_32bit, FMOVE128 case): Likewise. Okay. Thanks, David
Deprecating std::has_trivial_xxx traits
Now that we have std::is_trivially_constructible etc. we should deprecate and then remove the non-standard std::has_trivial_destructor traits. Any objections to adding that to the release notes and adding the _GLIBCXX_DEPRECATED attribute to the traits?
[Patch, Fortran, committed] bool cleanup in error.c
This patch does a cleanup in error.c; it changes come "int" values to "bool" – based on Manuel's RFC patch – and it consolidates two buffers flags. Committed as Rev. 218449 as obvious. Tobias Index: gcc/fortran/ChangeLog === --- gcc/fortran/ChangeLog (Revision 218448) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,20 @@ +2014-12-06 Tobias Burnus + Manuel López-Ibáñez + + * error.c (gfc_buffer_error, gfc_error_flag_test): Use bool not int. + (buffer_flag): Remove static variable. + (buffered_p): Add static variable. + (gfc_error_init_1): Call gfc_buffer_error. + (gfc_warning_1, gfc_warning, gfc_warning_now_1, gfc_error, + gfc_error_now_1): Update for static variable change. + * gfortran.h (gfc_buffer_error, gfc_error_flag_test): Update + prototype. + * parse.c (use_modules, decode_specification_statement, + next_fixed, next_statement, match_deferred_characteristics): + Update calls. + * decl.c (gfc_match_data_decl): Ditto. + * match.c (gfc_match_name): Ditto. + 2014-12-05 Andre Vehreschild PR fortran/60414 Index: gcc/fortran/decl.c === --- gcc/fortran/decl.c (Revision 218448) +++ gcc/fortran/decl.c (Arbeitskopie) @@ -4397,7 +4397,7 @@ ok: break; } - if (gfc_error_flag_test () == 0) + if (!gfc_error_flag_test ()) gfc_error ("Syntax error in data declaration at %C"); m = MATCH_ERROR; Index: gcc/fortran/error.c === --- gcc/fortran/error.c (Revision 218448) +++ gcc/fortran/error.c (Arbeitskopie) @@ -46,10 +46,15 @@ static int suppress_errors = 0; static bool warnings_not_errors = false; -static int terminal_width, buffer_flag, errors, warnings; +static int terminal_width, errors, warnings; static gfc_error_buf error_buffer, warning_buffer, *cur_error_buffer; +/* True if the error/warnings should be buffered. */ +static bool buffered_p; + +/* These are always buffered buffers (.flush_p == false) to be used by + the pretty-printer. */ static output_buffer pp_warning_buffer; static int warningcount_buffered, werrorcount_buffered; @@ -116,7 +121,7 @@ gfc_error_init_1 (void) terminal_width = get_terminal_width (); errors = 0; warnings = 0; - buffer_flag = 0; + gfc_buffer_error (false); } @@ -123,20 +128,20 @@ gfc_error_init_1 (void) /* Set the flag for buffering errors or not. */ void -gfc_buffer_error (int flag) +gfc_buffer_error (bool flag) { - buffer_flag = flag; + buffered_p = flag; pp_warning_buffer.flush_p = !flag; } /* Add a single character to the error buffer or output depending on - buffer_flag. */ + buffered_p. */ static void error_char (char c) { - if (buffer_flag) + if (buffered_p) { if (cur_error_buffer->index >= cur_error_buffer->allocated) { @@ -844,7 +849,7 @@ gfc_warning_1 (const char *gmsgid, ...) error_char ('\0'); - if (buffer_flag == 0) + if (!buffered_p) { warnings++; if (warnings_are_errors) @@ -869,7 +874,6 @@ gfc_warning (int opt, const char *gmsgid, va_list bool fatal_errors = global_dc->fatal_errors; pretty_printer *pp = global_dc->printer; output_buffer *tmp_buffer = pp->buffer; - bool buffered_p = !pp_warning_buffer.flush_p; gfc_clear_pp_buffer (&pp_warning_buffer); @@ -1021,7 +1025,7 @@ gfc_notify_std (int std, const char *gmsgid, ...) error_char ('\0'); - if (buffer_flag == 0) + if (!buffered_p) { if (warning && !warnings_are_errors) warnings++; @@ -1042,13 +1046,13 @@ void gfc_warning_now_1 (const char *gmsgid, ...) { va_list argp; - int i; + bool buffered_p_saved; if (inhibit_warnings) return; - i = buffer_flag; - buffer_flag = 0; + buffered_p_saved = buffered_p; + buffered_p = false; warnings++; va_start (argp, gmsgid); @@ -1060,7 +1064,7 @@ gfc_warning_now_1 (const char *gmsgid, ...) if (warnings_are_errors) gfc_increment_error_count(); - buffer_flag = i; + buffered_p = buffered_p_saved; } /* Called from output_format -- during diagnostic message processing @@ -1336,7 +1340,7 @@ gfc_error (const char *gmsgid, ...) error_char ('\0'); - if (buffer_flag == 0) + if (!buffered_p) gfc_increment_error_count(); return; @@ -1356,7 +1360,7 @@ warning: error_char ('\0'); - if (buffer_flag == 0) + if (!buffered_p) { warnings++; if (warnings_are_errors) @@ -1373,14 +1377,14 @@ void gfc_error_now_1 (const char *gmsgid, ...) { va_list argp; - int i; + bool buffered_p_saved; error_buffer.flag = 1; error_buffer.index = 0; cur_error_buffer = &error_buffer; - i = buffer_flag; - buffer_flag = 0; + buffered_p_saved = buffered_p; + buffered_p = false; va_start (argp, gmsgid); error_print (_("Error:"), _(gmsgid), argp); @@ -1390,7 +1394,7 @@ gfc_error_now_1 (const char *gmsgid, ...) gfc_increment_error_co
[wwwdocs] Update changes.html with libstdc++ changes
This adds recent libstdc++ updates to gcc-5/changes.html I'm also noting one old change in the GCC 4.5 page, and removing/changing some links to the C++0x status table. The list of features supported on trunk is fairly irrelevant to someone looking at the 4.4 release notes, so I've linked to the docs for the relevant release, or just removed the link for 4.4 and 4.5 because we don't have libstdc++ docs online for those releases. Committed to CVS. Index: gcc-4.4/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.4/changes.html,v retrieving revision 1.88 diff -u -u -r1.88 changes.html --- gcc-4.4/changes.html 28 Jun 2014 22:44:29 - 1.88 +++ gcc-4.4/changes.html 6 Dec 2014 16:28:20 - @@ -377,9 +377,8 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#id476343";> - Improved experimental support for the upcoming ISO C++ standard, - C++0x, including: +Improved experimental support for the upcoming ISO C++ standard, + C++0x, including: Support for, , , , , Index: gcc-4.5/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.5/changes.html,v retrieving revision 1.112 diff -u -u -r1.112 changes.html --- gcc-4.5/changes.html 28 Jun 2014 20:35:51 - 1.112 +++ gcc-4.5/changes.html 6 Dec 2014 16:28:20 - @@ -373,14 +373,14 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x";> - Improved experimental support for the upcoming ISO C++ standard, - C++0x, including: +Improved experimental support for the upcoming ISO C++ standard, + C++0x, including: Support for , , and . Existing facilities now exploit explicit operators and the newly implemented core C++0x features. + The header has been renamed to . Index: gcc-4.6/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v retrieving revision 1.151 diff -u -u -r1.151 changes.html --- gcc-4.6/changes.html 28 Jun 2014 22:44:29 - 1.151 +++ gcc-4.6/changes.html 6 Dec 2014 16:28:20 - @@ -460,7 +460,7 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x";> +https://gcc.gnu.org/onlinedocs/gcc-4.6.4/libstdc++/manual/manual/status.html#status.iso.200x";> Improved experimental support for the upcoming ISO C++ standard, C++0x, including using constexpr and nullptr. Index: gcc-4.7/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v retrieving revision 1.139 diff -u -u -r1.139 changes.html --- gcc-4.7/changes.html 12 Jun 2014 11:55:02 - 1.139 +++ gcc-4.7/changes.html 6 Dec 2014 16:28:20 - @@ -560,7 +560,7 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/gcc-4.7.1/libstdc++/manual/manual/status.html#status.iso.2011";> +https://gcc.gnu.org/onlinedocs/gcc-4.7.4/libstdc++/manual/manual/status.html#status.iso.2011";> Improved experimental support for the new ISO C++ standard, C++11, including: Index: gcc-4.8/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.129 diff -u -u -r1.129 changes.html --- gcc-4.8/changes.html 21 Nov 2014 16:24:02 - 1.129 +++ gcc-4.8/changes.html 6 Dec 2014 16:28:20 - @@ -292,7 +292,7 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011";> +https://gcc.gnu.org/onlinedocs/gcc-4.8.3/libstdc++/manual/manual/status.html#status.iso.2011";> Improved experimental support for the new ISO C++ standard, C++11, including: Index: gcc-4.9/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v retrieving revision 1.82 diff -u -u -r1.82 changes.html --- gcc-4.9/changes.html 21 Nov 2014 16:25:07 - 1.82 +++ gcc-4.9/changes.html 6 Dec 2014 16:28:20 - @@ -324,7 +324,7 @@ Runtime Library (libstdc++) -https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011";> +https://gcc.gnu.org/onlinedocs/gcc-4.9.2/libstdc++/manual/manual/status.html#status.iso.2011";> Improved support for C++11, including: support for ; Index: gcc-5/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v retrieving revision 1.45 diff -u -u -r1.45 changes.html --- gcc-
Re: [Patch, Fortran, committed] bool cleanup in error.c
Tobias Burnus wrote: This patch does a cleanup in error.c; it changes come "int" values to "bool" – based on Manuel's RFC patch – and it consolidates two buffers flags. Committed as Rev. 218449 as obvious. And some more; committed as Rev. 218450. Tobias
Re: [RFC PATCH fortran/diagnostics] Move gfc_error (buffered) to common diagnostics
Manuel López-Ibáñez wrote: I separated the diagnostics and fortran parts in two patches. This is a RFC to: * Dodji: I needed to make diagnostic_action_after_output external. [...] * Tobias or other Fortran maintainers. The only test failing is gfortran.dg/do_iterator.f90 line 7. The old code gives an Error there, which the new one does not. READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" } 1 Error: Invalid character in name at (1) That error looks bogus: The message (semantically) looks odd and also the whole test case doesn't give the impression that that message was intented. Thus, your new patch seems to be ok. (Tobias, there are some cleanups in the fortran patch in error.c to use 'bool' more often for some flags and functions. If you want to apply that already, it will reduce the diff a bit.) I did do so now. Regarding the patch: For gfc_error_check, I think you need to set "rc" (now: "error_raised") also when the new code is used. Otherwise, it looks good to me. Thanks for working on it! Tobias
Re: [Patch, Fortran, committed] bool cleanup in error.c
Tobias Burnus wrote: Tobias Burnus wrote: This patch does a cleanup in error.c; it changes come "int" values to "bool" – based on Manuel's RFC patch – and it consolidates two buffers flags. Committed as Rev. 218449 as obvious. And some more; committed as Rev. 218450. I forgot to attach the patch. Tobias Index: gcc/fortran/ChangeLog === --- gcc/fortran/ChangeLog (Revision 218449) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,4 +1,12 @@ 2014-12-06 Tobias Burnus + + * error.c (gfc_error_check): Use bool not int. + * gfortran.h (gfc_error_check): Update prototype. + * match.c (gfc_match_if): Update call. + * parse.c (decode_statement, decode_omp_directive, + decode_gcc_attribute): Ditto. + +2014-12-06 Tobias Burnus Manuel López-Ibáñez * error.c (gfc_buffer_error, gfc_error_flag_test): Use bool not int. Index: gcc/fortran/error.c === --- gcc/fortran/error.c (Revision 218449) +++ gcc/fortran/error.c (Arbeitskopie) @@ -1440,14 +1440,12 @@ gfc_error_flag_test (void) /* Check to see if any errors have been saved. If so, print the error. Returns the state of error_flag. */ -int +bool gfc_error_check (void) { - int rc; + bool error_raised = (bool) error_buffer.flag; - rc = error_buffer.flag; - - if (error_buffer.flag) + if (error_raised) { if (error_buffer.message != NULL) fputs (error_buffer.message, stderr); @@ -1459,7 +1457,7 @@ gfc_error_check (void) exit (FATAL_EXIT_CODE); } - return rc; + return error_raised; } Index: gcc/fortran/gfortran.h === --- gcc/fortran/gfortran.h (Revision 218449) +++ gcc/fortran/gfortran.h (Arbeitskopie) @@ -2688,7 +2688,7 @@ void gfc_error_now (const char *, ...) ATTRIBUTE_G void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); void gfc_clear_error (void); -int gfc_error_check (void); +bool gfc_error_check (void); bool gfc_error_flag_test (void); notification gfc_notification_std (int); Index: gcc/fortran/match.c === --- gcc/fortran/match.c (Revision 218449) +++ gcc/fortran/match.c (Arbeitskopie) @@ -1497,7 +1497,7 @@ gfc_match_if (gfc_statement *if_type) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error ("Unclassifiable statement in IF-clause at %C"); gfc_free_expr (expr); Index: gcc/fortran/parse.c === --- gcc/fortran/parse.c (Revision 218449) +++ gcc/fortran/parse.c (Arbeitskopie) @@ -549,7 +549,7 @@ decode_statement (void) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable statement at %C"); reject_statement (); @@ -769,7 +769,7 @@ decode_omp_directive (void) if (gfc_option.gfc_flag_openmp || simd_matched) { - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable OpenMP directive at %C"); } @@ -796,7 +796,7 @@ decode_gcc_attribute (void) /* All else has failed, so give up. See if any of the matchers has stored an error message of some sort. */ - if (gfc_error_check () == 0) + if (!gfc_error_check ()) gfc_error_now ("Unclassifiable GCC directive at %C"); reject_statement ();
Re: [Patch] Improving jump-thread pass for PR 54742
Sebastian Pop wrote: > Jeff Law wrote: > > OK to commit. Thanks for your patience. > > > > Can you follow-up with a change which throttles this optimization > > when -Os is in effect. You can check optimize_function_for_size_p > > (cfun) and simply avoid the backward traversal or you could allow it > > in that case if the amount of copying is suitably small. Your call. > > I think it does not make sense to duplicate paths at -Os: I disabled the FSM > jump-threading when optimizing for size like this. > > diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c > index 29b20c8..ce70311 100644 > --- a/gcc/tree-ssa-threadedge.c > +++ b/gcc/tree-ssa-threadedge.c > @@ -1335,8 +1335,9 @@ thread_through_normal_block (edge e, > return 1; > } > >if (!flag_expensive_optimizations > + || optimize_function_for_size_p (cfun) > || TREE_CODE (cond) != SSA_NAME > || e->dest->loop_father != e->src->loop_father > || loop_depth (e->dest->loop_father) == 0) > return 0; > > I will regstrap and commit the attached patch. Bootstrapped and regression tested on x86_64-linux. Committed r218451. Sebastian
Re: [RFC PATCH fortran/diagnostics] Move gfc_error (buffered) to common diagnostics
Le 06/12/2014 14:38, Manuel López-Ibáñez a écrit : > * Tobias or other Fortran maintainers. The only test failing is > gfortran.dg/do_iterator.f90 line 7. The old code gives an Error there, > which the new one does not. > > /home/manuel/test1/pristine/gcc/testsuite/gfortran.dg/do_iterator.f90:7.9: > >READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" } > 1 > Error: Invalid character in name at (1) > > It seems that the gfc_error above is buffered first, then it is > cleared, however, the old code does not actually clear the text only > clears error_buffer.flag, then a gfc_error_now is emitted, which sets > error_buffer.flag (?!), the next gfc_error_check then emits the text > that was still in the buffer. Is this intended to work like this? If > so, then this patch needs more work. > I agree with Tobias: this error is certainly bogus. For what it's worth, I've had a set of unfinished diagnostic patches, whose first one (attached) was taking care of this very error. Mikael commit 02000ad2b84f3f833bf26d74e055811266d348da Author: Mik Date: Thu Aug 15 12:39:05 2013 +0200 io.c (match_io_element): appel a gfc_check_do_variable non fatal diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index cc5ce12..196e4d5 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3106,8 +3106,8 @@ match_io_element (io_kind k, gfc_code **cpp) io_kind_name (k)); } - if (m == MATCH_YES && k == M_READ && gfc_check_do_variable (expr->symtree)) -m = MATCH_ERROR; + if (m == MATCH_YES && k == M_READ) +gfc_check_do_variable (expr->symtree); if (m != MATCH_YES) { diff --git a/gcc/testsuite/gfortran.dg/do_iterator.f90 b/gcc/testsuite/gfortran.dg/do_iterator.f90 index cb3e50d..e1fa18b 100644 --- a/gcc/testsuite/gfortran.dg/do_iterator.f90 +++ b/gcc/testsuite/gfortran.dg/do_iterator.f90 @@ -10,4 +10,3 @@ DO I=1,5 ! { dg-error "cannot be redefined" "changing do-iterator 3" } READ(5,*,iostat=i) j ! { dg-error "cannot be redefined" "changing do-iterator 3" } ENDDO END -! { dg-error "Invalid character" "character" { target *-*-* } 7 }
[PATCH] libgccjit cleanups
This patch broken out of one I sent earlier with some extensions. It contains only little cleanups to the libgccjit code. When creating the linker command line the code now uses an auto_vec instead of the fixed size array. The second change adds the missing context::set_str_option member function to the C++ interface. The third change it to the string option handling. Instead of just using the pointer passed to the function the code now makes a copy of the string. OK? gcc/ChangeLog: 2014-12-06 Ulrich Drepper * jit/jit-playback.c (convert_to_dso): Use auto_vec instead of automatic array to build up command line. * jit/jit-recording.c (recording::context::set_str_option): Make copy of the string. (recording::context::~context): Free string options. * jit/jit-recording.h (recording::context): Adjust type of m_str_options member. * jit/libgccjit.h: Adjust comment about gcc_jit_context_set_str_option parameter begin used after the call. * jit/libgccjit++.h (gccjit::context): Add set_str_option member function. diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c index ecdae80..6d1eb8a 100644 --- a/gcc/jit/jit-playback.c +++ b/gcc/jit/jit-playback.c @@ -1726,18 +1726,19 @@ convert_to_dso (const char *ctxt_progname) TV_ASSEMBLE. */ auto_timevar assemble_timevar (TV_ASSEMBLE); const char *errmsg; - const char *argv[7]; + auto_vec argvec; +#define ADD_ARG(arg) argvec.safe_push (arg) int exit_status = 0; int err = 0; const char *gcc_driver_name = GCC_DRIVER_NAME; - argv[0] = gcc_driver_name; - argv[1] = "-shared"; + ADD_ARG (gcc_driver_name); + ADD_ARG ("-shared"); /* The input: assembler. */ - argv[2] = m_path_s_file; + ADD_ARG (m_path_s_file); /* The output: shared library. */ - argv[3] = "-o"; - argv[4] = m_path_so_file; + ADD_ARG ("-o"); + ADD_ARG (m_path_so_file); /* Don't use the linker plugin. If running with just a "make" and not a "make install", then we'd @@ -1746,17 +1747,17 @@ convert_to_dso (const char *ctxt_progname) libto_plugin is a .la at build time, with it becoming installed with ".so" suffix: i.e. it doesn't exist with a .so suffix until install time. */ - argv[5] = "-fno-use-linker-plugin"; + ADD_ARG ("-fno-use-linker-plugin"); /* pex argv arrays are NULL-terminated. */ - argv[6] = NULL; + ADD_ARG (NULL); /* pex_one's error-handling requires pname to be non-NULL. */ gcc_assert (ctxt_progname); errmsg = pex_one (PEX_SEARCH, /* int flags, */ gcc_driver_name, - const_cast (argv), + const_cast (argvec.address ()), ctxt_progname, /* const char *pname */ NULL, /* const char *outname */ NULL, /* const char *errname */ @@ -1783,6 +1784,7 @@ convert_to_dso (const char *ctxt_progname) getenv ("PATH")); return; } +#undef ADD_ARG } /* Top-level hook for playing back a recording context. diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c --- a/gcc/jit/jit-recording.c +++ b/gcc/jit/jit-recording.c @@ -215,6 +215,9 @@ recording::context::~context () delete m; } + for (i = 0; i < GCC_JIT_NUM_STR_OPTIONS; ++i) +free (m_str_options[i]); + if (m_builtins_manager) delete m_builtins_manager; @@ -827,7 +830,7 @@ recording::context::set_str_option (enum gcc_jit_str_option opt, "unrecognized (enum gcc_jit_str_option) value: %i", opt); return; } - m_str_options[opt] = value; + m_str_options[opt] = xstrdup (value); } /* Set the given integer option for this context, or add an error if diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -246,7 +246,7 @@ private: char *m_first_error_str; bool m_owns_first_error_str; - const char *m_str_options[GCC_JIT_NUM_STR_OPTIONS]; + char *m_str_options[GCC_JIT_NUM_STR_OPTIONS]; int m_int_options[GCC_JIT_NUM_INT_OPTIONS]; bool m_bool_options[GCC_JIT_NUM_BOOL_OPTIONS]; diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h --- a/gcc/jit/libgccjit++.h +++ b/gcc/jit/libgccjit++.h @@ -99,6 +99,9 @@ namespace gccjit void dump_to_file (const std::string &path, bool update_locations); +void set_str_option (enum gcc_jit_str_option opt, +const char *value); + void set_int_option (enum gcc_jit_int_option opt, int value); @@ -535,6 +538,14 @@ context::dump_to_file (const std::string &path, } inline void +context::set_str_option (enum gcc_jit_str_option opt, +const char *value) +{ + gcc_jit_context_set_str_option (m_inner_ctxt, opt, value); + +} + +inline void context::set_int_option (enum gcc_jit_int_option opt, int value)
[PATCH] influence JIT linker command line
This patch supercedes the patch I sent earlier this week to add dependencies to the linker command line. The implementation is different. First, based on Dave's comment that he wants to keep the interface simple, to enable the linker optimizations no new interface is added. Instead optimizations are enabled in the linker whenever the compiler optimizes, too. I don't think this will create problems at all since the time it takes nowadays is really low; it's only really measurable for extremely large files. The way to add dependencies is changed. Instead of allowing an unstructured string parameter to be added to the command line the new proposed interface allows to introduce a dependency with possibly information about the path the dependency is found. This should be useful and implementable if at some point the explicit linker invocation is replaced by a library implementation. The path argument of the new interface is used differently depending on the name. If the name is of the form -l* then the -L option is used and a runpath is added. Otherwise the path is used to locate the file. Comments? gcc/ChangeLog: 2014-12-06 Ulrich Drepper * jit/jit-recording.c (recording::context::add_dependency): New function. (recording::context::~context): Free newly added lists. * jit/jit-recording.h (recording::context): Add new member functions. * jit/libgccjit++.h (context): Add add_dependency member function. * jit/libgccjit.h: Declare gcc_jit_context_add_dependency. * jit/libgccjit.c: Define gcc_jit_context_add_dependency. * jit/libgccjit.map: Add gcc_jit_context_add_dependency. * jit/jit-playback.c (convert_to_dso): Add dependencies and library path arguments to the command line. * docs/topics/contexts.rst: Document new interface. diff -u b/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c --- b/gcc/jit/jit-playback.c +++ b/gcc/jit/jit-playback.c @@ -1749,6 +1749,18 @@ time. */ ADD_ARG ("-fno-use-linker-plugin"); + /* Linker optimization. We always tell the linker to optimize if the + compiler is optimizing, too. */ + if (get_int_option (GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL) > 0) +ADD_ARG ("-Wl,-O"); + + const char *s; + for (unsigned i = 0; (s = get_dependency (i)); ++i) +ADD_ARG (s); + + for (unsigned i = 0; (s = get_library_path (i)); ++i) +ADD_ARG (s); + /* pex argv arrays are NULL-terminated. */ ADD_ARG (NULL); diff -u b/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c --- b/gcc/jit/jit-recording.c +++ b/gcc/jit/jit-recording.c @@ -218,6 +218,17 @@ for (i = 0; i < GCC_JIT_NUM_STR_OPTIONS; ++i) free (m_str_options[i]); + char *s; + FOR_EACH_VEC_ELT (m_dependencies, i, s) +{ + free (s); +} + + FOR_EACH_VEC_ELT (m_library_path, i, s) +{ + free (s); +} + if (m_builtins_manager) delete m_builtins_manager; @@ -871,7 +882,66 @@ m_bool_options[opt] = value ? true : false; } -/* This mutex guards gcc::jit::recording::context::compile, so that only +/* Add the given library to the set of dependencies, or add an error + if it's not recognized. + + Implements the post-error-checking part of + gcc_jit_context_add_dependency. */ +void +recording::context::add_dependency (const char *name, int flags, + const char *path) +{ + if (name == NULL) +{ + add_error (NULL, "NULL library name"); + return; +} + /* So far no flags are defined. */ + if (flags != 0) +{ + add_error (NULL, +"unrecognized flags value: %i", flags); + return; +} + + bool named_library = strncmp (name, "-l", 2); + + if (strchr (name, '/') != NULL && (named_library || path != NULL)) +{ + add_error (NULL, +"path must be NULL unless simple file name is used"); + return; +} + if (named_library == 0 || path == NULL) +{ + m_dependencies.safe_push (xstrdup (name)); + + if (named_library) + { + char *v; + asprintf (&v, "-Wl,-R,%s -L %s", path, path); + if (v == NULL) + { + add_error (NULL, "cannot allocate memory"); + return; + } + m_library_path.safe_push (v); + } +} + else +{ + char *v; + asprintf (&v, "%s/%s", path, name); + if (v == NULL) + { + add_error (NULL, "cannot allocate memory"); + return; + } + m_dependencies.safe_push (v); +} +} + + /* This mutex guards gcc::jit::recording::context::compile, so that only one thread can be accessing the bulk of GCC's state at once. */ static pthread_mutex_t jit_mutex = PTHREAD_MUTEX_INITIALIZER; diff -u b/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h --- b/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -191,6 +191,10 @@ set_bool_option (enum gcc_jit_bool_option opt, int va
Re: [patch] libstdc++/59603 Prevent self-swapping in random_shuffle
On 1 October 2014 at 13:35, Jonathan Wakely wrote: > On 12/09/14 14:34 +0100, Jonathan Wakely wrote: >> >> Swapping an object with itself is pointless, and asserts in debug mode >> (but we should probably remove that check from debug mode, since it >> can happen in reasonable code). >> >> Tested x86_64-linux, committed to trunk. >> >> I think this makes sense for the branches too, so will backport it >> soon. > > > Now committed to the 4.9 branch (without the comment Chris didn't > like). > >> PR libstdc++/59603 >> * include/bits/stl_algo.h (random_shuffle): Prevent self-swapping. >> * testsuite/25_algorithms/random_shuffle/59603.cc: New. > > > And also to the 4.8 branch.
[RFC] diagnostics.c: For terminals, restrict messages to terminal width?
This patch fixes a Fortran diagnostic "regression". With the current common diagnostic, the width shown with caret diagnostic is determined by: case OPT_fmessage_length_: pp_set_line_maximum_length (dc->printer, value); diagnostic_set_caret_max_width (dc, value); plus diagnostic_set_caret_max_width (diagnostic_context *context, int value) { /* One minus to account for the leading empty space. */ value = value ? value - 1 : (isatty (fileno (pp_buffer (context->printer)->stream)) ? getenv_columns () - 1: INT_MAX); if (value <= 0) value = INT_MAX; context->caret_max_width = value; } where getenv_columns looks at the environment variable COLUMNS. Note that -fmessage-length= applies to the error message (wraps) _and_ the caret diagnostic (truncates) while the COLUMNS variable _only_ applies to the caret diagnostic. (BTW: The documentation currently does not mention COLUMNS.) On most terminals, which I tried, COLUMNS does not seem to be set. In Fortran, error.c's get_terminal_width has a similar check, but additionally it uses ioctl to determine the terminal width. I think with caret diagnostics, it is useful not to exceed the terminal width as having several "empty" lines before the "^" does not really improve the readability. Thus, I would propose to additionally use ioctl. Which rises two questions: (a) Should the COLUMNS environment variable or ioctl have a higher priority? [Fortran ranks ioctl higher; in the patch, for backward compatibilty, I rank COLUMNS higher.] (b) Should ioctl be always used or only for Fortran? Comments? Tobias diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 28ef81c..9a29300 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -82,18 +82,27 @@ file_name_as_prefix (diagnostic_context *context, const char *f) /* Return the value of the getenv("COLUMNS") as an integer. If the - value is not set to a positive integer, then return INT_MAX. */ + value is not set to a positive integer, use ioctl to get the + terminal width. If it fails, return INT_MAX. */ static int -getenv_columns (void) +getenv_columns_and_termwidth (void) { const char * s = getenv ("COLUMNS"); if (s != NULL) { int n = atoi (s); if (n > 0) return n; } + +#ifdef TIOCGWINSZ + struct winsize w; + w.ws_col = 0; + if (ioctl (0, TIOCGWINSZ, &w) == 0 && w.ws_col > 0) +return w.ws_col; +#endif + return INT_MAX; } /* Set caret_max_width to value. */ @@ -102,9 +111,9 @@ diagnostic_set_caret_max_width (diagnostic_context *context, int value) { /* One minus to account for the leading empty space. */ value = value ? value - 1 : (isatty (fileno (pp_buffer (context->printer)->stream)) - ? getenv_columns () - 1: INT_MAX); + ? getenv_columns_and_termwidth () - 1: INT_MAX); if (value <= 0) value = INT_MAX;
Re: [RFC PATCH fortran/diagnostics] Move gfc_error (buffered) to common diagnostics
Tobias Burnus wrote: Regarding the patch: For gfc_error_check, I think you need to set "rc" (now: "error_raised") also when the new code is used. Otherwise, it looks good to me. Ignore that comment, I missed the existing "rc = true;" – however, you still need to the change to the new variable name. Tobias
[wwwdocs] Move -Wodr and -Wsuggest-final-{methods,types} items to C++ section.
The items on these new warnings are listed under libstdc++, but should be under C++. Committed to CVS. ? gcc-5/.changes.html.swp Index: gcc-5/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v retrieving revision 1.46 diff -u -r1.46 changes.html --- gcc-5/changes.html 6 Dec 2014 16:29:23 - 1.46 +++ gcc-5/changes.html 7 Dec 2014 00:05:57 - @@ -239,6 +239,15 @@ constexpr int i = f(42); // i is 42 + New One Definition Rule violation warning (controlled by -Wodr) + detects mismatches in type definitions and virtual table contents + during link-time optimization. + New warnings -Wsuggest-final-types and + -Wsuggest-final-methods helps developers + to annotate programs by final specifiers (or anonymous + namespaces) in the cases where code generation improves. + These warnings can be used at compile time, but they are more + useful in combination with link-time optimization. Runtime Library (libstdc++) @@ -295,15 +304,6 @@ New random number distributions logistic_distribution and uniform_on_sphere_distribution as extensions. -New One Definition Rule violation warning (controlled by -Wodr) -detects mismatches in type definitions and virtual table contents - during link-time optimization. -New warnings -Wsuggest-final-types and - -Wsuggest-final-methods helps developers - to annotate programs by final specifiers (or anonymous - namespaces) in the cases where code generation improves. - These warnings can be used at compile time, but they are more - useful in combination with link-time optimization. https://sourceware.org/gdb/current/onlinedocs/gdb/Xmethods-In-Python.html";>GDB Xmethods for Sequence Containers and std::unique_ptr;
[patch] Fix spelling in docs for -Wsuggest-final-{methods,types}
Committed as obvious. commit 0d0ff00247c2af51f40ca2ee3bc08d4641c02dc3 Author: Jonathan Wakely Date: Sun Dec 7 00:44:44 2014 + * doc/invoke.texi (Warning Options): Fix spelling and grammar. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 70d1336..d2f3c79 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4240,20 +4240,22 @@ appropriate may not be detected. @opindex Wno-suggest-final-types @opindex Wsuggest-final-types Warn about types with virtual methods where code quality would be improved -if the type was declared with C++11 final specifier, or, if possible, -declared in anonymous namespace. This allows GCC to devritualize more aggressively -the polymorphic calls. This warning is more effective with link time optimization, -where the information about the class hiearchy graph is more complete. +if the type was declared with the C++11 final specifier, or, if possible, +declared in an anonymous namespace. This allows GCC to more aggressively +devirtualize the polymorphic calls. This warning is more effective with link +time optimization, where the information about the class hierarchy graph is +more complete. @item -Wsuggest-final-methods @opindex Wno-suggest-final-methods @opindex Wsuggest-final-methods Warn about virtual methods where code quality would be improved if the method -was declared with C++11 final specifier, or, if possible, its type was declared -in the anonymous namespace or with final specifier. This warning is more -effective with link time optimization, where the information about the class -hiearchy graph is more complete. It is recommended to first consider suggestins -of @option{-Wsuggest-final-types} and then rebuild with new annotations. +was declared with the C++11 final specifier, or, if possible, its type was +declared in an anonymous namespace or with the final specifier. This warning is +more effective with link time optimization, where the information about the +class hierarchy graph is more complete. It is recommended to first consider +suggestions of @option{-Wsuggest-final-types} and then rebuild with new +annotations. @item -Warray-bounds @opindex Wno-array-bounds @@ -4288,7 +4290,8 @@ can be used to suppress such a warning. @opindex Wincompatible-pointer-types Do not warn when there is a conversion between pointers that have incompatible types. This warning is for cases not covered by @option{-Wno-pointer-sign}, -which warns for pointer argument passing or assignment with different signedness +which warns for pointer argument passing or assignment with different +signedness. @item -Wno-int-conversion @r{(C and Objective-C only)} @opindex Wno-int-conversion
Re: [PATCH AARCH64]load store pair optimization using sched_fusion pass.
On Fri, Dec 5, 2014 at 9:08 AM, Marcus Shawcroft wrote: > On 18 November 2014 at 08:34, Bin Cheng wrote: > >> 2014-11-18 Bin Cheng >> >> * config/aarch64/aarch64.md (load_pair): Split to >> load_pairsi, load_pairdi, load_pairsf and load_pairdf. >> (load_pairsi, load_pairdi, load_pairsf, load_pairdf): Split >> from load_pair. New alternative to support int/fp >> registers in fp/int mode patterns. >> (store_pair:): Split to store_pairsi, store_pairdi, >> store_pairsf and store_pairdi. >> (store_pairsi, store_pairdi, store_pairsf, store_pairdf): Split >> from store_pair. New alternative to support int/fp >> registers in fp/int mode patterns. >> (*load_pair_extendsidi2_aarch64): New pattern. >> (*load_pair_zero_extendsidi2_aarch64): New pattern. >> (aarch64-ldpstp.md): Include. >> * config/aarch64/aarch64-ldpstp.md: New file. >> * config/aarch64/aarch64-protos.h (aarch64_gen_adjusted_ldpstp): >> New. >> (extract_base_offset_in_addr): New. >> (aarch64_operands_ok_for_ldpstp): New. >> (aarch64_operands_adjust_ok_for_ldpstp): New. >> * config/aarch64/aarch64.c (enum sched_fusion_type): New enum. >> (TARGET_SCHED_FUSION_PRIORITY): New hook. >> (fusion_load_store): New functon. >> (extract_base_offset_in_addr): New function. >> (aarch64_gen_adjusted_ldpstp): New function. >> (aarch64_sched_fusion_priority): New function. >> (aarch64_operands_ok_for_ldpstp): New function. >> (aarch64_operands_adjust_ok_for_ldpstp): New function. >> >> 2014-11-18 Bin Cheng >> >> * gcc.target/aarch64/ldp-stp-1.c: New test. >> * gcc.target/aarch64/ldp-stp-2.c: New test. >> * gcc.target/aarch64/ldp-stp-3.c: New test. >> * gcc.target/aarch64/ldp-stp-4.c: New test. >> * gcc.target/aarch64/ldp-stp-5.c: New test. >> * gcc.target/aarch64/lr_free_1.c: Disable scheduling fusion >> and peephole2 pass. > > Committed, thanks. /Marcus This patch has a bug in it dealing with volatile mems. It will do a peephole of two volatile mems into a pair which is not correct as the order in the architecture is not defined and might even swap the order of the load/store incorrectly. I noticed this when I was merging in my changes for an improved peephone which already has a check for volatile. Thanks, Andrew Pinski
Re: [PATCH AARCH64]load store pair optimization using sched_fusion pass.
On Sat, Dec 6, 2014 at 5:54 PM, Andrew Pinski wrote: > On Fri, Dec 5, 2014 at 9:08 AM, Marcus Shawcroft > wrote: >> On 18 November 2014 at 08:34, Bin Cheng wrote: >> >>> 2014-11-18 Bin Cheng >>> >>> * config/aarch64/aarch64.md (load_pair): Split to >>> load_pairsi, load_pairdi, load_pairsf and load_pairdf. >>> (load_pairsi, load_pairdi, load_pairsf, load_pairdf): Split >>> from load_pair. New alternative to support int/fp >>> registers in fp/int mode patterns. >>> (store_pair:): Split to store_pairsi, store_pairdi, >>> store_pairsf and store_pairdi. >>> (store_pairsi, store_pairdi, store_pairsf, store_pairdf): Split >>> from store_pair. New alternative to support int/fp >>> registers in fp/int mode patterns. >>> (*load_pair_extendsidi2_aarch64): New pattern. >>> (*load_pair_zero_extendsidi2_aarch64): New pattern. >>> (aarch64-ldpstp.md): Include. >>> * config/aarch64/aarch64-ldpstp.md: New file. >>> * config/aarch64/aarch64-protos.h (aarch64_gen_adjusted_ldpstp): >>> New. >>> (extract_base_offset_in_addr): New. >>> (aarch64_operands_ok_for_ldpstp): New. >>> (aarch64_operands_adjust_ok_for_ldpstp): New. >>> * config/aarch64/aarch64.c (enum sched_fusion_type): New enum. >>> (TARGET_SCHED_FUSION_PRIORITY): New hook. >>> (fusion_load_store): New functon. >>> (extract_base_offset_in_addr): New function. >>> (aarch64_gen_adjusted_ldpstp): New function. >>> (aarch64_sched_fusion_priority): New function. >>> (aarch64_operands_ok_for_ldpstp): New function. >>> (aarch64_operands_adjust_ok_for_ldpstp): New function. >>> >>> 2014-11-18 Bin Cheng >>> >>> * gcc.target/aarch64/ldp-stp-1.c: New test. >>> * gcc.target/aarch64/ldp-stp-2.c: New test. >>> * gcc.target/aarch64/ldp-stp-3.c: New test. >>> * gcc.target/aarch64/ldp-stp-4.c: New test. >>> * gcc.target/aarch64/ldp-stp-5.c: New test. >>> * gcc.target/aarch64/lr_free_1.c: Disable scheduling fusion >>> and peephole2 pass. >> >> Committed, thanks. /Marcus > > > This patch has a bug in it dealing with volatile mems. It will do a > peephole of two volatile mems into a pair which is not correct as the > order in the architecture is not defined and might even swap the order > of the load/store incorrectly. > I noticed this when I was merging in my changes for an improved > peephone which already has a check for volatile. Something like: @@ -10555,6 +10863,10 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load, reg_2 = operands[3]; } + /* The mems cannot be volatile. */ + if (MEM_VOLATILE_P (mem_1) || MEM_VOLATILE_P (mem_2)) +return false; + /* Check if the addresses are in the form of [base+offset]. */ extract_base_offset_in_addr (mem_1, &base_1, &offset_1); if (base_1 == NULL_RTX || offset_1 == NULL_RTX) CUT gcc.target/aarch64/rev16_1.c is the testcase where two volatile loads being merged into one load pair. Thanks, Andrew > > Thanks, > Andrew Pinski
Re: [patch v2, aarch64] additional bics patterns
On 12/04/2014 09:06 AM, Eric Botcazou wrote: 2014-11-19 Sandra Loosemore gcc/ * simplify-rtx.c (simplify_relational_operation_1): Handle simplification identities for BICS patterns. gcc/testsuite/ * gcc.target/aarch64/bics_4.c: New. OK for mainline, but there are trailing spaces in the patch. I'll fix that, but I don't see any point in committing this until Alex's AArch64 BICS patch is in. It doesn't look like it's been reviewed yet -- ping? https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00943.html -Sandra
Re: [PATCH] Fix PR 61225
On Fri, Dec 05, 2014 at 06:09:11PM -0600, Segher Boessenkool wrote: > On Fri, Dec 05, 2014 at 03:36:01PM -0700, Jeff Law wrote: > > Zhenqiang, can you look at what happens if you provide a pattern for > > 6+7+8 (probably via a define_and_split)? > > I tried this out yesterday. There are a few options (a bridge pattern > for 6+7+8, or one for 7+8). I went with 6+7+8. > > So the code combine is asked to optimise is > > 6 A = M > 7 T = A + B > 8 M = T > 9 C = cmp T, 0 ... and combine will never combine a write to memory (8 here) into a later insn (see can_combine_p). So this won't ever fly. I see no reasonably simple way combine can be convinced to do this. There are various possible schemes to pull insn 9 to before 8, but when does this help and when does it hurt? It all depends on the target :-( Segher
Re: Fix folding of EQ/NE_EXPR WRT symtab aliases
Hi, this is simplified patch that only adds the equal_address_to predicate (and thus fixes issues with inccorect folding of speculative calls). Hopefully it will mek it easier to handle the rest of fold-const incrementally. Bootstrapped/regtested x86_64-linux, comitted * symtab.c (symtab_node::equal_address_to): New function. * cgraph.h (symtab_node::equal_address_to): Declare. * fold-const.c (fold_comparison, fold_binary_loc): Use it. * c-family/c-common.c: Refuse weaks for symbols that can not change visibility. * gcc.dg/addr_equal-1.c: New testcase. Index: symtab.c === --- symtab.c(revision 218457) +++ symtab.c(working copy) @@ -1860,3 +1860,90 @@ symtab_node::nonzero_address () return true; return false; } + +/* Return 0 if symbol is known to have different address than S2, + Return 1 if symbol is known to have same address as S2, + return 2 otherwise. */ +int +symtab_node::equal_address_to (symtab_node *s2) +{ + enum availability avail1, avail2; + + /* A Shortcut: equivalent symbols are always equivalent. */ + if (this == s2) +return 1; + + /* For non-interposable aliases, lookup and compare their actual definitions. + Also check if the symbol needs to bind to given definition. */ + symtab_node *rs1 = ultimate_alias_target (&avail1); + symtab_node *rs2 = s2->ultimate_alias_target (&avail2); + bool binds_local1 = rs1->analyzed && decl_binds_to_current_def_p (this->decl); + bool binds_local2 = rs2->analyzed && decl_binds_to_current_def_p (s2->decl); + bool really_binds_local1 = binds_local1; + bool really_binds_local2 = binds_local2; + + /* Addresses of vtables and virtual functions can not be used by user + code and are used only within speculation. In this case we may make + symbol equivalent to its alias even if interposition may break this + rule. Doing so will allow us to turn speculative inlining into + non-speculative more agressively. */ + if (DECL_VIRTUAL_P (this->decl) && avail1 >= AVAIL_AVAILABLE) +binds_local1 = true; + if (DECL_VIRTUAL_P (s2->decl) && avail2 >= AVAIL_AVAILABLE) +binds_local2 = true; + + /* If both definitions are available we know that even if they are bound + to other unit they must be defined same way and therefore we can use + equivalence test. */ + if (rs1 != rs2 && avail1 >= AVAIL_AVAILABLE && avail2 >= AVAIL_AVAILABLE) +binds_local1 = binds_local2 = true; + + if ((binds_local1 ? rs1 : this) + == (binds_local2 ? rs2 : s2)) +{ + /* We made use of the fact that alias is not weak. */ + if (binds_local1 && rs1 != this) +refuse_visibility_changes = true; + if (binds_local2 && rs2 != s2) +s2->refuse_visibility_changes = true; + return 1; +} + + /* If both symbols may resolve to NULL, we can not really prove them different. */ + if (!nonzero_address () && !s2->nonzero_address ()) +return 2; + + /* Except for NULL, functions and variables never overlap. */ + if (TREE_CODE (decl) != TREE_CODE (s2->decl)) +return 0; + + /* If one of the symbols is unresolved alias, punt. */ + if (rs1->alias || rs2->alias) +return 2; + + /* If we have a non-interposale definition of at least one of the symbols + and the other symbol is different, we know other unit can not interpose + it to the first symbol; all aliases of the definition needs to be + present in the current unit. */ + if (((really_binds_local1 || really_binds_local2) + /* If we have both definitions and they are different, we know they +will be different even in units they binds to. */ + || (binds_local1 && binds_local2)) + && rs1 != rs2) +{ + /* We make use of the fact that one symbol is not alias of the other +and that the definition is non-interposable. */ + refuse_visibility_changes = true; + s2->refuse_visibility_changes = true; + rs1->refuse_visibility_changes = true; + rs2->refuse_visibility_changes = true; + return 0; +} + + /* TODO: Alias oracle basically assume that addresses of global variables + are different unless they are declared as alias of one to another. + We probably should be consistent and use this fact here, too, and update + alias oracle to use this predicate. */ + + return 2; +} Index: c-family/c-common.c === --- c-family/c-common.c (revision 218457) +++ c-family/c-common.c (working copy) @@ -7781,7 +7781,12 @@ handle_weak_attribute (tree *node, tree } else if (TREE_CODE (*node) == FUNCTION_DECL || TREE_CODE (*node) == VAR_DECL) -declare_weak (*node); +{ + struct symtab_node *n = symtab_node::get (*node); + if (n && n->refuse_visibility_changes) + error ("%+D declared weak after being used", *node); + declare_weak (*nod