Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
2011/3/14 Pedro Alves : > On Monday 14 March 2011 21:19:52, Kai Tietz wrote: >> @@ -1572,6 +1579,12 @@ get_file_realbasename (const input_file >> { >> const char *f = get_input_file_name (inpf); >> const char *lastslash = strrchr (f, '/'); >> +#ifdef HAVE_DOS_BASED_FILE_SYSTEM >> + const char *lastslash2 = strrchr (f, '\\'); >> + >> + if (!lastslash || (lastslash2 && lastslash2 > lastslash)) >> + lastslash = lastslash2; >> +#endif >> >> return (lastslash != NULL) ? lastslash + 1 : f; > > All of this is just > > return lbasename (get_input_file_name (inpf)); > > There are other similar cases in the patch. > > -- > Pedro Alves > Well, as I wrote in my initial mail, I am aware of this optimization. Anyway thanks for pointing to it. So here is the updated patch using lbasename in places suitable. Retested for x86_64-pc-linux-gnu and x86_64-w64-mingw32. Ok for apply? Kai Index: gcc/gcc/c-family/c-ada-spec.c === --- gcc.orig/gcc/c-family/c-ada-spec.c 2011-03-14 18:45:20.566392100 +0100 +++ gcc/gcc/c-family/c-ada-spec.c 2011-03-14 20:22:19.023299300 +0100 @@ -559,7 +559,8 @@ compare_comment (const void *lp, const v const cpp_comment *rhs = (const cpp_comment *) rp; if (LOCATION_FILE (lhs->sloc) != LOCATION_FILE (rhs->sloc)) -return strcmp (LOCATION_FILE (lhs->sloc), LOCATION_FILE (rhs->sloc)); +return filename_cmp (LOCATION_FILE (lhs->sloc), +LOCATION_FILE (rhs->sloc)); if (LOCATION_LINE (lhs->sloc) != LOCATION_LINE (rhs->sloc)) return LOCATION_LINE (lhs->sloc) - LOCATION_LINE (rhs->sloc); Index: gcc/gcc/collect2.c === --- gcc.orig/gcc/collect2.c 2011-03-14 18:45:20.567392100 +0100 +++ gcc/gcc/collect2.c 2011-03-15 07:57:54.540718100 +0100 @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. #include "system.h" #include "coretypes.h" #include "tm.h" +#include "filenames.h" /* TARGET_64BIT may be defined to use driver specific functionality. */ #undef TARGET_64BIT @@ -2314,12 +2315,8 @@ write_c_file_stat (FILE *stream, const c int frames = (frame_tables.number > 0); /* Figure out name of output_file, stripping off .so version. */ - p = strrchr (output_file, '/'); - if (p == 0) -p = output_file; - else -p++; - q = p; + q = p = lbasename (output_file); + while (q) { q = strchr (q,'.'); @@ -2330,7 +2327,7 @@ write_c_file_stat (FILE *stream, const c } else { - if (strncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0) + if (filename_ncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0) { q += strlen (SHLIB_SUFFIX); break; @@ -3192,10 +3189,10 @@ resolve_lib_name (const char *name) for (; list; list = list->next) { /* The following lines are needed because path_prefix list -may contain directories both with trailing '/' and +may contain directories both with trailing DIR_SEPARATOR and without it. */ const char *p = ""; - if (list->prefix[strlen(list->prefix)-1] != '/') + if (!IS_DIR_SEPARATOR (list->prefix[strlen(list->prefix)-1])) p = "/"; for (j = 0; j < 2; j++) { Index: gcc/gcc/coverage.c === --- gcc.orig/gcc/coverage.c 2011-03-14 18:45:20.569392100 +0100 +++ gcc/gcc/coverage.c 2011-03-14 18:45:52.497503800 +0100 @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. #include "tree-pass.h" #include "diagnostic-core.h" #include "intl.h" +#include "filenames.h" #include "gcov-io.c" @@ -982,7 +983,7 @@ coverage_init (const char *filename) /* + 1 for extra '/', in case prefix doesn't end with /. */ int prefix_len; - if (profile_data_prefix == 0 && filename[0] != '/') + if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH(&filename[0])) profile_data_prefix = getpwd (); prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0; Index: gcc/gcc/fortran/scanner.c === --- gcc.orig/gcc/fortran/scanner.c 2011-03-14 18:45:20.588392100 +0100 +++ gcc/gcc/fortran/scanner.c 2011-03-14 18:45:52.506505000 +0100 @@ -1754,7 +1754,7 @@ preprocessor_line (gfc_char_t *c) if (flag[2]) /* Ending current file. */ { if (!current_file->up - || strcmp (current_file->up->filename, filename) != 0) + || filename_cmp (current_file->up->filename, filename) != 0) { gfc_warning_now ("%s:%d: file %s left but not entered", current_file->filename, current_file->line, @@ -1774,7 +1774,7 @@ preprocessor_line (gfc_char_t *c) /* The name of the file can be a temporary file produced by cpp. Replace the name if it is different. */ - if (strcmp
Re: [PATCH: ARM] PR 45335 Use ldrd and strd to access two consecutive words
The trunk is opened again, could any maintainers continue to review this patch? thanks Carrot On Tue, Jan 18, 2011 at 10:59 PM, Carrot Wei wrote: > Ramana's method is to put the instruction output and counting in on place. > So it's easy to keep them synchronized. > > My latest version of patch did the following modifications compared to > the earlier version: Added support of arm ldrd/strd instructions. Added length > attribute to insn patterns. Moved the insn patterns to file ldmstm.md. > > It has passed the dejagnu testing on arm qemu. > > thanks > Carrot
Re: [PATCH v3] Re: avoid useless if-before-free tests
On Tue, Mar 8, 2011 at 19:53, Jim Meyering wrote: > Relative to v2, I've added libgo/ to the list of exempt directories and added > this recently discussed gfc_free patch, at the request of Tobias Burnus. > Also, I corrected an error in fortran's ChangeLog and removed all > whitespace changes from all ChangeLog files. The libgfortran changes are Ok for 4.7. For the gfortran frontend (gcc/fortran/*) I'd prefer if you'd - Replace all calls to "gfc_free (x)" with "free (x)". - Remove the gfc_free() function and prototype. - Remove the free() macro which currently prevents calling free() directly. > From 0d18b70a8821ab2fc58b5ed592ed611e05a29c7f Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Mon, 3 Jan 2011 16:52:37 +0100 > Subject: [PATCH 1/2] discourage unnecessary use of if before free > > * README.Portability: Explain why "if (P) free (P)" is best avoided. > --- > gcc/README.Portability | 23 --- > 1 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/gcc/README.Portability b/gcc/README.Portability > index 32a33e2..e099a3f 100644 > --- a/gcc/README.Portability > +++ b/gcc/README.Portability > @@ -51,14 +51,24 @@ foo (bar, ) > needs to be coded in some other way. > > > -free and realloc > - > +Avoid unnecessary test before free > +-- > > -Some implementations crash upon attempts to free or realloc the null > -pointer. Thus if mem might be null, you need to write > +Since SunOS 4 stopped being a reasonable portability target, > +(which happened around 2007) there has been no need to guard > +against "free (NULL)". Thus, any guard like the following > +constitutes a redundant test: > > - if (mem) > - free (mem); > + if (P) > + free (P); > + > +It is better to avoid the test.[*] > +Instead, simply free P, regardless of whether it is NULL. > + > +[*] However, if your profiling exposes a test like this in a > +performance-critical loop, say where P is nearly always NULL, and > +the cost of calling free on a NULL pointer would be prohibitively > +high, please let us know. Instead of "please let us know", maybe recommend using __builtin_expect instead? E.g. something like if (__builtin_expect (ptr != NULL, 0)) free (ptr); -- Janne Blomqvist
[libgfortran, build] Remove AC_TRY_* macros from libgfortran configury
Dear Fortran maintainers, dear autoconf gurus, The attached patch replaces the deprecated AC_TRY_{COMPILE,LINK,RUN} macros in libgfortran configury with their AC_*_IFELSE equivalents. Now (4.7 just branched) seems a good time, and I think I didn't screw it too much because the regenerated configure file only has whitespace changes. Still, I'd like to have the opinion of a build maintainer or autoconf guru. Bootstrapped and regtested on x86_64-darwin. OK to commit to trunk? ac_try.ChangeLog Description: Binary data ac_try.diff Description: Binary data
Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)
On Mon, 14 Mar 2011, Rainer Orth wrote: > Richard Guenther writes: > > >> > Can you update your patch with the tri-state solution? > >> > >> Sure if the solution is deemed acceptable. There isn't much point in > >> following that route if you see problems up front. > > > > If that solution avoids 3) then yes, I'm fine with going that route. > > Both 1) and 2) are very desirable anyway. > > Here's the updated patch, which also incorporates Paolo's suggestion. > Bootstrapped without regressions on i386-pc-solaris2.11 with Sun as/ld > and GNU as/ld 2.21. I couldn't really test the middle ground (gold 2.20 > with limited plugin support) since even mainline gold doesn't work for > me yet. What I've done is rebuild xgcc after manually changing > HAVE_LTO_PLUGIN to 1 in auto-host.h. After I realized that I needed to > remove the existing specs file, that variant worked as expected in that > -plugin is only passed to the linker with an explicit > -fuse-linker-plugin. > > I had to make a last-minute change when I realized that two other uses > of #ifdef HAVE_LTO_PLUGIN needed to be updated since that macro is now > always defined. I'm running fresh bootstraps to make sure nothing broke > that way. > > Ok for mainline if that passes, and perhaps also the 4.6 branch? I'm ok with this for mainline - Paolo, can you double-check the autofoo stuff? As for 4.6 I'd like to give it a day or two on trunk to allow people to report problems. Thanks, Richard. > Thanks. > Rainer > > > 2011-02-05 Rainer Orth > > PR lto/46944 > * configure.ac (gcc_cv_gld_major_version, gcc_cv_gld_minor): > Handle in-tree gold. > (ld_vers): Extract binutils version for gold. > (gcc_cv_ld_hidden): Handle gold here. > (gcc_cv_lto_plugin): Determine level of linker plugin support. > * configure: Regenerate. > * config.in: Regenerate. > * gcc.c: Only use LTO plugin if HAVE_LTO_PLUGIN > 0, reject > -fuse-linker-plugin otherwise. > (LINK_PLUGIN_SPEC): Define. Extract from LINK_COMMAND_SPEC. > (LINK_COMMAND_SPEC): Use it. > (main): Only look for LTOPLUGINSONAME if HAVE_LTO_PLUGIN > 0. > > diff -r 71f0a0dc3338 gcc/configure.ac > --- a/gcc/configure.acMon Mar 14 19:57:51 2011 +0100 > +++ b/gcc/configure.acMon Mar 14 19:59:05 2011 +0100 > @@ -1967,7 +1967,8 @@ > esac > > AC_MSG_CHECKING(what linker to use) > -if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then > +if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \ > + || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then > # Single tree build which includes ld. We want to prefer it > # over whatever linker top-level may have detected, since > # we'll use what we're building after installation anyway. > @@ -1978,6 +1979,8 @@ > || grep 'EMUL = .*linux' ../ld/Makefile \ > || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then > in_tree_ld_is_elf=yes > + elif test "$ld_is_gold" = yes; then > + in_tree_ld_is_elf=yes > fi > for f in $gcc_cv_ld_bfd_srcdir/configure > $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in > $gcc_cv_ld_gld_srcdir/Makefile.in > do > @@ -2192,11 +2195,23 @@ > changequote(,)dnl > if test $in_tree_ld != yes ; then >ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q` > - if test x"$ld_is_gold" = xyes; then > -gcc_cv_ld_hidden=yes > - elif echo "$ld_ver" | grep GNU > /dev/null; then > -ld_vers=`echo $ld_ver | sed -n \ > - -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` > + if echo "$ld_ver" | grep GNU > /dev/null; then > +if test x"$ld_is_gold" = xyes; then > + # GNU gold --version looks like this: > + # > + # GNU gold (GNU Binutils 2.21.51.20110225) 1.11 > + # > + # We extract the binutils version which is more familiar and specific > + # than the gold version. > + ld_vers=`echo $ld_ver | sed -n \ > + -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'` > +else > + # GNU ld --version looks like this: > + # > + # GNU ld (GNU Binutils) 2.21.51.20110225 > + ld_vers=`echo $ld_ver | sed -n \ > + -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` > +fi > ld_date=`echo $ld_ver | sed -n > 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` > ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` > ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` > @@ -2235,7 +2250,9 @@ >fi > else >gcc_cv_ld_hidden=yes > - if echo "$ld_ver" | grep GNU > /dev/null; then > + if test x"$ld_is_gold" = xyes; then > +: > + elif echo "$ld_ver" | grep GNU > /dev/null; then > if test 0"$ld_date" -lt 20020404; then >if test -n "$ld_date"; then > # If there was date string, but was earlier than 2002-04-04, fail > @@ -3173,23 +3190,27 @@ > fi > > AC_MSG_CHECKING(linker plugin support) > -gcc_cv_lto_plugi
Re: Add a testcase for reload PR 47166
Jakub Jelinek writes: > On Mon, Mar 14, 2011 at 12:34:16PM +0100, Richard Guenther wrote: >> On Mon, Mar 14, 2011 at 11:25 AM, Richard Sandiford >> wrote: >> > A reload patch that I posted in January: >> > >> > http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00548.html >> > >> > turned out to be related to PR 47166, so Bernd committed a combined fix: >> > >> > >> > http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01620.htmlhttp://gcc.gnu.org/ml/gcc-patches/2011-01/msg01620.html >> > >> > Is it OK to commit the testcase from the first patch to 4.5 and 4.6? >> >> Sure. > > Please commit also to 4.6 branch, you've just committed it to 4.5 and 4.7. Doh, bad timing. Now done. Richard
[PATCH] Fix PR48031
We shouldn't create new VLA array accesses via fold when we are in gimple form as we have no way to fixup the gimplified element size and minimal value slots. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk (I'll make my way backwards to the release branches after 4.6.0 is out). Tested on m68k by Mikael. Richard. 2011-03-15 Richard Guenther PR middle-end/48031 * fold-const.c (fold_indirect_ref_1): Do not create new variable-sized or variable-indexed array accesses when in gimple form. Index: gcc/fold-const.c === *** gcc/fold-const.c(revision 170876) --- gcc/fold-const.c(working copy) *** fold_indirect_ref_1 (location_t loc, tre *** 15554,15565 } /* *(foo *)&fooarray => fooarray[0] */ else if (TREE_CODE (optype) == ARRAY_TYPE ! && type == TREE_TYPE (optype)) { tree type_domain = TYPE_DOMAIN (optype); tree min_val = size_zero_node; if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); return build4_loc (loc, ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE); } --- 15560,15576 } /* *(foo *)&fooarray => fooarray[0] */ else if (TREE_CODE (optype) == ARRAY_TYPE ! && type == TREE_TYPE (optype) ! && (!in_gimple_form ! || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) { tree type_domain = TYPE_DOMAIN (optype); tree min_val = size_zero_node; if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); + if (in_gimple_form + && TREE_CODE (min_val) != INTEGER_CST) + return NULL_TREE; return build4_loc (loc, ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE); } *** fold_indirect_ref_1 (location_t loc, tre *** 15633,15639 /* *(foo *)fooarrptr => (*fooarrptr)[0] */ if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE ! && type == TREE_TYPE (TREE_TYPE (subtype))) { tree type_domain; tree min_val = size_zero_node; --- 15644,15652 /* *(foo *)fooarrptr => (*fooarrptr)[0] */ if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE ! && type == TREE_TYPE (TREE_TYPE (subtype)) ! && (!in_gimple_form ! || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) { tree type_domain; tree min_val = size_zero_node; *** fold_indirect_ref_1 (location_t loc, tre *** 15641,15646 --- 15654,15662 type_domain = TYPE_DOMAIN (TREE_TYPE (sub)); if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); + if (in_gimple_form + && TREE_CODE (min_val) != INTEGER_CST) + return NULL_TREE; return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE, NULL_TREE); }
Ping for two ARM patches
Now that GCC 4.7 is open, are these two ARM patches OK to commit? http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02266.html PR 47551: neon-related spill failure http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02284.html PR 47553: vld1q_lane_u8 & co. don't accept lanes >= 8 Thanks, Richard
Re: Fix for PR target/47951
On 03/14/2011 01:10 PM, Henderson, Stuart wrote: > Hi, The attached patch is an attempt to fix PR 47951, however I'm > fairly new to GCC and have little confidence in it. I've done some > testing with it and it avoids the problem and doesn't appear to cause > any new problems, but I'd appreciate more experienced eyes looking > over it and giving pointers. Thanks, Stu Looks ok. Bernd
[PATCH gcc/fortran] get rid of gfc_free
Janne Blomqvist wrote: > On Tue, Mar 8, 2011 at 19:53, Jim Meyering wrote: >> Relative to v2, I've added libgo/ to the list of exempt directories and added >> this recently discussed gfc_free patch, at the request of Tobias Burnus. >> Also, I corrected an error in fortran's ChangeLog and removed all >> whitespace changes from all ChangeLog files. > > The libgfortran changes are Ok for 4.7. > > For the gfortran frontend (gcc/fortran/*) I'd prefer if you'd > > - Replace all calls to "gfc_free (x)" with "free (x)". > - Remove the gfc_free() function and prototype. > - Remove the free() macro which currently prevents calling free() directly. Hi Janne, These requested changes are in addition to (and independent of) the changes that I've already posted here. The first cset below does your #2 and #3, and the second does #1. I separate them for review because #1 is completely mechanical, while the others are manual. You may prefer to combine them before pushing, for bisection. Let me know if you'd prefer I submit in that form. ... >> +It is better to avoid the test.[*] >> +Instead, simply free P, regardless of whether it is NULL. >> + >> +[*] However, if your profiling exposes a test like this in a >> +performance-critical loop, say where P is nearly always NULL, and >> +the cost of calling free on a NULL pointer would be prohibitively >> +high, please let us know. > > Instead of "please let us know", maybe recommend using > __builtin_expect instead? E.g. something like > > if (__builtin_expect (ptr != NULL, 0)) > free (ptr); Good idea. Thanks. Though how about avoiding the double negative? if (__builtin_expect (ptr == NULL, 1)) free (ptr); I've squashed the following onto my just-rebased commit: diff --git a/gcc/README.Portability b/gcc/README.Portability index e099a3f..4101a2f 100644 --- a/gcc/README.Portability +++ b/gcc/README.Portability @@ -68,7 +68,11 @@ Instead, simply free P, regardless of whether it is NULL. [*] However, if your profiling exposes a test like this in a performance-critical loop, say where P is nearly always NULL, and the cost of calling free on a NULL pointer would be prohibitively -high, please let us know. +high, consider using __builtin_expect, e.g., like this: + + if (__builtin_expect (ptr == NULL, 1)) +free (ptr); + Trigraphs - >From c198b77add6d587cbe87f2d86049c46196946398 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 15 Mar 2011 10:33:03 +0100 Subject: [PATCH 1/2] gfortran: remove definition and prototype of gfc_free * misc.c (gfc_free): Remove function. * gfortran.h (gfc_free): Remove its prototype. (free): Remove macro definition that would otherwise prevent direct use of the function. --- gcc/fortran/ChangeLog |7 +++ gcc/fortran/gfortran.h |2 -- gcc/fortran/misc.c |9 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1871c71..bc2e1b2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2011-03-15 Jim Meyering + + * misc.c (gfc_free): Remove function. + * gfortran.h (gfc_free): Remove its prototype. + (free): Remove macro definition that would otherwise prevent + direct use of the function. + 2011-03-08 Jim Meyering * gfortranspec.c (lang_specific_pre_link): Remove useless diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index b64fa20..24d1941 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -49,7 +49,6 @@ along with GCC; see the file COPYING3. If not see #define MAX_SUBRECORD_LENGTH 2147483639 /* 2**31-9 */ -#define free(x) Use_gfc_free_instead_of_free() #define gfc_is_whitespace(c) ((c==' ') || (c=='\t')) /* Stringization. */ @@ -2366,7 +2365,6 @@ void gfc_end_source_files (void); /* misc.c */ void *gfc_getmem (size_t) ATTRIBUTE_MALLOC; -void gfc_free (void *); int gfc_terminal_width (void); void gfc_clear_ts (gfc_typespec *); FILE *gfc_open_file (const char *); diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c index 8a343a0..9d7d121 100644 --- a/gcc/fortran/misc.c +++ b/gcc/fortran/misc.c @@ -42,15 +42,6 @@ gfc_getmem (size_t n) } -void -gfc_free (void *p) -{ - /* The parentheses around free are needed in order to call not - the redefined free of gfortran.h. */ - (free) (p); -} - - /* Get terminal width. */ int -- 1.7.4.1.408.gb6b16 >From 51ec56ecddf38589511502c58d75e1680e5a17e2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 15 Mar 2011 10:37:17 +0100 Subject: [PATCH 2/2] convert each use of gfc_free (p) to free (p) Do that by running this command: perl -pi -e's/\bgfc_free ?\(/free (/' \ $(git grep -El '\bgfc_free ?\(') which also corrects the few uses that lacked a space between the function name and the open parenthesis. --- gcc/fortran/ChangeLog |7 + gcc/fortran/array.c |4 +- gcc/fortran/const
Re: [PATCH gcc/fortran] get rid of gfc_free
On Tue, Mar 15, 2011 at 11:02:38AM +0100, Jim Meyering wrote: > > Instead of "please let us know", maybe recommend using > > __builtin_expect instead? E.g. something like > > > > if (__builtin_expect (ptr != NULL, 0)) > > free (ptr); > > Good idea. Thanks. > Though how about avoiding the double negative? > >if (__builtin_expect (ptr == NULL, 1)) > free (ptr); What double negative? if (__builtin_expect (ptr != NULL, 0)) free (ptr); is certainly correct, the latter is wrong, it will leak memory. It will call free only if ptr is NULL, i.e. do a useless free (NULL), if it is non-NULL, it will not do anything. You could do if (!__builtin_expect (ptr == NULL, 1)) free (ptr); but that doesn't seem to be nicer or clearer than if (__builtin_expect (ptr != NULL, 0)) free (ptr); Jakub
Re: [PATCH gcc/fortran] get rid of gfc_free
Jakub Jelinek wrote: > On Tue, Mar 15, 2011 at 11:02:38AM +0100, Jim Meyering wrote: >> > Instead of "please let us know", maybe recommend using >> > __builtin_expect instead? E.g. something like >> > >> > if (__builtin_expect (ptr != NULL, 0)) >> > free (ptr); >> >> Good idea. Thanks. >> Though how about avoiding the double negative? >> >>if (__builtin_expect (ptr == NULL, 1)) >> free (ptr); > > What double negative? if (__builtin_expect (ptr != NULL, 0)) free (ptr); > is certainly correct, the latter is wrong, it will leak memory. > It will call free only if ptr is NULL, i.e. do a useless free (NULL), > if it is non-NULL, it will not do anything. > You could do > if (!__builtin_expect (ptr == NULL, 1)) > free (ptr); > but that doesn't seem to be nicer or clearer than > if (__builtin_expect (ptr != NULL, 0)) > free (ptr); Thanks for the quick correction. I've fixed it locally, too.
[PATCH] Fix PR41490
This fixes store-sinking (finally, broken since alias-improvements merge). To work reliably this adds an unconditional VUSE to all return statements. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-03-15 Richard Guenther PR tree-optimization/41490 * tree-ssa-dce.c (propagate_necessity): Handle returns without value but with VUSE. * tree-ssa-operands.c (parse_ssa_operands): Add a VUSE on all return statements. * tree-ssa-sink.c (statement_sink_location): Fix store sinking. * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Handle virtual PHIs. * tree-tailcall.c (find_tail_calls): Ignore returns. * gcc.dg/tree-ssa/ssa-sink-6.c: New testcase. * gcc.dg/tree-ssa/ssa-sink-7.c: Likewise. * gcc.dg/tree-ssa/ssa-sink-8.c: Likewise. * gcc.dg/tree-ssa/ssa-sink-9.c: Likewise. * g++.dg/tree-ssa/pr33604.C: Adjust. Index: gcc/tree-ssa-dce.c === *** gcc/tree-ssa-dce.c.orig 2011-03-09 17:57:48.0 +0100 --- gcc/tree-ssa-dce.c 2011-03-09 18:03:30.0 +0100 *** propagate_necessity (struct edge_list *e *** 869,875 { tree rhs = gimple_return_retval (stmt); /* A return statement may perform a load. */ ! if (TREE_CODE (rhs) != SSA_NAME && !is_gimple_min_invariant (rhs)) { if (!ref_may_be_aliased (rhs)) --- 869,876 { tree rhs = gimple_return_retval (stmt); /* A return statement may perform a load. */ ! if (rhs ! && TREE_CODE (rhs) != SSA_NAME && !is_gimple_min_invariant (rhs)) { if (!ref_may_be_aliased (rhs)) Index: gcc/tree-ssa-operands.c === *** gcc/tree-ssa-operands.c.orig2011-03-09 17:57:48.0 +0100 --- gcc/tree-ssa-operands.c 2011-03-09 18:03:30.0 +0100 *** parse_ssa_operands (gimple stmt) *** 1065,1070 --- 1065,1073 /* Add call-clobbered operands, if needed. */ if (code == GIMPLE_CALL) maybe_add_call_vops (stmt); + + if (code == GIMPLE_RETURN) + append_vuse (gimple_vop (cfun)); } } Index: gcc/tree-ssa-sink.c === *** gcc/tree-ssa-sink.c.orig2011-03-09 17:57:48.0 +0100 --- gcc/tree-ssa-sink.c 2011-03-09 18:03:30.0 +0100 *** statement_sink_location (gimple stmt, ba *** 268,274 gimple_stmt_iterator *togsi) { gimple use; - tree def; use_operand_p one_use = NULL_USE_OPERAND_P; basic_block sinkbb; use_operand_p use_p; --- 268,273 *** statement_sink_location (gimple stmt, ba *** 276,299 ssa_op_iter iter; imm_use_iterator imm_iter; ! FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS) ! { ! FOR_EACH_IMM_USE_FAST (one_use, imm_iter, def) ! { ! if (is_gimple_debug (USE_STMT (one_use))) ! continue; ! ! break; ! } ! if (one_use != NULL_USE_OPERAND_P) ! break; ! } ! /* Return if there are no immediate uses of this stmt. */ ! if (one_use == NULL_USE_OPERAND_P) return false; ! if (gimple_code (stmt) != GIMPLE_ASSIGN) return false; /* There are a few classes of things we can't or don't move, some because we --- 275,291 ssa_op_iter iter; imm_use_iterator imm_iter; ! /* We only can sink assignments. */ ! if (!is_gimple_assign (stmt)) ! return false; ! /* We only can sink stmts with a single definition. */ ! def_p = single_ssa_def_operand (stmt, SSA_OP_ALL_DEFS); ! if (def_p == NULL_DEF_OPERAND_P) return false; ! /* Return if there are no immediate uses of this stmt. */ ! if (has_zero_uses (DEF_FROM_PTR (def_p))) return false; /* There are a few classes of things we can't or don't move, some because we *** statement_sink_location (gimple stmt, ba *** 323,342 */ if (stmt_ends_bb_p (stmt) || gimple_has_side_effects (stmt) - || is_hidden_global_store (stmt) || gimple_has_volatile_ops (stmt) ! || gimple_vuse (stmt) || (cfun->has_local_explicit_reg_vars && TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))) == BLKmode)) return false; ! FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS) ! { ! tree def = DEF_FROM_PTR (def_p); ! if (is_global_var (SSA_NAME_VAR (def)) ! || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def)) ! return false; ! } FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) { --- 315,328 */ if (stmt_ends_bb_p (stmt)
[PATCH] Updated DW_OP_GNU_entry_value/DW_TAG_GNU_call_site patch
Hi! Now that we are back in stage 1, I'd like move on with the entry_value/call_site debug info extensions. Here is the http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01793.html patch updated to current trunk, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for trunk? 2011-03-15 Jakub Jelinek * final.c (final_scan_insn): Handle NOTE_INSN_CALL_ARG_LOCATION. Call var_location debug hook even on CALL_INSNs. (rest_of_clean_state): Don't print NOTE_INSN_CALL_ARG_LOCATION. * rtl.def (ENTRY_VALUE): New. * dwarf2out.c: Include cfglayout.h. (dwarf_stack_op_name, size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Handle DW_OP_GNU_entry_value. (struct call_arg_loc_node): New type. (call_arg_locations, call_arg_loc_last, block_map, call_site_count, tail_call_site_count): New variables. (dwarf_tag_name): Handle DW_TAG_GNU_call_site and DW_TAG_GNU_call_site_parameter. (dwarf_attr_name): Handle DW_AT_GNU_call_site_value, DW_AT_GNU_call_site_data_value, DW_AT_GNU_call_site_target, DW_AT_GNU_call_site_target_clobbered, DW_AT_GNU_tail_call, DW_AT_GNU_all_tail_call_sites, DW_AT_GNU_all_call_sites and DW_AT_GNU_all_source_call_sites. (mem_loc_descriptor): Handle ENTRY_VALUE. (add_src_coords_attributes): Don't add enything if DECL_SOURCE_LOCATION is UNKNOWN_LOCATION. (dwarf2out_abstract_function): Save and clear call_arg_location, call_site_count and tail_call_site_count around dwarf2out_decl call. (gen_call_site_die): New function. (gen_subprogram_die): Emit DW_TAG_GNU_call_site DIEs for call sites. (gen_lexical_block_die, gen_inlined_subroutine_die): Update block_map. (dwarf2out_function_decl): Clear call_arg_locations, call_arg_loc_last, set call_site_count and tail_call_site_count to -1 and free block_map. (dwarf2out_var_location): Handle NOTE_INSN_CALL_ARG_LOCATION and CALL_INSNs. Add NOTE_DURING_CALL_P var location notes even when not followed by any real instructions. (dwarf2out_begin_function): Set call_site_count and tail_call_site_count to 0. (resolve_addr): If DW_AT_abstract_origin of DW_TAG_GNU_call_site is dw_val_class_addr, attempt to look it up again, for DECL_EXTERNAL attempt to force a DIE for it and worst case remove the attribute. (resolve_one_addr): For TREE_CONSTANT_POOL_ADDRESS_P SYMBOL_REFs check TREE_ASM_WRITTEN of DECL_INITIAL of the decl instead of the decl itself. * var-tracking.c: Include tm_p.h. (vt_stack_adjustments): For calls call note_register_arguments. (argument_reg_set): New variable. (add_stores): For MO_VAL_SET of non-tracked regs from argument_reg_set ensure the VALUE is resolved. (call_arguments): New variable. (prepare_call_arguments): New function. (add_with_sets): For MO_CALL set u.loc from call_arguments and clear it. (struct expand_loc_callback_data): Add ignore_cur_loc field. (vt_expand_loc_callback): If ignore_cur_loc, don't look at cur_loc and always use the best expression. (vt_expand_loc): Add ignore_cur_loc argument. (vt_expand_loc_dummy): Clear ignore_cur_loc field. (emit_note_insn_var_location): Adjust vt_expand_loc callers. (emit_notes_in_bb) : Add NOTE_INSN_CALL_ARG_LOCATION note for all calls. (vt_add_function_parameter): Use cselib_lookup_from_insn. If dv is a VALUE, enter into hash table also ENTRY_VALUE for the argument. Don't call cselib_preserve_only_values and cselib_reset_table. (note_register_arguments): New function. (vt_initialize): Compute argument_reg_set. Call vt_add_function_parameters before processing basic blocks instead of afterwards. For calls call prepare_call_arguments before calling cselib_process_insn. * print-rtl.c (print_rtx): Handle NOTE_INSN_CALL_ARG_LOCATION. * Makefile.in (dwarf2out.o): Depend on $(CFGLAYOUT_H). (var-tracking.o): Depend on $(TM_P_H). * cfglayout.h (insn_scope): New prototype. * gengtype.c (adjust_field_rtx_def): Handle NOTE_INSN_CALL_ARG_LOCATION. * cfglayout.c (insn_scope): No longer static. * insn-notes.def (CALL_ARG_LOCATION): New. * calls.c (expand_call, emit_library_call_value_1): Put USEs for MEM arguments into CALL_INSN_FUNCTION_USAGE unconditionally. * integrate.c (set_block_origin_self, set_block_abstract_flags): Do nothing for DECL_EXTERNAL BLOCK_VARS. cp/ * cp-objcp-common.c (cp_function_decl_explicit_p): Don't crash if DECL_LANG_SPECIFIC is NULL. include/ * dwarf2.h (DW_TAG_GNU_call_site, DW_TAG_GNU_call_site_parameter, DW_AT_GNU_call_site_value, DW_AT_GNU_call
[PATCH] Updated ENTRY_VALUE patch (PR debug/45882)
Hi! Here is http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01794.html patch updated to current trunk, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-03-15 Jakub Jelinek PR debug/45882 * rtl.def (ENTRY_VALUE): Change format from "e" to "0". * rtl.h (ENTRY_VALUE_EXP): Define. * rtl.c (rtx_equal_p_cb, rtx_equal_p): Handle ENTRY_VALUE. * cselib.c (rtx_equal_for_cselib_p, cselib_hash_rtx): Likewise. * print-rtl.c (print_rtx): Likewise. * gengtype.c (adjust_field_rtx_def): Likewise. * var-tracking.c (vt_add_function_parameter): Adjust gen_rtx_ENTRY_VALUE uses, use ENTRY_VALUE_EXP macro. * dwarf2out.c (mem_loc_descriptor): Use ENTRY_VALUE_EXP macro. * cfgexpand.c (expand_debug_expr): If a SSA_NAME without partition is a default definition of a PARM_DECL, use ENTRY_VALUE of its DECL_INCOMING_RTL if possible, or its DECL_RTL if set. * gcc.dg/guality/pr45882.c: New test. --- gcc/rtl.def.jj 2011-03-14 21:33:35.972415549 +0100 +++ gcc/rtl.def 2011-03-14 21:42:32.655765178 +0100 @@ -718,9 +718,10 @@ DEF_RTL_EXPR(VAR_LOCATION, "var_location addressable. */ DEF_RTL_EXPR(DEBUG_IMPLICIT_PTR, "debug_implicit_ptr", "t", RTX_OBJ) -/* Represents value that argument had on function entry. Should - be only used in VAR_LOCATION location expression. */ -DEF_RTL_EXPR(ENTRY_VALUE, "entry_value", "e", RTX_OBJ) +/* Represents value that argument had on function entry. The + single argument is the DECL_INCOMING_RTL of the corresponding + parameter. */ +DEF_RTL_EXPR(ENTRY_VALUE, "entry_value", "0", RTX_OBJ) /* All expressions from this point forward appear only in machine descriptions. */ --- gcc/rtl.h.jj2011-03-09 21:48:04.979397210 +0100 +++ gcc/rtl.h 2011-03-14 21:42:32.656772047 +0100 @@ -833,6 +833,10 @@ extern void rtl_check_failed_flag (const but a value from enum reg_note. */ #define REG_NOTES(INSN)XEXP(INSN, 7) +/* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in + question. */ +#define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx) + enum reg_note { #define DEF_REG_NOTE(NAME) NAME, --- gcc/rtl.c.jj2011-01-03 19:07:36.630851160 +0100 +++ gcc/rtl.c 2011-03-14 21:42:32.674429322 +0100 @@ -412,6 +412,9 @@ rtx_equal_p_cb (const_rtx x, const_rtx y return DEBUG_IMPLICIT_PTR_DECL (x) == DEBUG_IMPLICIT_PTR_DECL (y); +case ENTRY_VALUE: + return rtx_equal_p_cb (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), cb); + default: break; } @@ -544,6 +547,9 @@ rtx_equal_p (const_rtx x, const_rtx y) return DEBUG_IMPLICIT_PTR_DECL (x) == DEBUG_IMPLICIT_PTR_DECL (y); +case ENTRY_VALUE: + return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y)); + default: break; } --- gcc/cselib.c.jj 2011-02-03 09:24:31.398430054 +0100 +++ gcc/cselib.c2011-03-14 21:45:55.772433278 +0100 @@ -803,6 +803,10 @@ rtx_equal_for_cselib_1 (rtx x, rtx y, en return DEBUG_IMPLICIT_PTR_DECL (x) == DEBUG_IMPLICIT_PTR_DECL (y); +case ENTRY_VALUE: + return rtx_equal_for_cselib_1 (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), +memmode); + case LABEL_REF: return XEXP (x, 0) == XEXP (y, 0); @@ -949,6 +953,10 @@ cselib_hash_rtx (rtx x, int create, enum + DECL_UID (DEBUG_IMPLICIT_PTR_DECL (x)); return hash ? hash : (unsigned int) DEBUG_IMPLICIT_PTR; +case ENTRY_VALUE: + hash += cselib_hash_rtx (ENTRY_VALUE_EXP (x), create, memmode); + return hash ? hash : (unsigned int) ENTRY_VALUE; + case CONST_INT: hash += ((unsigned) CONST_INT << 7) + INTVAL (x); return hash ? hash : (unsigned int) CONST_INT; --- gcc/print-rtl.c.jj 2011-03-14 21:33:35.971538442 +0100 +++ gcc/print-rtl.c 2011-03-14 21:42:32.684424732 +0100 @@ -334,6 +334,14 @@ print_rtx (const_rtx in_rtx) DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (in_rtx))); #endif } + else if (i == 0 && GET_CODE (in_rtx) == ENTRY_VALUE) + { + indent += 2; + if (!sawclose) + fprintf (outfile, " "); + print_rtx (ENTRY_VALUE_EXP (in_rtx)); + indent -= 2; + } break; case 'e': --- gcc/gengtype.c.jj 2011-03-14 21:33:36.104545651 +0100 +++ gcc/gengtype.c 2011-03-14 21:42:32.686420691 +0100 @@ -1101,6 +1101,8 @@ adjust_field_rtx_def (type_p t, options_ t = symbol_union_tp, subname = ""; else if (i == BARRIER && aindex >= 3) t = scalar_tp, subname = "rt_int"; + else if (i == ENTRY_VALUE && aindex == 0) + t = rtx_tp, subname = "rt_rtx"; else { error_at_line --- gcc/var-tracking.c.jj 2011-03-14 21:39:25.094546525 +0100 +++ g
[PATCH] Adjustment to DW_TAG_GNU_call_site patch for ICF debug
Hi! Here is the http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01795.html patch updated to current trunk, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for trunk? 2011-03-15 Jakub Jelinek * calls.c (emit_call_1): Set MEM_EXPR on call's MEM. * var-tracking.c (prepare_call_arguments): Use MEM_EXPR on call's MEM. Handle functions returning aggregate through a hidden first pointer. For virtual calls add clobbered pc to call arguments chain. * dwarf2out.c (gen_subprogram_die): Emit DW_AT_GNU_call_site_target_clobbered if DW_AT_GNU_call_site_target can't be emitted. --- gcc/calls.c.jj 2010-12-22 10:17:25.0 +0100 +++ gcc/calls.c 2010-12-22 14:09:52.0 +0100 @@ -256,7 +256,7 @@ emit_call_1 (rtx funexp, tree fntree ATT CUMULATIVE_ARGS *args_so_far ATTRIBUTE_UNUSED) { rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size); - rtx call_insn; + rtx call_insn, call, funmem; int already_popped = 0; HOST_WIDE_INT n_popped = targetm.calls.return_pops_args (fndecl, funtype, stack_size); @@ -271,6 +271,12 @@ emit_call_1 (rtx funexp, tree fntree ATT if (GET_CODE (funexp) != SYMBOL_REF) funexp = memory_address (FUNCTION_MODE, funexp); + funmem = gen_rtx_MEM (FUNCTION_MODE, funexp); + if (fndecl && TREE_CODE (fndecl) == FUNCTION_DECL) +set_mem_expr (funmem, fndecl); + else if (fntree) +set_mem_expr (funmem, build_fold_indirect_ref (CALL_EXPR_FN (fntree))); + #if defined (HAVE_sibcall_pop) && defined (HAVE_sibcall_value_pop) if ((ecf_flags & ECF_SIBCALL) && HAVE_sibcall_pop && HAVE_sibcall_value_pop @@ -283,13 +289,11 @@ emit_call_1 (rtx funexp, tree fntree ATT if possible, for the sake of frame pointer elimination. */ if (valreg) - pat = GEN_SIBCALL_VALUE_POP (valreg, -gen_rtx_MEM (FUNCTION_MODE, funexp), -rounded_stack_size_rtx, next_arg_reg, -n_pop); + pat = GEN_SIBCALL_VALUE_POP (valreg, funmem, rounded_stack_size_rtx, +next_arg_reg, n_pop); else - pat = GEN_SIBCALL_POP (gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, n_pop); + pat = GEN_SIBCALL_POP (funmem, rounded_stack_size_rtx, next_arg_reg, + n_pop); emit_call_insn (pat); already_popped = 1; @@ -316,12 +320,11 @@ emit_call_1 (rtx funexp, tree fntree ATT if possible, for the sake of frame pointer elimination. */ if (valreg) - pat = GEN_CALL_VALUE_POP (valreg, - gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, n_pop); + pat = GEN_CALL_VALUE_POP (valreg, funmem, rounded_stack_size_rtx, + next_arg_reg, n_pop); else - pat = GEN_CALL_POP (gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, n_pop); + pat = GEN_CALL_POP (funmem, rounded_stack_size_rtx, next_arg_reg, + n_pop); emit_call_insn (pat); already_popped = 1; @@ -334,13 +337,12 @@ emit_call_1 (rtx funexp, tree fntree ATT && HAVE_sibcall && HAVE_sibcall_value) { if (valreg) - emit_call_insn (GEN_SIBCALL_VALUE (valreg, - gen_rtx_MEM (FUNCTION_MODE, funexp), + emit_call_insn (GEN_SIBCALL_VALUE (valreg, funmem, rounded_stack_size_rtx, next_arg_reg, NULL_RTX)); else - emit_call_insn (GEN_SIBCALL (gen_rtx_MEM (FUNCTION_MODE, funexp), -rounded_stack_size_rtx, next_arg_reg, + emit_call_insn (GEN_SIBCALL (funmem, rounded_stack_size_rtx, +next_arg_reg, GEN_INT (struct_value_size))); } else @@ -350,13 +352,10 @@ emit_call_1 (rtx funexp, tree fntree ATT if (HAVE_call && HAVE_call_value) { if (valreg) - emit_call_insn (GEN_CALL_VALUE (valreg, - gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, - NULL_RTX)); + emit_call_insn (GEN_CALL_VALUE (valreg, funmem, rounded_stack_size_rtx, + next_arg_reg, NULL_RTX)); else - emit_call_insn (GEN_CALL (gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, + emit_call_insn (GEN_CALL (funmem, rounded_stack_size_rtx, next_arg_reg, GEN_INT (struct_value_size))); } else @@ -366
[PATCH] Remove -fenable-icf-debug support
Hi! As Cary said there are no consumers of the .debug_dcall/.debug_vcall sections yet and DW_TAG_GNU_call_site info should contain a superset of that information, this patch removes -fenable-icf-debug support, if you think it is desirable to remove it. Bootstrapped/regtested on x86_64-linux and i686-linux. 2011-03-15 Jakub Jelinek * emit-rtl.c (try_split): Don't call copy_call_info debug hook. * calls.c: Remove debug.h include. (emit_call_1): Don't call virtual_call_token debug hook. * dwarf2out.c (debug_dcall_section, debug_vcall_section, dcall_entry, vcall_entry, dcall_table, vcall_table, vcall_insn, vcall_insn_table, DEBUG_DCALL_SECTION, DEBUG_VCALL_SECTION, size_of_dcall_table, output_dcall_table, size_of_vcall_table, output_vcall_table, dwarf2out_direct_call, vcall_insn_table_hash, vcall_insn_table_eq, store_vcall_insn, lookup_vcall_insn, dwarf2out_virtual_call_token, dwarf2out_copy_call_info, dwarf2out_virtual_call): Remove. (dwarf2_debug_hooks): Remove direct_call, virtual_call_token, copy_call_info and virtual_call hooks. (dwarf2out_init): Don't initialize vcall_insn_table, debug_dcall_section and debug_vcall_section. (prune_unused_types): Don't mark nodes from dcall_table. (dwarf2out_finish): Don't output dcall or vcall tables. * final.c (final_scan_insn): Don't call direct_call or virtual_call debug hooks. * debug.h (struct gcc_debug_hooks): Remove direct_call, virtual_call_token, copy_call_info and virtual_call hooks. (debug_nothing_uid): Remove prototype. * sdbout.c (sdb_debug_hooks): Remove direct_call, virtual_call_token, copy_call_info and virtual_call hooks. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise. * debug.c (do_nothing_debug_hooks): Likewise. (debug_nothing_uid): Remove. * doc/invoke.texi (-fenable-icf-debug): Remove. * common.opt (-fenable-icf-debug): Likewise. * g++.dg/debug/dwarf2/icf.C: Adjust for -fenable-icf-debug removal. --- gcc/emit-rtl.c.jj 2011-01-26 14:07:50.0 +0100 +++ gcc/emit-rtl.c 2011-03-15 09:03:55.884620786 +0100 @@ -3477,10 +3477,6 @@ try_split (rtx pat, rtx trial, int last) p = &XEXP (*p, 1); *p = CALL_INSN_FUNCTION_USAGE (trial); SIBLING_CALL_P (insn) = SIBLING_CALL_P (trial); - - /* Update the debug information for the CALL_INSN. */ - if (flag_enable_icf_debug) - (*debug_hooks->copy_call_info) (trial, insn); } } --- gcc/calls.c.jj 2011-03-14 21:49:08.0 +0100 +++ gcc/calls.c 2011-03-15 09:03:01.285671437 +0100 @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. #include "sbitmap.h" #include "langhooks.h" #include "target.h" -#include "debug.h" #include "cgraph.h" #include "except.h" #include "dbgcnt.h" @@ -407,11 +406,6 @@ emit_call_1 (rtx funexp, tree fntree ATT SIBLING_CALL_P (call_insn) = ((ecf_flags & ECF_SIBCALL) != 0); - /* Record debug information for virtual calls. */ - if (flag_enable_icf_debug && fndecl == NULL) -(*debug_hooks->virtual_call_token) (CALL_EXPR_FN (fntree), -INSN_UID (call_insn)); - /* Restore this now, so that we do defer pops for this call's args if the context of the call as a whole permits. */ inhibit_defer_pop = old_inhibit_defer_pop; --- gcc/dwarf2out.c.jj 2011-03-14 21:55:15.0 +0100 +++ gcc/dwarf2out.c 2011-03-15 09:33:43.256799916 +0100 @@ -228,8 +228,6 @@ static GTY(()) section *debug_line_secti static GTY(()) section *debug_loc_section; static GTY(()) section *debug_pubnames_section; static GTY(()) section *debug_pubtypes_section; -static GTY(()) section *debug_dcall_section; -static GTY(()) section *debug_vcall_section; static GTY(()) section *debug_str_section; static GTY(()) section *debug_ranges_section; static GTY(()) section *debug_frame_section; @@ -5774,10 +5772,6 @@ static void dwarf2out_imported_module_or dw_die_ref); static void dwarf2out_abstract_function (tree); static void dwarf2out_var_location (rtx); -static void dwarf2out_direct_call (tree); -static void dwarf2out_virtual_call_token (tree, int); -static void dwarf2out_copy_call_info (rtx, rtx); -static void dwarf2out_virtual_call (int); static void dwarf2out_begin_function (tree); static void dwarf2out_set_name (tree, tree); @@ -5820,10 +5814,6 @@ const struct gcc_debug_hooks dwarf2_debu debug_nothing_int, /* handle_pch */ dwarf2out_var_location, dwarf2out_switch_text_section, - dwarf2out_direct_call, - dwarf2out_virtual_call_token, - dwarf2out_copy_call_info, - dwarf2out_virtual_call, dwarf2out_set_name, 1,/* start_end_main_source_f
[v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
I think we agreed that it would be useful to regenerate the Solaris 2 libstdc++ baselines close to the GCC 4.6.0 release, especially given that symbol versioning on Solaris appears in 4.6.0 for the first time and several symbols have been added to the libstdc++.so ABI since the last update. This patch does exactly that. It is based on make new-abi-baseline output across all of Solaris 8 to 11, both SPARC and x86. I'm currently re-running bootstraps on all of them on both mainline and the 4.6 branch. I'm only including one diff below, the others are identical (modulo object sizes for the 64-bit ABIs). The following functions/variables were added since the last update: FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15 FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15 FUNC:std::regex_error::~regex_error()@@GLIBCXX_3.4.15 FUNC:std::bad_function_call::~bad_function_call()@@CXXABI_1.3.5 FUNC:std::bad_function_call::~bad_function_call()@@CXXABI_1.3.5 FUNC:std::__detail::_List_node_base::_M_reverse()@@GLIBCXX_3.4.15 FUNC:std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)@@GLIBCXX_3.4.15 FUNC:std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)@@GLIBCXX_3.4.15 FUNC:std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)@@GLIBCXX_3.4.15 FUNC:std::__detail::_List_node_base::_M_unhook()@@GLIBCXX_3.4.15 FUNC:std::__throw_regex_error(std::regex_constants::error_type)@@GLIBCXX_3.4.15 OBJECT:12:typeinfo for std::regex_error@@GLIBCXX_3.4.15 OBJECT:12:typeinfo for std::bad_function_call@@CXXABI_1.3.5 OBJECT:16:typeinfo name for std::regex_error@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_1@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_2@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_3@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_4@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_5@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_6@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_7@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_8@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_9@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_10@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_11@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_12@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_13@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_14@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_15@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_16@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_17@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_18@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_19@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_20@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_21@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_22@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_23@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_24@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_25@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_26@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_27@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_28@@GLIBCXX_3.4.15 OBJECT:1:std::placeholders::_29@@GLIBCXX_3.4.15 OBJECT:20:vtable for std::regex_error@@GLIBCXX_3.4.15 OBJECT:20:vtable for std::bad_function_call@@CXXABI_1.3.5 OBJECT:22:typeinfo name for std::bad_function_call@@CXXABI_1.3.5 Ok for both if the bootstraps pass? Thanks. Rainer 2011-03-15 Rainer Orth libstdc++-v3: * config/abi/post/solaris2.8/baseline_symbols.txt: Regenerate. * config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise. diff -r 217519b21f20 libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt --- a/libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt Fri Mar 11 18:03:34 2011 +0100 +++ b/libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt Tue Mar 15 11:21:07 2011 +0100 @@ -1162,6 +1162,9 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCXX_3.4 FUNC:_ZNSt11range_errorD0Ev@@GLIBCXX_3.4 FUNC:_ZNSt11range_errorD1Ev@@GLIBCXX_3.4 +FUNC:_ZNSt11regex_errorD0Ev@@GLIBCXX_3.4.15 +FUNC:_ZNSt11regex_errorD1Ev@@GLIBCXX_3.4.15 +FUNC:_ZNSt11regex_errorD2Ev@@GLIBCXX_3.4.15 FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCXX_3.4 FUNC:_ZNSt12__basic_fileIcE4fileEv@@GLIBCXX_3.4.1 FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCXX_3.4 @@ -1712,6 +1715,8 @@ FUNC:_ZNSt17__timepunct_cacheIwED0Ev@@GLIBCXX_3.4 FUNC:_ZNSt17__timepunct_cacheIwED1Ev@@GLIBCXX_3.4 FUNC:_ZNSt17__timepunct_cacheIwED2Ev@@GLIBCXX_3.4 +FUNC:_ZNSt17bad_function_callD0Ev@@CXXABI_1.3.5 +FUNC:_ZNSt17bad_function_callD1Ev@@CXXABI_1.3.5 FUNC:_ZNSt17moneypunct_bynameIcLb0EEC1EPKcj@@GLIBCXX_3.4 FUNC:_ZNSt17moneypunct_bynameIcLb0EEC2EPKcj@@GLIBCXX_3.4 FUNC:_ZNSt17moneypunct_bynameIcLb0EED0Ev@@GLIBCXX_3.4 @@ -1920,6 +1925,11 @@ FUNC:_ZNSt7num_putIwSt19ostr
Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
Thanks. On Tuesday 15 March 2011 07:25:10, Kai Tietz wrote: > @@ -989,6 +989,13 @@ handle_toplevel_file (directive_handler_ > >in_fname = read_md_filename; >lastsl = strrchr (in_fname, '/'); > +#ifdef HAVE_DOS_BASED_FILE_SYSTEM > + { > +char *lsl2 = strrchr (in_fname, '\\'); > +if (!lastsl || (lsl2 && lsl2 > lastsl)) > + lastsl = lsl2; > + } > +#endif >if (lastsl != NULL) > base_dir = xstrndup (in_fname, lastsl - in_fname + 1); >else This looks like lbasename-able as well, getting rid of that HAVE_DOS...-ish foo: base = lbasename (in_fname); if (base == in_fname) base_dir = NULL; else base_dir = xstrndup (in_fname, base - in_fname); -- Pedro Alves
Re: [PATCH] Remove -fenable-icf-debug support
Hi Jakub, > As Cary said there are no consumers of the .debug_dcall/.debug_vcall > sections yet and DW_TAG_GNU_call_site info should contain a superset > of that information, this patch removes -fenable-icf-debug support, > if you think it is desirable to remove it. this should also fix PR debug/47393. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH, ARM] Fix PR 43872, incorrectly aligned VLAs
On 2011/3/15 02:41 PM, Ramana Radhakrishnan wrote: > On 17/02/11 10:01, Chung-Lin Tang wrote: >> Hi, >> this PR is a case where we have a leaf function with a zero-size frame, >> that calls alloca() (here through a C99 VLA). >> >> The ARM backend recognizes the leaf-and-no-frame opportunity to save an >> unneeded stack alignment. But when calling alloca(), the allocated block >> is of BIGGEST_ALIGNMENT, which is 8-bytes under current AAPCS. Thus a >> stack align may still be needed to place the alloca() returned block >> properly. >> >> This patch adjusts the early return condition with !cfun->calls_alloca. >> Tested without regressions on ARM-Linux, okay for trunk? > > OK. Thanks. >> >> Also related, the BIGGEST_ALIGNMENT defined for ARM is currently >> ABI-based; 64-bits for AAPCS targets, and 32 for old ABI. Should this >> also consider arch-level as well? i.e. anything>= ARMv5TE (with ldrd) >> should have this set to 64. > > I don't think it's that straightforward. The ABI specifies that an 8 > byte quantity must be aligned at 64 bit boundaries and this should be > independent of architecture revisions. Think about pointers to 64 bit > quantities passed from !(TARGET_LDRD) to TARGET_LDRD code or indeed > creating structure layout issues between architecture revisions if you > change this. Oh okay, I see. I checked again, originally thought that structure layout was controlled by other alignment related macros...
[committed] Fix fallout from snprintf folding patch (PR tree-optimization/48129)
Hi! On some targets implicit_built_in_decls[BUILT_IN_SNPRINTF] is NULL, but as we want only the return type of the snprintf function and fold_builtin_snprintf in that case is only used when __builtin_* variant is used explicitly, using built_in_decls is better and avoids the ICE. Bootstrapped/regtested on x86_64-linux and i686-linux, tested on the testcase with cross to cris-elf, committed to trunk as obvious. 2011-03-15 Jakub Jelinek PR tree-optimization/48129 * builtins.c (fold_builtin_snprintf): Convert to type of built_in_decls[BUILT_IN_SNPRINTF] retval instead of implicit_built_in_decls[BUILT_IN_SNPRINTF] retval. --- gcc/builtins.c.jj 2011-03-15 09:47:12.0 +0100 +++ gcc/builtins.c 2011-03-15 10:05:25.0 +0100 @@ -12038,9 +12038,8 @@ fold_builtin_snprintf (location_t loc, t if (call && retval) { - retval = fold_convert_loc - (loc, TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SNPRINTF])), -retval); + tree fn = built_in_decls[BUILT_IN_SNPRINTF]; + retval = fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fn)), retval); return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval); } else Jakub
Re: [v3] typeinfo tuning
On 14 March 2011 17:29, Benjamin Kosnik wrote: > > I hacked up scripts/check_compile and ran the libstdc++ testsuite to > generate 4k+ .s files, and then analyzed the resulting assembly files > for vague linkage. > > Here are the clear wins that are ABI-compatible, or in C++0x code. There > are other issues, like the locale base classes, that are not as easy to > fix. There are a couple other issues in C++0x code that I am working > out, will post later today. > > I'm holding off on this patch until branching is clear. But I thought > I'd post it so that this effort is public. It's set up for 4.6.0 but > may be moved to 4.7.0. Does exporting some of these symbols and vtables from the library mean we're less able to change them? I'm not confident all ofthe C++0x bits are entirely stable yet. I see you've given future_base::_Result_base a virtual destructor, is there a specific reason for that? Destruction should always be via the virtual _M_destroy function and so 'delete' is called in the final overrider, where the static type and dynamic type are the same. The virtual destructor adds unnecessary overhead, though it's probably negligible.
Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
2011/3/15 Pedro Alves : > Thanks. > > This looks like lbasename-able as well, getting rid of > that HAVE_DOS...-ish foo: Thanks. Yes, that one I missed. Attached updated version of patch. Kai Index: gcc/gcc/c-family/c-ada-spec.c === --- gcc.orig/gcc/c-family/c-ada-spec.c 2011-03-14 18:45:20.566392100 +0100 +++ gcc/gcc/c-family/c-ada-spec.c 2011-03-14 20:22:19.023299300 +0100 @@ -559,7 +559,8 @@ compare_comment (const void *lp, const v const cpp_comment *rhs = (const cpp_comment *) rp; if (LOCATION_FILE (lhs->sloc) != LOCATION_FILE (rhs->sloc)) -return strcmp (LOCATION_FILE (lhs->sloc), LOCATION_FILE (rhs->sloc)); +return filename_cmp (LOCATION_FILE (lhs->sloc), +LOCATION_FILE (rhs->sloc)); if (LOCATION_LINE (lhs->sloc) != LOCATION_LINE (rhs->sloc)) return LOCATION_LINE (lhs->sloc) - LOCATION_LINE (rhs->sloc); Index: gcc/gcc/collect2.c === --- gcc.orig/gcc/collect2.c 2011-03-14 18:45:20.567392100 +0100 +++ gcc/gcc/collect2.c 2011-03-15 07:57:54.540718100 +0100 @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. #include "system.h" #include "coretypes.h" #include "tm.h" +#include "filenames.h" /* TARGET_64BIT may be defined to use driver specific functionality. */ #undef TARGET_64BIT @@ -2314,12 +2315,8 @@ write_c_file_stat (FILE *stream, const c int frames = (frame_tables.number > 0); /* Figure out name of output_file, stripping off .so version. */ - p = strrchr (output_file, '/'); - if (p == 0) -p = output_file; - else -p++; - q = p; + q = p = lbasename (output_file); + while (q) { q = strchr (q,'.'); @@ -2330,7 +2327,7 @@ write_c_file_stat (FILE *stream, const c } else { - if (strncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0) + if (filename_ncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0) { q += strlen (SHLIB_SUFFIX); break; @@ -3192,10 +3189,10 @@ resolve_lib_name (const char *name) for (; list; list = list->next) { /* The following lines are needed because path_prefix list -may contain directories both with trailing '/' and +may contain directories both with trailing DIR_SEPARATOR and without it. */ const char *p = ""; - if (list->prefix[strlen(list->prefix)-1] != '/') + if (!IS_DIR_SEPARATOR (list->prefix[strlen(list->prefix)-1])) p = "/"; for (j = 0; j < 2; j++) { Index: gcc/gcc/coverage.c === --- gcc.orig/gcc/coverage.c 2011-03-14 18:45:20.569392100 +0100 +++ gcc/gcc/coverage.c 2011-03-14 18:45:52.497503800 +0100 @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. #include "tree-pass.h" #include "diagnostic-core.h" #include "intl.h" +#include "filenames.h" #include "gcov-io.c" @@ -982,7 +983,7 @@ coverage_init (const char *filename) /* + 1 for extra '/', in case prefix doesn't end with /. */ int prefix_len; - if (profile_data_prefix == 0 && filename[0] != '/') + if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH(&filename[0])) profile_data_prefix = getpwd (); prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0; Index: gcc/gcc/fortran/scanner.c === --- gcc.orig/gcc/fortran/scanner.c 2011-03-14 18:45:20.588392100 +0100 +++ gcc/gcc/fortran/scanner.c 2011-03-14 18:45:52.506505000 +0100 @@ -1754,7 +1754,7 @@ preprocessor_line (gfc_char_t *c) if (flag[2]) /* Ending current file. */ { if (!current_file->up - || strcmp (current_file->up->filename, filename) != 0) + || filename_cmp (current_file->up->filename, filename) != 0) { gfc_warning_now ("%s:%d: file %s left but not entered", current_file->filename, current_file->line, @@ -1774,7 +1774,7 @@ preprocessor_line (gfc_char_t *c) /* The name of the file can be a temporary file produced by cpp. Replace the name if it is different. */ - if (strcmp (current_file->filename, filename) != 0) + if (filename_cmp (current_file->filename, filename) != 0) { /* FIXME: we leak the old filename because a pointer to it may be stored in the linemap. Alternative could be using GC or updating linemap to @@ -1891,7 +1891,7 @@ load_file (const char *realfilename, con filename = displayedname ? displayedname : realfilename; for (f = current_file; f; f = f->up) -if (strcmp (filename, f->filename) == 0) +if (filename_cmp (filename, f->filename) == 0) { fprintf (stderr, "%s:%d: Error: File '%s' is being included " "recursively\n", current_file->filename, current_file->line, Index: gcc/g
Re: RFA/RFC: Enable both gold and ld in a single toolchain
Hi Diego, Any news on this patch? :) We may be interested in using it. (Sorry for the delay in replying - I am backed up at the moment). The patch is stalled at the moment :-( I would love to push it forward, but I just do not have the time right now. I do intend to come back to it, but I just cannot say when that will be. Sorry. Cheers Nick PS. If you want to take over the patch and push it forward, please do...
Re: [patch gcc c++ c-family java fortan lto]: Fix DOS-filesystem issues
On Tuesday 15 March 2011 11:46:23, Kai Tietz wrote: > 2011/3/15 Pedro Alves : > > Thanks. > > > > This looks like lbasename-able as well, getting rid of > > that HAVE_DOS...-ish foo: > > Thanks. Yes, that one I missed. > > Attached updated version of patch. Thanks. -- Pedro Alves
[PATCH] Fix part of PR48037
This avoids spilling SSE registers to memory just because we access vector components in a C array way. The trick is to simply rewrite those accesses to proper vector selects on the tree level and promote the vector to SSA form. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-03-15 Richard Guenther PR tree-optimization/48037 * tree-ssa.c (maybe_rewrite_mem_ref_base): Rewrite vector selects into BIT_FIELD_REFs. (non_rewritable_mem_ref_base): Check if a MEM_REF is a vector select. * gcc.target/i386/pr48037-1.c: New testcase. Index: gcc/tree-ssa.c === *** gcc/tree-ssa.c (revision 170776) --- gcc/tree-ssa.c (working copy) *** maybe_rewrite_mem_ref_base (tree *tp) *** 1838,1855 tp = &TREE_OPERAND (*tp, 0); if (TREE_CODE (*tp) == MEM_REF && TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR - && integer_zerop (TREE_OPERAND (*tp, 1)) && (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0)) && DECL_P (sym) && !TREE_ADDRESSABLE (sym) && symbol_marked_for_renaming (sym)) { ! if (!useless_type_conversion_p (TREE_TYPE (*tp), ! TREE_TYPE (sym))) ! *tp = build1 (VIEW_CONVERT_EXPR, ! TREE_TYPE (*tp), sym); ! else ! *tp = sym; } } --- 1838,1869 tp = &TREE_OPERAND (*tp, 0); if (TREE_CODE (*tp) == MEM_REF && TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR && (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0)) && DECL_P (sym) && !TREE_ADDRESSABLE (sym) && symbol_marked_for_renaming (sym)) { ! if (TREE_CODE (TREE_TYPE (sym)) == VECTOR_TYPE ! && useless_type_conversion_p (TREE_TYPE (*tp), ! TREE_TYPE (TREE_TYPE (sym))) ! && multiple_of_p (sizetype, TREE_OPERAND (*tp, 1), ! TYPE_SIZE_UNIT (TREE_TYPE (*tp ! { ! *tp = build3 (BIT_FIELD_REF, TREE_TYPE (*tp), sym, ! TYPE_SIZE (TREE_TYPE (*tp)), ! int_const_binop (MULT_EXPR, !bitsize_int (BITS_PER_UNIT), !TREE_OPERAND (*tp, 1), 0)); ! } ! else if (integer_zerop (TREE_OPERAND (*tp, 1))) ! { ! if (!useless_type_conversion_p (TREE_TYPE (*tp), ! TREE_TYPE (sym))) ! *tp = build1 (VIEW_CONVERT_EXPR, ! TREE_TYPE (*tp), sym); ! else ! *tp = sym; ! } } } *** non_rewritable_mem_ref_base (tree ref) *** 1869,1879 base = TREE_OPERAND (base, 0); /* But watch out for MEM_REFs we cannot lower to a ! VIEW_CONVERT_EXPR. */ if (TREE_CODE (base) == MEM_REF && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) { tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); if (DECL_P (decl) && (!integer_zerop (TREE_OPERAND (base, 1)) || (DECL_SIZE (decl) --- 1883,1900 base = TREE_OPERAND (base, 0); /* But watch out for MEM_REFs we cannot lower to a ! VIEW_CONVERT_EXPR or a BIT_FIELD_REF. */ if (TREE_CODE (base) == MEM_REF && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) { tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); + if (TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE + && useless_type_conversion_p (TREE_TYPE (base), + TREE_TYPE (TREE_TYPE (decl))) + && double_int_fits_in_uhwi_p (mem_ref_offset (base)) + && multiple_of_p (sizetype, TREE_OPERAND (base, 1), + TYPE_SIZE_UNIT (TREE_TYPE (base + return NULL_TREE; if (DECL_P (decl) && (!integer_zerop (TREE_OPERAND (base, 1)) || (DECL_SIZE (decl) Index: gcc/testsuite/gcc.target/i386/pr48037-1.c === *** gcc/testsuite/gcc.target/i386/pr48037-1.c (revision 0) --- gcc/testsuite/gcc.target/i386/pr48037-1.c (revision 0) *** *** 0 --- 1,15 + /* { dg-do compile } */ + /* { dg-require-effective-target lp64 } */ + /* { dg-options "-O -fno-math-errno" } */ + + typedef double __m128d __attribute__((vector_size(16))); + __m128d vsqrt1 (__m128d const x) + { + double const* __restrict__ const y = (double const*)&x; + double const a = __builtin_sqrt(y[0]); + double const b = __builtin_sqrt(y[1]); + return (__m128d) { a, b }; + } + + /* Verify we do not spill x to the stack. */ + /* { dg-final { scan-assembler-not "%rsp" } } */
[google] XFAIL execution of libmudflap.c/pass49-frag.c (issue4278049)
When I XFAIL'd this test, I forgot to XFAIL its execution as well. Tested on x86_64. Committed to branch. 2011-03-15 Diego Novillo * testsuite/libmudflap.c/pass49-frag.c: Also XFAIL execution. Index: libmudflap/testsuite/libmudflap.c/pass49-frag.c === --- libmudflap/testsuite/libmudflap.c/pass49-frag.c (revision 170968) +++ libmudflap/testsuite/libmudflap.c/pass49-frag.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { xfail *-*-* } } */ #include #include #include -- This patch is available for review at http://codereview.appspot.com/4278049
Fix PR 45844, gfortran.dg/vect/pr45714-b.f ICE on power7
The vsx splat load from memory insns manage to evade reg_offset_addressing_ok_p since their MEM mode is DFmode or DImode, which are not (usually) vector modes. This patch prevents reload damage in rs6000_legitimize_reload_address, and ensures the splat insn predicate is sufficiently strict. Bootstrapped etc. powerpc64-linux on power7 hardware. OK to apply? PR target/45844 * config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Don't create invalid offset address for vsx splat insn. * config/rs6000/predicates.md (splat_input_operand): New. * config/rs6000/vsx.md (vsx_splat_*): Use it. Index: gcc/config/rs6000/rs6000.c === --- gcc/config/rs6000/rs6000.c (revision 170978) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -6579,6 +6676,14 @@ rs6000_legitimize_reload_address (rtx x, { bool reg_offset_p = reg_offset_addressing_ok_p (mode); + /* Nasty hack for vsx_splat_V2DF/V2DI load from mem, which takes a + DFmode/DImode MEM. */ + if (reg_offset_p + && opnum == 1 + && ((mode == DFmode && recog_data.operand_mode[0] == V2DFmode) + || (mode == DImode && recog_data.operand_mode[0] == V2DImode))) +reg_offset_p = false; + /* We must recognize output that we have already generated ourselves. */ if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == PLUS Index: gcc/config/rs6000/predicates.md === --- gcc/config/rs6000/predicates.md (revision 170978) +++ gcc/config/rs6000/predicates.md (working copy) @@ -871,6 +871,23 @@ (define_predicate "input_operand" return 0; }) +;; Return 1 if this operand is a valid input for a vsx_splat insn. +(define_predicate "splat_input_operand" + (match_code "label_ref,symbol_ref,const,high,reg,subreg,mem, + const_double,const_vector,const_int,plus") +{ + if (MEM_P (op)) +{ + if (mode == DFmode) + mode = V2DFmode; + else if (mode == DImode) + mode = V2DImode; + else + gcc_unreachable (); +} + return input_operand (op, mode); +}) + ;; Return true if OP is an invalid SUBREG operation on the e500. (define_predicate "rs6000_nonimmediate_operand" (match_code "reg,subreg,mem") Index: gcc/config/rs6000/vsx.md === --- gcc/config/rs6000/vsx.md(revision 170978) +++ gcc/config/rs6000/vsx.md(working copy) @@ -1076,7 +1076,7 @@ (define_insn "*vsx_xxpermdi2_" (define_insn "vsx_splat_" [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,wd,wd,?wa,?wa,?wa") (vec_duplicate:VSX_D -(match_operand: 1 "input_operand" "ws,f,Z,wa,wa,Z")))] +(match_operand: 1 "splat_input_operand" "ws,f,Z,wa,wa,Z")))] "VECTOR_MEM_VSX_P (mode)" "@ xxpermdi %x0,%x1,%x1,0 -- Alan Modra Australia Development Lab, IBM
Re: [Patch] [C++0x] Support decltype as base-specifier (Bug 42603)
Now that we're in stage 1 of 4.7, I'm looking to apply this soon, but now I notice that it doesn't have a testcase. Could you add one? Thanks, Jason
Re: [ARM] PR 47553: vld1q_lane_u8 & co. don't accept lanes >= 8
On 31/01/11 13:27, Richard Sandiford wrote: The v{ld,st}1q_lane_{u,s,p}8 intrinsic functions are supposed to take a range between 0 and 15. The function is then converted to a vld1 or vst1 of one half of the quad value. The problem is that the lane predicate doesn't account for this, and only accepts the 0..7 range that are supported by the individual vld1 and vst1. The current code only does the "real" size-dependent range check at output time. That isn't ideal, but there's a separate bug (40884) about it. Tested on arm-linux-gnueabi (-marm and -mthumb). I don't think this is a regression, so: OK to install once 4.7 is open? OK for trunk. I am tempted to consider this one for the other release branches since this is correcting a test in the interface for an intrinsic which has been wrong for a long time but would like the opinion of the other maintainers about this. cheers Ramana Richard gcc/ * config/arm/predicates.md (neon_lane_number): Accept 0..15. gcc/testsuite/ * gcc.target/arm/neon-vld-1.c: New test. Index: gcc/config/arm/predicates.md === --- gcc/config/arm/predicates.md2011-01-31 13:09:19.0 + +++ gcc/config/arm/predicates.md2011-01-31 13:12:41.0 + @@ -610,7 +610,7 @@ (define_predicate "neon_inv_logic_op2" ;; TODO: We could check lane numbers more precisely based on the mode. (define_predicate "neon_lane_number" (and (match_code "const_int") - (match_test "INTVAL (op)>= 0&& INTVAL (op)<= 7"))) + (match_test "INTVAL (op)>= 0&& INTVAL (op)<= 15"))) ;; Predicates for named expanders that overlap multiple ISAs. (define_predicate "cmpdi_operand" Index: gcc/testsuite/gcc.target/arm/neon-vld-1.c === --- /dev/null 2011-01-26 10:43:14.268819722 + +++ gcc/testsuite/gcc.target/arm/neon-vld-1.c 2011-01-31 13:16:10.0 + @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-O1" } */ +/* { dg-add-options arm_neon } */ + +#include + +uint8x16_t +foo (uint8_t *a, uint8x16_t b) +{ + vst1q_lane_u8 (a, b, 14); + return vld1q_lane_u8 (a + 0x100, b, 15); +}
[google] Created branch google/gcc-4_6 (issue4285048)
Created svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6 as a sub-branch of google/main. Committed. 2011-03-15 Diego Novillo * BASE-VER: Change to 4.6.0-google * DEV-PHASE: Change to prerelease. Index: gcc/DEV-PHASE === --- gcc/DEV-PHASE (revision 170991) +++ gcc/DEV-PHASE (working copy) @@ -1 +1 @@ -experimental +prerelease Index: gcc/BASE-VER === --- gcc/BASE-VER(revision 170991) +++ gcc/BASE-VER(working copy) @@ -1 +1 @@ -4.6.0-google-main +4.6.0-google -- This patch is available for review at http://codereview.appspot.com/4285048
[PATCH] Fix PR13954
This fixes PR13954, the failure to look through memcpy functions during value-numbering. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-03-09 Richard Guenther PR tree-optimization/13954 * tree-ssa-sccvn.c (vn_reference_lookup_3): Look through memcpy and friends. * g++.dg/tree-ssa/pr13954.C: New testcase. Index: gcc/tree-ssa-sccvn.c === *** gcc/tree-ssa-sccvn.c.orig 2011-03-08 16:50:33.0 +0100 --- gcc/tree-ssa-sccvn.c2011-03-09 15:45:44.0 +0100 *** vn_reference_lookup_3 (ao_ref *ref, tree *** 1288,1294 { vn_reference_t vr = (vn_reference_t)vr_; gimple def_stmt = SSA_NAME_DEF_STMT (vuse); - tree fndecl; tree base; HOST_WIDE_INT offset, maxsize; static VEC (vn_reference_op_s, heap) *lhs_ops = NULL; --- 1288,1293 *** vn_reference_lookup_3 (ao_ref *ref, tree *** 1326,1335 from that defintion. 1) Memset. */ if (is_gimple_reg_type (vr->type) ! && is_gimple_call (def_stmt) ! && (fndecl = gimple_call_fndecl (def_stmt)) ! && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL ! && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET && integer_zerop (gimple_call_arg (def_stmt, 1)) && host_integerp (gimple_call_arg (def_stmt, 2), 1) && TREE_CODE (gimple_call_arg (def_stmt, 0)) == ADDR_EXPR) --- 1325,1331 from that defintion. 1) Memset. */ if (is_gimple_reg_type (vr->type) ! && gimple_call_builtin_p (def_stmt, BUILT_IN_MEMSET) && integer_zerop (gimple_call_arg (def_stmt, 1)) && host_integerp (gimple_call_arg (def_stmt, 2), 1) && TREE_CODE (gimple_call_arg (def_stmt, 0)) == ADDR_EXPR) *** vn_reference_lookup_3 (ao_ref *ref, tree *** 1379,1385 } } ! /* For aggregate copies translate the reference through them if the copy kills ref. */ else if (vn_walk_kind == VN_WALKREWRITE && gimple_assign_single_p (def_stmt) --- 1375,1381 } } ! /* 3) For aggregate copies translate the reference through them if the copy kills ref. */ else if (vn_walk_kind == VN_WALKREWRITE && gimple_assign_single_p (def_stmt) *** vn_reference_lookup_3 (ao_ref *ref, tree *** 1450,1455 --- 1446,1592 vr->hashcode = vn_reference_compute_hash (vr); /* Adjust *ref from the new operands. */ + if (!ao_ref_init_from_vn_reference (&r, vr->set, vr->type, vr->operands)) + return (void *)-1; + /* This can happen with bitfields. */ + if (ref->size != r.size) + return (void *)-1; + *ref = r; + + /* Do not update last seen VUSE after translating. */ + last_vuse_ptr = NULL; + + /* Keep looking for the adjusted *REF / VR pair. */ + return NULL; + } + + /* 4) For memcpy copies translate the reference through them if + the copy kills ref. */ + else if (vn_walk_kind == VN_WALKREWRITE + && is_gimple_reg_type (vr->type) + /* ??? Handle BCOPY as well. */ + && (gimple_call_builtin_p (def_stmt, BUILT_IN_MEMCPY) + || gimple_call_builtin_p (def_stmt, BUILT_IN_MEMPCPY) + || gimple_call_builtin_p (def_stmt, BUILT_IN_MEMMOVE)) + && (TREE_CODE (gimple_call_arg (def_stmt, 0)) == ADDR_EXPR + || TREE_CODE (gimple_call_arg (def_stmt, 0)) == SSA_NAME) + && (TREE_CODE (gimple_call_arg (def_stmt, 1)) == ADDR_EXPR + || TREE_CODE (gimple_call_arg (def_stmt, 1)) == SSA_NAME) + && host_integerp (gimple_call_arg (def_stmt, 2), 1)) + { + tree lhs, rhs; + ao_ref r; + HOST_WIDE_INT rhs_offset, copy_size, lhs_offset; + vn_reference_op_s op; + HOST_WIDE_INT at; + + + /* Only handle non-variable, addressable refs. */ + if (ref->size != maxsize + || offset % BITS_PER_UNIT != 0 + || ref->size % BITS_PER_UNIT != 0) + return (void *)-1; + + /* Extract a pointer base and an offset for the destination. */ + lhs = gimple_call_arg (def_stmt, 0); + lhs_offset = 0; + if (TREE_CODE (lhs) == SSA_NAME) + lhs = SSA_VAL (lhs); + if (TREE_CODE (lhs) == ADDR_EXPR) + { + tree tem = get_addr_base_and_unit_offset (TREE_OPERAND (lhs, 0), + &lhs_offset); + if (!tem) + return (void *)-1; + if (TREE_CODE (tem) == MEM_REF + && host_integerp (TREE_OPERAND (tem, 1), 1)) + { + lhs = TREE_OPERAND (tem, 0); + lhs_offset += TREE_INT_CST_LOW (TREE_OPERAND (tem, 1)); + } + else if (DECL_P (tem)) + lhs = build_fold_addr_expr (tem); + else + return (void *)-1; + } + if (
[PATCH] Fix PR47650
This fixes PR47650, bogus function type dumping for unprototyped and variadic functions. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2011-03-15 Richard Guenther PR middle-end/47650 * tree-pretty-print.c (dump_function_declaration): Properly dump unprototyped and varargs function types. * gfortran.dg/c_f_pointer_tests_3.f90: Adjust. * gfortran.dg/ishft_4.f90: Likewise. * gfortran.dg/leadz_trailz_3.f90: Likewise. Index: gcc/tree-pretty-print.c === *** gcc/tree-pretty-print.c.orig2011-03-15 13:52:36.0 +0100 --- gcc/tree-pretty-print.c 2011-03-15 14:04:05.0 +0100 *** dump_function_declaration (pretty_printe *** 232,254 pp_space (buffer); pp_character (buffer, '('); ! /* Print the argument types. The last element in the list is a VOID_TYPE. ! The following avoids printing the last element. */ arg = TYPE_ARG_TYPES (node); ! while (arg && TREE_CHAIN (arg) && arg != error_mark_node) { ! wrote_arg = true; ! dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false); ! arg = TREE_CHAIN (arg); ! if (TREE_CHAIN (arg) && TREE_CODE (TREE_CHAIN (arg)) == TREE_LIST) { pp_character (buffer, ','); pp_space (buffer); } } ! if (!wrote_arg) pp_string (buffer, "void"); pp_character (buffer, ')'); } --- 232,258 pp_space (buffer); pp_character (buffer, '('); ! /* Print the argument types. */ arg = TYPE_ARG_TYPES (node); ! while (arg && arg != void_list_node && arg != error_mark_node) { ! if (wrote_arg) { pp_character (buffer, ','); pp_space (buffer); } + wrote_arg = true; + dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false); + arg = TREE_CHAIN (arg); } ! /* Drop the trailing void_type_node if we had any previous argument. */ ! if (arg == void_list_node && !wrote_arg) pp_string (buffer, "void"); + /* Properly dump vararg function types. */ + else if (!arg && wrote_arg) + pp_string (buffer, ", ..."); + /* Avoid printing any arg for unprototyped functions. */ pp_character (buffer, ')'); } Index: gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 === *** gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90.orig 2008-07-03 10:16:03.0 +0200 --- gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 2011-03-15 14:08:16.0 +0100 *** end program test *** 30,35 ! { dg-final { scan-tree-dump-times " fptr = .integer.kind=4. .. cptr" 1 "original" } } ! ! Check c_f_procpointer ! ! { dg-final { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. .void.. cfunptr;" 1 "original" } } ! ! { dg-final { cleanup-tree-dump "original" } } --- 30,35 ! { dg-final { scan-tree-dump-times " fptr = .integer.kind=4. .. cptr" 1 "original" } } ! ! Check c_f_procpointer ! ! { dg-final { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. ... cfunptr;" 1 "original" } } ! ! { dg-final { cleanup-tree-dump "original" } } Index: gcc/testsuite/gfortran.dg/ishft_4.f90 === *** gcc/testsuite/gfortran.dg/ishft_4.f90.orig 2010-09-03 10:28:48.0 +0200 --- gcc/testsuite/gfortran.dg/ishft_4.f90 2011-03-15 14:35:01.0 +0100 *** end program *** 35,40 ! -- once in the function definition itself ! -- plus as many times as the function is called ! ! ! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 5 "original" } } ! ! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 5 "original" } } ! { dg-final { cleanup-tree-dump "original" } } --- 35,40 ! -- once in the function definition itself ! -- plus as many times as the function is called ! ! ! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 6 "original" } } ! ! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 6 "original" } } ! { dg-final { cleanup-tree-dump "original" } } Index: gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 === *** gcc/testsuite/gfortran.dg/leadz_trailz_3.f90.orig 2010-09-10 11:48:44.0 +0200 --- gcc/testsuite/gfortran.dg/leadz_trailz_3.f902011-03-15 14:34:39.0 +0100 *** end program *** 26,30 ! -- once in the function definition itself ! -- plus as many times as the function is called ! ! ! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 7 "original" } } ! { dg-final { cleanup-tree-dump "original" } } --- 26,30 ! -- once in the function definition itself ! -- plus as many times as the function is called ! ! ! { dg-final { scan-tree-dump-times "foo *\\\(
RE: [Patch][AVR]: Support tail calls
> >Boyapati, Anitha schrieb: > >> To be on same page, can you explain how gcc optimizes above case? > >in > >void bar0 (void); >int bar1 (int); > >int foo (int x) >{ >bar0(); >return bar1 (x); >} > >x must be saved somewhere. avr-gcc choses Y. >Compiled -Os -mmcu=atmega8 -fno-optimize-sibling-calls reads Ok. I was trying to understand the basic strategies of handling a tail-called function. Broadly speaking, [1]. In the case of normal tail-call, the stack of the caller is freed and then a jump to callee is made. [2]. Incase of a tail-recursive case, the recursion is made iterative. >gcc recognizes most cases where tail call optimization must not be >applied. But in some cases backend has to impose more restrictions, >this is what TARGET_FUNCTION_OK_FOR_SIBCALL is for. E.g. An ISR must >not tail-call an ordinary function because the epilogues must be >compatible bit ISR resp. non-ISR have incompatible epilogues. > > >As with all other optimization options/passes, they are only applied >in the presence of optimization, i.e. with -O0 options like >-foptimize-sibling-calls have no effect. You will have to specify at >least -O1 to see effects. > Thanks. I tried various cases (mutually recursive functions, interrupts and signals, variable arguments). Required a bit of wandering through tree-tailcall.c to know what other cases are not qualified as tail-called ones(variable arguments is one such). The code generated is as expected. Coming to -mcall-prologues issue, I agree whenever prologue_saves and epilogue_restores, making the function qualified as a tail call is not ok (or it requires different handling). Going by the backend code, they are now emitted (prologue_saves and epilogue_restores) whenever -mcall-prologues is used. Ditto when callee-used registers are used for argument passing. I think it is a nice work! Anitha
Re: Fix PR 45844, gfortran.dg/vect/pr45714-b.f ICE on power7
On Tue, Mar 15, 2011 at 8:51 AM, Alan Modra wrote: > The vsx splat load from memory insns manage to evade > reg_offset_addressing_ok_p since their MEM mode is DFmode or DImode, > which are not (usually) vector modes. This patch prevents reload > damage in rs6000_legitimize_reload_address, and ensures the splat insn > predicate is sufficiently strict. Bootstrapped etc. powerpc64-linux > on power7 hardware. OK to apply? > > PR target/45844 > * config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Don't > create invalid offset address for vsx splat insn. > * config/rs6000/predicates.md (splat_input_operand): New. > * config/rs6000/vsx.md (vsx_splat_*): Use it. Okay. As I asked Mike, Peter and Pat, we need more comprehensive VSX tests in the testsuite because all of these problems should have been caught by coverage tests, not building packages with -mcpu=power7. - David
Re: [PATCH gcc/fortran] get rid of gfc_free
On Tue, Mar 15, 2011 at 12:02, Jim Meyering wrote: > Janne Blomqvist wrote: >> On Tue, Mar 8, 2011 at 19:53, Jim Meyering wrote: >>> Relative to v2, I've added libgo/ to the list of exempt directories and >>> added >>> this recently discussed gfc_free patch, at the request of Tobias Burnus. >>> Also, I corrected an error in fortran's ChangeLog and removed all >>> whitespace changes from all ChangeLog files. >> >> The libgfortran changes are Ok for 4.7. >> >> For the gfortran frontend (gcc/fortran/*) I'd prefer if you'd >> >> - Replace all calls to "gfc_free (x)" with "free (x)". >> - Remove the gfc_free() function and prototype. >> - Remove the free() macro which currently prevents calling free() directly. > > Hi Janne, > > These requested changes are in addition to (and independent of) > the changes that I've already posted here. Yes, it was perhaps a bit unreasonable to ask you to fix this. OTOH with your changes gfc_free() was just a wrapper around free() and should thus be removed as unnecessary. Also, I believe this "proper" fix is more in the spirit of the request by Tobias and the message he linked to discussing the removal of gfc_free(). > The first cset below > does your #2 and #3, and the second does #1. I separate them for > review because #1 is completely mechanical, while the others > are manual. You may prefer to combine them before pushing, for > bisection. Let me know if you'd prefer I submit in that form. All 3 changesets are ok for 4.7. I think it's fine to commit them separately if you prefer. If so, preferably in the order #3, #1, #2 in order to keep every revision buildable. Thanks for working on this! -- Janne Blomqvist
Re: ivopts improvement
Hi Zdenek, I rewrote the patch to remove the use of use_uses_inced_iv. On 03/14/2011 03:03 PM, Zdenek Dvorak wrote: > Hi, > >>> (since the use_uses_inced_iv test is meaningless). >> >> To me it seems use_uses_inced_iv has meaning: >> - it models something: it states whether the comparison is using >> the iv increment result or the iv phi result. > > but that has nothing to do with the value of the iv. For instance, > in the following: > > a = phi (0, a') > b = phi (1, b') > c = phi (1, c') > > a' = a + 1; > tmp = b; > > compare (a'/tmp/c, something) > > b' = tmp + 1; > c' = c + 1; > > a', tmp and c are completely equivalent, yet your code for some reason claims > to handle c and the other two differently. That a' and c have the same value and the code handles them differently does not necessarily mean that the code is incorrect. The way I would formulate it is that the code has implementation limitations, which are expressed in an awkward way. > tmp = b; You're right, the calculation of use_uses_inced_iv assumed that it looks at either the iv phi or the iv increment, so that was not safe. I'll try to explain what my intention with the code is, by looking at a pre-ivopt level example. : p_5 = p_3(D) + i_4(D); : # p_1 = PHI # i_2 = PHI *p_1 = 0; p_6 = p_1 + 1; i_7 = i_2 + 1; if (i_7 < n_8(D)) goto ; else goto ; : goto ; : return; In this example, I try to analyze whether it is safe to replace i_7 < n_8 by p_6 < p_3 + n_8. What I tried to do previously was to first prove a relation p_1 == i_2 + ssa_name between i_2 and p_1, and then figure out (in the awkward code) if I was allowed to assume p_6 == i_7 + ssa_name. Now, I try to prove that relation between i_7 and p_6 instead, which makes the code in iv_elimination_compare_lt simpler. This has as casualty though that the 'int' case (the case that use->iv is not compatible with sizetype) does not work anymore. That would need more work. The code still has the same limitation, meaning it will transform the first 2 examples, but not the last 2 examples of the series of 4 mentioned earlier. Changes compared to previous submission: - changed name of fold_walk_def_plus into fold_diff_to_ssa_name - added extra intelligence in fold_diff_to_ssa_name to deal with (a + x) - (b - x). - don't calculate real_iv_use_base, calculate instead base_cand_at_use to simplify code Thanks, -Tom diff -u gcc/tree-ssa-loop-ivopts.c gcc/tree-ssa-loop-ivopts.c --- gcc/tree-ssa-loop-ivopts.c (working copy) +++ gcc/tree-ssa-loop-ivopts.c (working copy) @@ -419,6 +419,89 @@ return fold_build2 (code, TREE_TYPE (a), a, b); } +/* Folds (TREE_TYPE (A))(A CODE B), where CODE is either PLUS_EXPR or + MINUS_EXPR. Returns the folded expression if folding is successful. + Otherwise, return NULL_TREE. Handles the case that A is a pointer + robustly. */ + +static inline tree +fold_plus (enum tree_code code, tree a, tree b) +{ + tree a_type = TREE_TYPE (a); + tree res; + + STRIP_NOPS (a); + robust_plus (&code, a, &b); + + res = fold_binary (code, TREE_TYPE (a), a, b); + if (res == NULL_TREE) +return NULL_TREE; + + return fold_convert (a_type, res); +} + +/* Folds (TREE_TYPE (A))(A - B), possibly using the defining stmt of A. Returns + the folded expression if folding is successful and resulted in an ssa_name. + Otherwise, return NULL_TREE. */ + +static inline tree +fold_diff_to_ssa_name (tree a, tree b) +{ + tree a_type = TREE_TYPE (a); + tree res, a0, a1; + gimple def_stmt; + + res = fold_plus (MINUS_EXPR, a, b); + if (res != NULL_TREE) +{ + STRIP_NOPS (res); + if (TREE_CODE (res) == SSA_NAME) + return fold_convert (a_type, res); +} + + STRIP_NOPS (a); + STRIP_NOPS (b); + + if (TREE_CODE (a) == PLUS_EXPR && TREE_CODE (b) == PLUS_EXPR + && TREE_OPERAND (a, 1) == TREE_OPERAND (b, 1)) +{ + a = TREE_OPERAND (a, 0); + b = TREE_OPERAND (b, 0); + + STRIP_NOPS (a); + STRIP_NOPS (b); + + res = fold_plus (MINUS_EXPR, a, b); + if (res != NULL_TREE) + { + STRIP_NOPS (res); + if (TREE_CODE (res) == SSA_NAME) + return fold_convert (a_type, res); + } +} + + if (TREE_CODE (a) != SSA_NAME) +return NULL_TREE; + + def_stmt = SSA_NAME_DEF_STMT (a); + if (!is_gimple_assign (def_stmt) + || (gimple_assign_rhs_code (def_stmt) != PLUS_EXPR + && gimple_assign_rhs_code (def_stmt) != POINTER_PLUS_EXPR)) +return NULL_TREE; + a0 = gimple_assign_rhs1 (def_stmt); + a1 = gimple_assign_rhs2 (def_stmt); + + res = fold_plus (MINUS_EXPR, fold_build_plus (PLUS_EXPR, a0, a1), b); + if (res != NULL_TREE) +{ + STRIP_NOPS (res); + if (TREE_CODE (res) == SSA_NAME) + return fold_convert (a_type, res); +} + + return NULL_TREE; +} + /* Number of uses recorded in DATA. */ static inline unsigned @@ -825,17 +908,25 @@ if (!slot) { - /* Try to determine number of iterations. We must know it - unconditionally (i.e., w
Re: ivopts improvement
Hi, > I'll try to explain what my intention with the code is, by looking at a > pre-ivopt level example. > > : > p_5 = p_3(D) + i_4(D); > > : > # p_1 = PHI > # i_2 = PHI > *p_1 = 0; > p_6 = p_1 + 1; > i_7 = i_2 + 1; > if (i_7 < n_8(D)) > goto ; > else > goto ; > > : > goto ; > > : > return; > > In this example, I try to analyze whether it is safe to replace > i_7 < n_8 > by > p_6 < p_3 + n_8. hmmm... is it actually safe? What if n_8 is negative, and p_3 + n_8 overflows? Zdenek
Re: ivopts improvement
On 03/15/2011 04:10 PM, Zdenek Dvorak wrote: > Hi, > >> I'll try to explain what my intention with the code is, by looking at a >> pre-ivopt level example. >> >> : >> p_5 = p_3(D) + i_4(D); >> >> : >> # p_1 = PHI >> # i_2 = PHI >> *p_1 = 0; >> p_6 = p_1 + 1; >> i_7 = i_2 + 1; >> if (i_7 < n_8(D)) >> goto ; >> else >> goto ; >> >> : >> goto ; >> >> : >> return; >> >> In this example, I try to analyze whether it is safe to replace >> i_7 < n_8 >> by >> p_6 < p_3 + n_8. > > hmmm... is it actually safe? What if n_8 is negative, and p_3 + n_8 > overflows? I note that situation here in the comments in iv_elimination_compare_lt: ... This transformation is not valid if i and n are signed, because base + n might underflow. ... and test for i == unsigned here in iv_elimination_compare_lt: ... /* Use should be an unsigned integral. */ if (!INTEGRAL_TYPE_P (use_type) || !TYPE_UNSIGNED (use_type)) return false; ... If i is unsigned but n is signed the code looks like this and the transformation is done using the unsigned pretmp.3_13 rather than signed n_8: ... : p_5 = p_3(D) + i_4(D); pretmp.3_13 = (long unsigned int) n_8(D); : # p_1 = PHI # i_2 = PHI *p_1 = 0; i_6 = i_2 + 1; p_7 = p_1 + 1; if (i_6 < pretmp.3_13) goto ; else goto ; : goto ; : return; ... If i is unsigned and n is signed, and we compare (long signed int)i < n then the use->iv is of type long int, and the TYPE_UNSIGNED (use_type) test prevents the transformation. ... long int i.0; : p_5 = p_3(D) + i_4(D); : # p_1 = PHI # i_2 = PHI *p_1 = 0; i_6 = i_2 + 1; p_7 = p_1 + 1; i.0_8 = (long int) i_6; if (i.0_8 < n_9(D)) goto ; else goto ; : goto ; : return; ... Thanks, - Tom
Re: PR debug/47510
Tom> After a lot of discussion on irc, we came up with another idea: extend Tom> this patch to add DW_AT_linkage_name == 't' to the anonymous Tom> structure. This makes the DWARF remain a faithful representation of Tom> the C++, but also makes it simple for debuginfo readers to understand Tom> what is going on. In particular I think it will make the gdb side of Tom> this tractable. Dodji> I have updated the patch to make add the DW_AT_linkage_name to the Dodji> anonymous type. Dodji> Tested on x86_64-unknown-linux-gnus against trunk and 4.6. I think this Dodji> is material for 4.7 that we can backport to 4.6 after its release. I would like to ask that it be considered for 4.6. IIRC, if this patch does not go in 4.6, then we have to write some special and ugly GDB code to work around the debuginfo generated by 4.6. I would much prefer it if there was no need to write this code. Tom
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
Rainer Orth writes: > I think we agreed that it would be useful to regenerate the Solaris 2 > libstdc++ baselines close to the GCC 4.6.0 release, especially given > that symbol versioning on Solaris appears in 4.6.0 for the first time > and several symbols have been added to the libstdc++.so ABI since the > last update. > > This patch does exactly that. It is based on make new-abi-baseline > output across all of Solaris 8 to 11, both SPARC and x86. I'm > currently re-running bootstraps on all of them on both mainline and the > 4.6 branch. [...] > Ok for both if the bootstraps pass? While 4.6 bootstrap has completed without regressions on Solaris 10 and 11/x86 and Solaris 10/SPARC, mainline bootstrap is broken by Benjamin's recent patch 2011-03-14 Benjamin Kosnik [...] * libsupc++/nested_exception.cc: New. Add dtor for nested_exception. * libsupc++/nested_exception.h: Adjust. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same. * config/abi/pre/gnu.ver: Add new exports. when using the Sun linker: ld: fatal: libstdc++-symbols.ver-sun: 5130: symbol 'typeinfo for std::nested_exception' is already defined in file: libstdc++-symbols.ver-sun: symbol version conflict ld: fatal: libstdc++-symbols.ver-sun: 5132: symbol 'typeinfo name for std::nested_exception' is already defined in file: libstdc++-symbols.ver-sun: symbol version conflict ld: fatal: libstdc++-symbols.ver-sun: 5134: symbol 'vtable for std::nested_exception' is already defined in file: libstdc++-symbols.ver-sun: symbol version conflict collect2: ld returned 1 exit status The lines in question are ##_ZTISt16nested_exception (glob) _ZTISt16nested_exception; ##_ZTSSt16nested_exception (glob) _ZTSSt16nested_exception; ##_ZTVSt16nested_exception (glob) _ZTVSt16nested_exception; in CXXABI_1.3.5, but the same symbols are also matched by ##_ZTISt[0-9][0-9][m-q]* (glob) ##_ZTSSt[0-9][0-9][m-q]* (glob) ##_ZTVSt[0-9][0-9][m-q]* (glob) in GLIBCXX_3.4. I fear that I need to update contrib/make_sunver.pl to handle this, but would need to know the exact semantics of such a version script first. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
C++ PATCH for c++/34758 (unclear error message about circular dependency in default arg)
Looking at the previous discussion of this PR, it seemed that the patch review stalled on the exact wording of the error message. I thought I'd pick it up again and try my hand at new wording; my take is "call to %qD uses the default argument for parameter %P, which is not yet defined" This patch also sets the default arg context when doing deferred parsing so that we can detect the circular case specifically and give a different error in that case. Tested x86_64-pc-linux-gnu, applying to trunk. commit a2857c313c01f5bba07e58ab0ff68462bb630f0d Author: Jason Merrill Date: Mon Mar 14 10:06:03 2011 -0400 PR c++/34758 * call.c (convert_default_arg): Use DECL_ORIGIN of fn. Check for recursion first. (push_defarg_context, pop_defarg_context): New. * parser.c (cp_parser_late_parsing_default_args): Use them. * cp-tree.h: Declare them. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 5953e35..499ed03 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5746,10 +5746,17 @@ cxx_type_promotes_to (tree type) } /* ARG is a default argument expression being passed to a parameter of - the indicated TYPE, which is a parameter to FN. Do any required - conversions. Return the converted value. */ + the indicated TYPE, which is a parameter to FN. PARMNUM is the + zero-based argument number. Do any required conversions. Return + the converted value. */ static GTY(()) VEC(tree,gc) *default_arg_context; +void +push_defarg_context (tree fn) +{ VEC_safe_push (tree, gc, default_arg_context, fn); } +void +pop_defarg_context (void) +{ VEC_pop (tree, default_arg_context); } tree convert_default_arg (tree type, tree arg, tree fn, int parmnum) @@ -5757,15 +5764,8 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum) int i; tree t; - /* If the ARG is an unparsed default argument expression, the - conversion cannot be performed. */ - if (TREE_CODE (arg) == DEFAULT_ARG) -{ - error ("the default argument for parameter %d of %qD has " -"not yet been parsed", -parmnum, fn); - return error_mark_node; -} + /* See through clones. */ + fn = DECL_ORIGIN (fn); /* Detect recursion. */ FOR_EACH_VEC_ELT (tree, default_arg_context, i, t) @@ -5774,7 +5774,17 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum) error ("recursive evaluation of default argument for %q#D", fn); return error_mark_node; } - VEC_safe_push (tree, gc, default_arg_context, fn); + + /* If the ARG is an unparsed default argument expression, the + conversion cannot be performed. */ + if (TREE_CODE (arg) == DEFAULT_ARG) +{ + error ("call to %qD uses the default argument for parameter %P, which " +"is not yet defined", fn, parmnum); + return error_mark_node; +} + + push_defarg_context (fn); if (fn && DECL_TEMPLATE_INFO (fn)) arg = tsubst_default_argument (fn, type, arg); @@ -5814,7 +5824,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum) } pop_deferring_access_checks(); - VEC_pop (tree, default_arg_context); + pop_defarg_context (); return arg; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 4b49046..6ef6e6e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4638,6 +4638,8 @@ extern bool can_convert (tree, tree); extern bool can_convert_arg(tree, tree, tree, int); extern bool can_convert_arg_bad(tree, tree, tree, int); extern bool enforce_access (tree, tree, tree); +extern void push_defarg_context(tree); +extern void pop_defarg_context (void); extern tree convert_default_arg(tree, tree, tree, int); extern tree convert_arg_to_ellipsis(tree); extern tree build_x_va_arg (tree, tree); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4260f6d..a9fd201 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -20521,6 +20521,8 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) saved_local_variables_forbidden_p = parser->local_variables_forbidden_p; parser->local_variables_forbidden_p = true; + push_defarg_context (fn); + for (parm = TYPE_ARG_TYPES (TREE_TYPE (fn)), parmdecl = DECL_ARGUMENTS (fn); parm && parm != void_list_node; @@ -20579,6 +20581,8 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) cp_parser_pop_lexer (parser); } + pop_defarg_context (); + /* Make sure no default arg is missing. */ check_default_args (fn); diff --git a/gcc/testsuite/g++.dg/parse/pr34758.C b/gcc/testsuite/g++.dg/parse/pr34758.C new file mode 100644 index 000..d694853 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr34758.C @@ -0,0 +1,28 @@ +// PR 34758 Bad diagnostic for circular dependency in constructor default argumen
C++0x PATCH to implement core 1191 (deleted base destructor)
This patch implements the proposed resolution for core issue 1191: base destructors do not affect the triviality of derived constructors, but they do affect the exception specification and deletedness. Tested x86_64-pc-linux-gnu, applying to trunk. commit 15e4a01c978314724435064f20c373abf7a1bf8c Author: Jason Merrill Date: Sun Jan 23 17:52:44 2011 -0500 Core 1191 * method.c (synthezized_method_walk): Cleanups don't affect the triviality of a constructor, but do affect deletion and exception specification. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index d70da95..0366988 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1080,14 +1080,9 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, tsubst_flags_t complain; const char *msg; bool ctor_p; - tree cleanup_spec; - bool cleanup_trivial = true; - bool cleanup_deleted = false; - cleanup_spec -= (cxx_dialect >= cxx0x ? noexcept_true_spec : empty_except_spec); if (spec_p) -*spec_p = cleanup_spec; +*spec_p = (cxx_dialect >= cxx0x ? noexcept_true_spec : empty_except_spec); if (deleted_p) { @@ -1228,8 +1223,10 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, destructors for cleanup of partially constructed objects. */ rval = locate_fn_flags (base_binfo, complete_dtor_identifier, NULL_TREE, flags, complain); - process_subob_fn (rval, false, &cleanup_spec, &cleanup_trivial, - &cleanup_deleted, NULL, NULL, + /* Note that we don't pass down trivial_p; the subobject +destructors don't affect triviality of the constructor. */ + process_subob_fn (rval, false, spec_p, NULL, + deleted_p, NULL, NULL, basetype); } @@ -1275,8 +1272,8 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, { rval = locate_fn_flags (base_binfo, complete_dtor_identifier, NULL_TREE, flags, complain); - process_subob_fn (rval, false, &cleanup_spec, &cleanup_trivial, - &cleanup_deleted, NULL, NULL, + process_subob_fn (rval, false, spec_p, NULL, + deleted_p, NULL, NULL, basetype); } } @@ -1295,23 +1292,14 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, if (ctor_p) walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier, sfk_destructor, TYPE_UNQUALIFIED, false, - false, false, &cleanup_spec, &cleanup_trivial, - &cleanup_deleted, NULL, + false, false, spec_p, NULL, + deleted_p, NULL, NULL, flags, complain); pop_scope (scope); --cp_unevaluated_operand; --c_inhibit_evaluation_warnings; - - /* If the constructor isn't trivial, consider the subobject cleanups. */ - if (ctor_p && trivial_p && !*trivial_p) -{ - if (deleted_p && cleanup_deleted) - *deleted_p = true; - if (spec_p) - *spec_p = merge_exception_specifiers (*spec_p, cleanup_spec); -} } /* DECL is a deleted function. If it's implicitly deleted, explain why and diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit11.C b/gcc/testsuite/g++.dg/cpp0x/implicit11.C new file mode 100644 index 000..7ec8e95 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit11.C @@ -0,0 +1,17 @@ +// Test that we consider base dtors in determining whether +// a derived ctor is deleted even if the ctor is trivial. +// { dg-options -std=c++0x } + +struct A +{ + ~A() = delete; // { dg-error "declared here" } +}; + +struct B: A { }; // { dg-error "deleted" } + +extern B eb; +int main() +{ + B* b1 = new B; // { dg-error "use of deleted function" "" { xfail *-*-* } } + B* b2 = new B(eb); // { dg-error "use of deleted function" } +}
Re: [PATCH gcc/fortran] get rid of gfc_free
Janne Blomqvist wrote: ... >> Hi Janne, >> >> These requested changes are in addition to (and independent of) >> the changes that I've already posted here. > > Yes, it was perhaps a bit unreasonable to ask you to fix this. OTOH > with your changes gfc_free() was just a wrapper around free() and > should thus be removed as unnecessary. Also, I believe this "proper" > fix is more in the spirit of the request by Tobias and the message he > linked to discussing the removal of gfc_free(). > >> The first cset below >> does your #2 and #3, and the second does #1. I separate them for >> review because #1 is completely mechanical, while the others >> are manual. You may prefer to combine them before pushing, for >> bisection. Let me know if you'd prefer I submit in that form. > > All 3 changesets are ok for 4.7. > > I think it's fine to commit them separately if you prefer. If so, > preferably in the order #3, #1, #2 in order to keep every revision > buildable. > > Thanks for working on this! Just so we're clear... Currently while I do have a sourceware account, I'm not in the gcc group, so don't have commit access, sourceware$ id -a|grep gcc [Exit 1] so someone else would have to commit my changes. Or add me to the "gcc" group and I will do it. Another recently-approved change may be in limbo for this reason: avoid memory overrun in a test leading to potential double-free * testsuite/test-expandargv.c (writeout_test): Fix off-by-one error: i.e., do copy the trailing NUL byte.
Re: RFA/RFC: Enable both gold and ld in a single toolchain
On 08.03.2011 20:52, Diego Novillo wrote: > On Tue, Aug 17, 2010 at 04:58, Nick Clifton wrote: >> Hi Raymes, >> >>> What is the status of this patch? I see the binutils part applied but >>> not the gcc part. >>> >>> http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00402.html >> >> Mark Mitchell recently posted a review of the patch and it is currently in >> my queue of things to look at. Unfortunately I have a few other, higher >> priority tasks on my plate at the moment. But I will get back to the patch >> as soon as I can. >> >> Cheers >> Nick >> >> > Hey Nick, > > Any news on this patch? :) We may be interested in using it. I had updated it for the trunk, current state is (only) posted at http://sourceware.org/ml/binutils/2011-01/msg00287.html There is some interaction with the linker plugin options. Matthias
C++0x PATCH to add -fconstexpr-depth
The draft standard specifies a minimum limit of 512 recursive constexpr calls in order to avoid, say, recursing through the entire range of int. This patch adds a check for this recursion limit and a flag to change the limit. Tested x86_64-pc-linux-gnu, applying to trunk. commit caa7a7a82f9f99902a7116a8494c15d5c6dabd0f Author: Jason Merrill Date: Wed Jan 26 17:41:51 2011 -0500 c-family/ * c-common.c (max_constexpr_depth): New. * c-common.h: Declare it. * c-opts.c (c_common_handle_option): Set it. * c.opt (fconstexpr-depth): New option. cp/ * semantics.c (push_cx_call_context): Return bool. (cxx_eval_call_expression): Handle excess depth. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 4da9a2d..6674c58 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -255,12 +255,15 @@ int flag_use_repository; enum cxx_dialect cxx_dialect = cxx98; /* Maximum template instantiation depth. This limit exists to limit the - time it takes to notice infinite template instantiations; the default - value of 1024 is likely to be in the next C++ standard. */ + time it takes to notice excessively recursive template instantiations; + the default value of 1024 is likely to be in the next C++ standard. */ int max_tinst_depth = 1024; +/* Likewise, for constexpr function call evaluations. N3225 specifies a + minimum of 512. */ +int max_constexpr_depth = 512; /* The elements of `ridpointers' are identifier nodes for the reserved type names and storage classes. It is indexed by a RID_... value. */ diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 406def9..b6fcee9 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -619,10 +619,14 @@ extern enum cxx_dialect cxx_dialect; /* Maximum template instantiation depth. This limit is rather arbitrary, but it exists to limit the time it takes to notice - infinite template instantiations. */ + excessively recursive template instantiations. */ extern int max_tinst_depth; +/* Likewise, for constexpr function call evaluations. */ + +extern int max_constexpr_depth; + /* Nonzero means that we should not issue warnings about problems that occur when the code is executed, because the code being processed is not expected to be executed. This is set during parsing. This diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 8d6e6e7..8d2a08b 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -568,6 +568,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, disable_builtin_function (arg); break; +case OPT_fconstexpr_depth_: + max_constexpr_depth = value; + break; + case OPT_fdirectives_only: cpp_opts->directives_only = value; break; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index bb928fa..f791190 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -719,6 +719,10 @@ fconstant-string-class= ObjC ObjC++ Joined MissingArgError(no class name specified with %qs) -fconst-string-class=Use class for constant strings +fconstexpr-depth= +C++ ObjC++ Joined RejectNegative UInteger +-constexpr-depth= Specify maximum constexpr recursion depth + fdeduce-init-list C++ ObjC++ Var(flag_deduce_init_list) Init(1) -fno-deduce-init-list disable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index a0f48c0e..53497f3 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5922,17 +5922,21 @@ cxx_bind_parameters_in_call (const constexpr_call *old_call, tree t, /* Variables and functions to manage constexpr call expansion context. These do not need to be marked for PCH or GC. */ +/* FIXME remember and print actual constant arguments. */ static VEC(tree,heap) *call_stack = NULL; static int call_stack_tick; static int last_cx_error_tick; -static void +static bool push_cx_call_context (tree call) { ++call_stack_tick; if (!EXPR_HAS_LOCATION (call)) SET_EXPR_LOCATION (call, input_location); VEC_safe_push (tree, heap, call_stack, call); + if (VEC_length (tree, call_stack) > (unsigned) max_constexpr_depth) +return false; + return true; } static void @@ -5967,6 +5971,9 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, tree result; constexpr_call new_call = { NULL, NULL, NULL, 0 }; constexpr_call **slot; + constexpr_call *entry; + bool depth_ok; + if (TREE_CODE (fun) != FUNCTION_DECL) { /* Might be a constexpr function pointer. */ @@ -6029,7 +6036,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, if (*non_constant_p) return t; - push_cx_call_context (t); + depth_ok = push_cx_call_context (t); new_call.hash = iterative_hash_template_arg (new_call.bindings, @@ -6039,37 +604
[PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.
Hi, This patch fixes the problem in bug 48123. The problem is that some headers include c++config.h, which in turn includes cpu_defines.h but cpu_defines.h is not installed. This has been broken for a long time. Patch was tested by bootstrapping on x86_64 and building a cross-gcc for arm-linux-gnueabi in freestanding mode. -Doug 2011-03-14 Doug Kwan * include/Makefile.am (install-freestanding-headers): Install cpu_defines.h * include/Makefile.in: Regenerate. Index: gcc/libstdc++-v3/include/Makefile.in === --- gcc/libstdc++-v3/include/Makefile.in(revision 170944) +++ gcc/libstdc++-v3/include/Makefile.in(working copy) @@ -1584,7 +1584,8 @@ ${pch3_output}: ${pch3_source} ${pch2_output} install-freestanding-headers: $(mkinstalldirs) $(DESTDIR)${gxx_include_dir} $(mkinstalldirs) $(DESTDIR)${host_installdir} - for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h; do \ + for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h \ + ${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir} $(INSTALL_DATA) ${std_builddir}/limits $(DESTDIR)${gxx_include_dir}/${std_builddir} Index: gcc/libstdc++-v3/include/Makefile.am === --- gcc/libstdc++-v3/include/Makefile.am(revision 170944) +++ gcc/libstdc++-v3/include/Makefile.am(working copy) @@ -1200,7 +1200,8 @@ endif install-freestanding-headers: $(mkinstalldirs) $(DESTDIR)${gxx_include_dir} $(mkinstalldirs) $(DESTDIR)${host_installdir} - for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h; do \ + for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h \ + ${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir} $(INSTALL_DATA) ${std_builddir}/limits $(DESTDIR)${gxx_include_dir}/${std_builddir}
C++ PATCH for core 1074 (specification of dependency of noexcept-expression)
Nobody could think of a reason why value-dependency of the operand of a noexcept-expression should make the noexcept itself value-dependent, so it's dropped. Tested x86_64-pc-linux-gnu, applying to trunk. commit dc2157101b5083c82984936144097fb484bdbad4 Author: Jason Merrill Date: Wed Nov 10 17:57:43 2010 -0600 * pt.c (value_dependent_expression_p) [NOEXCEPT_EXPR]: Don't check value_dependent_expression_p on the operand. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 95b82ee..c8c1010 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18143,9 +18143,7 @@ value_dependent_expression_p (tree expression) case NOEXCEPT_EXPR: expression = TREE_OPERAND (expression, 0); - /* FIXME why check value-dependency? */ - return (type_dependent_expression_p (expression) - || value_dependent_expression_p (expression)); + return type_dependent_expression_p (expression); case SCOPE_REF: {
Re: [PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.
Hi, Hi, This patch fixes the problem in bug 48123. The problem is that some headers include c++config.h, which in turn includes cpu_defines.h but cpu_defines.h is not installed. This has been broken for a long time. Patch was tested by bootstrapping on x86_64 and building a cross-gcc for arm-linux-gnueabi in freestanding mode. unless either Jakub, the release managers, or the libstdc++ maintainers manifest contrary opinions over the next few hours, I say Ok both mainline and 4_6-branch. Paolo.
Re: [PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.
... in any case, remember to add "PR libstdc++/48123" on top of the ChangeLog entry otherwise Bugzilla will not pick the commit. Paolo.
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
> I think we agreed that it would be useful to regenerate the Solaris 2 > libstdc++ baselines close to the GCC 4.6.0 release, especially given > that symbol versioning on Solaris appears in 4.6.0 for the first time > and several symbols have been added to the libstdc++.so ABI since the > last update. I agree we should do this for 4.6.0, but I disagree as to what the exact exports should be. -benjamin
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
> The lines in question are > > ##_ZTISt16nested_exception (glob) > _ZTISt16nested_exception; > ##_ZTSSt16nested_exception (glob) > _ZTSSt16nested_exception; > ##_ZTVSt16nested_exception (glob) > _ZTVSt16nested_exception; > > in CXXABI_1.3.5, but the same symbols are also matched by > > ##_ZTISt[0-9][0-9][m-q]* (glob) > ##_ZTSSt[0-9][0-9][m-q]* (glob) > ##_ZTVSt[0-9][0-9][m-q]* (glob) > > in GLIBCXX_3.4. I fear that I need to update contrib/make_sunver.pl > to handle this, but would need to know the exact semantics of such a > version script first. Here's a patch that makes this exports crystal clear. FWIW, the linux exports for these nested_exception symbols were in GLIBCXX_3.15 which was correct. This is still the case, even with the explicit carve-outs in the patch below. I've also changed the bad_function_call exports to not be in libsupc++, or the freestanding version. (ie to GLIBCXX from CXXABI). I think this was probably a simple thinko, right Paolo? If it's not, I'm not sure of the rationale and would appreciate any commentary. best, benjamin2011-03-15 Benjamin Kosnik * config/abi/pre/gnu.ver: Make nested_exception exports super clear. Move bad_function_call exports from CXXABI_1.3.5 to GLIBCXX_3.4.15. Index: config/abi/pre/gnu.ver === --- config/abi/pre/gnu.ver (revision 171002) +++ config/abi/pre/gnu.ver (working copy) @@ -618,7 +618,10 @@ _ZTVSt[0-9][0-9][g-k]*; _ZTVSt11logic_error; _ZTVSt12length_error; -_ZTVSt[0-9][0-9][m-q]*; +# _ZTVSt[0-9][0-9][m-q]*; +_ZTVSt[0-9][0-9][m]*; +_ZTVSt[0-9][0-9]n[^e]*; +_ZTVSt[0-9][0-9][o-q]*; _ZTVSt11range_error; _ZTVSt13runtime_error; _ZTVSt[0-9][0-9][t-z]*; @@ -648,7 +651,10 @@ _ZTISt[0-9][0-9][g-k]*; _ZTISt11logic_error; _ZTISt12length_error; -_ZTISt[0-9][0-9][m-q]*; +# _ZTISt[0-9][0-9][m-q]*; +_ZTISt[0-9][0-9][m]*; +_ZTISt[0-9][0-9]n[^e]*; +_ZTISt[0-9][0-9][o-q]*; _ZTISt11range_error; _ZTISt13runtime_error; _ZTISt[0-9][0-9][t-z]*; @@ -682,7 +688,10 @@ _ZTSSt[0-9][0-9][g-k]*; _ZTSSt11logic_error; _ZTSSt12length_error; -_ZTSSt[0-9][0-9][m-q]*; +# _ZTSSt[0-9][0-9][m-q]*; +_ZTSSt[0-9][0-9][m]*; +_ZTSSt[0-9][0-9]n[^e]*; +_ZTSSt[0-9][0-9][o-q]*; _ZTSSt11range_error; _ZTSSt13runtime_error; _ZTSSt[0-9][0-9][t-z]*; @@ -1219,12 +1228,19 @@ _ZTISt11regex_error; _ZSt19__throw_regex_errorNSt15regex_constants10error_typeE; +# std::bad_weak_ptr _ZNSt12bad_weak_ptrD*; _ZNKSt12bad_weak_ptr4whatEv; _ZTSSt12bad_weak_ptr; _ZTVSt12bad_weak_ptr; _ZTISt12bad_weak_ptr; +# std::bad_function_call +_ZNSt17bad_function_callD*; +_ZTISt17bad_function_call; +_ZTSSt17bad_function_call; +_ZTVSt17bad_function_call; + _ZNSt14error_categoryC*; _ZNSt14error_categoryD*; @@ -1422,12 +1438,6 @@ # FNV hash. _ZSt15_Fnv_hash_bytesPKv*; -# std::bad_function_call. -_ZNSt17bad_function_callD*; -_ZTISt17bad_function_call; -_ZTSSt17bad_function_call; -_ZTVSt17bad_function_call; - # std::nested_exception _ZNSt16nested_exceptionD*; _ZTISt16nested_exception;
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
On 03/15/2011 08:05 PM, Benjamin Kosnik wrote: I've also changed the bad_function_call exports to not be in libsupc++, or the freestanding version. (ie to GLIBCXX from CXXABI). I think this was probably a simple thinko, right Paolo? Yes, as far as I can see now. Sorry about that and thanks for catching it in time! Paolo.
Re: [v3] typeinfo tuning
> Does exporting some of these symbols and vtables from the library mean > we're less able to change them? I'm not confident all ofthe C++0x > bits are entirely stable yet. Yes, it does. What are the new exports that concern you? There are some things I purposely did not include. For instance, . Some of can be further optimized for the void specializations, but I did not do that to give implementation flexibility in the future. > I see you've given future_base::_Result_base a virtual destructor, is > there a specific reason for that? Yes... > Destruction should always be via > the virtual _M_destroy function and so 'delete' is called in the final > overrider, where the static type and dynamic type are the same. The > virtual destructor adds unnecessary overhead, though it's probably > negligible. Yeah on negligible. I don't see the addition as a correctness issue, right? The __future_base nested classes don't seem to be changing all that much, but I will defer to you if you are uneasy about specific changes. Doing this may allow the control of all vague symbols in for standard instantiations in the future. best, -benjamin
Re: [PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.
> 2011-03-14 Doug Kwan > > * include/Makefile.am (install-freestanding-headers): Install > cpu_defines.h > * include/Makefile.in: Regenerate. Looks fine to me too. -benjamin
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
... and I suppose the thinko alone should be fixed in 4_6-branch too, right? Paolo.
Re: [PATCH][bug 48123] Install cpu_defines.h for freestanding C++ library.
On Tue, Mar 15, 2011 at 07:38:27PM +0100, Paolo Carlini wrote: > > This patch fixes the problem in bug 48123. The problem is that > >some headers include c++config.h, which in turn includes cpu_defines.h > >but cpu_defines.h is not installed. This has been broken for a long > >time. Patch was tested by bootstrapping on x86_64 and building a > >cross-gcc for arm-linux-gnueabi in freestanding mode. > unless either Jakub, the release managers, or the libstdc++ > maintainers manifest contrary opinions over the next few hours, I > say Ok both mainline and 4_6-branch. Yeah, this is fine for 4.6 branch. Jakub
[PATCH] Fix fallout of my fold_binary EQ/NE patch (PR middle-end/48136)
Hi! The addition of STRIP_NOPS for EQ_EXPR/NE_EXPR revealed a bunch of cases which rely on arg0 and arg1 having the same type. Only the last hunk fixes the testcase, the rest is what I saw and it was possible the types wouldn't match. Tried to construct testcases for the other cases, but didn't succeed, earlier folding already modified the operands so it didn't look like what the code was expecting. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-03-15 Jakub Jelinek PR middle-end/48136 * fold-const.c (fold_binary_loc) : Make sure arg0/arg1 or their arguments are always fold converted to matching types. * gcc.c-torture/compile/pr48136.c: New test. --- gcc/fold-const.c.jj 2011-03-15 09:47:12.0 +0100 +++ gcc/fold-const.c2011-03-15 17:13:29.0 +0100 @@ -12342,7 +12342,8 @@ fold_binary_loc (location_t loc, { tem = fold_build2_loc (loc, LSHIFT_EXPR, itype, arg01, arg001); tem = fold_build2_loc (loc, BIT_AND_EXPR, itype, arg000, tem); - return fold_build2_loc (loc, code, type, tem, arg1); + return fold_build2_loc (loc, code, type, tem, + fold_convert_loc (loc, itype, arg1)); } /* Otherwise, for signed (arithmetic) shifts, ((X >> C1) & C2) != 0 is rewritten as X < 0, and @@ -12393,8 +12394,10 @@ fold_binary_loc (location_t loc, tree notc = fold_build1_loc (loc, BIT_NOT_EXPR, TREE_TYPE (TREE_OPERAND (arg0, 1)), TREE_OPERAND (arg0, 1)); - tree dandnotc = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), - arg1, notc); + tree dandnotc + = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), + fold_convert_loc (loc, TREE_TYPE (arg0), arg1), + notc); tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node; if (integer_nonzerop (dandnotc)) return omit_one_operand_loc (loc, type, rslt, arg0); @@ -12407,8 +12410,10 @@ fold_binary_loc (location_t loc, && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) { tree notd = fold_build1_loc (loc, BIT_NOT_EXPR, TREE_TYPE (arg1), arg1); - tree candnotd = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), - TREE_OPERAND (arg0, 1), notd); + tree candnotd + = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), + TREE_OPERAND (arg0, 1), + fold_convert_loc (loc, TREE_TYPE (arg0), notd)); tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node; if (integer_nonzerop (candnotd)) return omit_one_operand_loc (loc, type, rslt, arg0); @@ -12483,13 +12488,13 @@ fold_binary_loc (location_t loc, if (TREE_CODE (arg0) == BIT_XOR_EXPR && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0)) return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), - build_int_cst (TREE_TYPE (arg1), 0)); + build_int_cst (TREE_TYPE (arg0), 0)); /* Likewise (X ^ Y) == X becomes Y == 0. X has no side-effects. */ if (TREE_CODE (arg0) == BIT_XOR_EXPR && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0) && reorder_operands_p (TREE_OPERAND (arg0, 1), arg1)) return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 1), - build_int_cst (TREE_TYPE (arg1), 0)); + build_int_cst (TREE_TYPE (arg0), 0)); /* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2). */ if (TREE_CODE (arg0) == BIT_XOR_EXPR @@ -12507,10 +12512,12 @@ fold_binary_loc (location_t loc, && integer_pow2p (TREE_OPERAND (arg0, 1))) { tem = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), -TREE_OPERAND (TREE_OPERAND (arg0, 0), 0), -TREE_OPERAND (arg0, 1)); +TREE_OPERAND (TREE_OPERAND (arg0, 0), 0), +TREE_OPERAND (arg0, 1)); return fold_build2_loc (loc, code == EQ_EXPR ? NE_EXPR : EQ_EXPR, - type, tem, arg1); + type, tem, + fold_convert_loc (loc, TREE_TYPE (arg0), + arg1)); } /* Fold ((X & C) ^ C) eq/ne 0 into (X & C) ne/eq 0, when the @@ -12554,8 +12561,9 @@ fold_binary_loc (location_t loc, if (TREE_CODE (arg0) == NEGATE_EXPR && TREE_CODE (arg1) == NEGATE_EXPR) return fold_build2_loc (loc, code, type, -
Re: [v3] Regenerate Solaris 2 baselines for GCC 4.6.0 release
> ... and I suppose the thinko alone should be fixed in 4_6-branch too, > right? Yeah. The versioning for the latest symbols has to match, or be done in a compatible way. But hang on, I'll wait on Rainer and move trunk to branch if he can confirm trunk is version-able on solaris. -benjamin
[PATCH][4.5] Fix backport of PR 47862 to 4.5 branch
The following changes are already present on trunk as part of the fix for PR44364. Not having them on 4.5 caused problems with the subject fix when trying to spill FP regs with a stack > 32K. Bootstrap/regtest 4.5 branch on powerpc with no new failures, ok for 4.5? -Pat 2011-03-15 Pat Haugen PR target/47862 * caller-save.c (insert_restore, insert_save): Use non-validate form of adjust_address. Index: gcc/caller-save.c === --- gcc/caller-save.c (revision 170999) +++ gcc/caller-save.c (working copy) @@ -1215,7 +1215,7 @@ insert_restore (struct insn_chain *chain /* Check that insn to restore REGNO in save_mode[regno] is correct. */ && reg_save_code (regno, save_mode[regno]) >= 0) -mem = adjust_address (mem, save_mode[regno], 0); +mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem); @@ -1296,7 +1296,7 @@ insert_save (struct insn_chain *chain, i /* Check that insn to save REGNO in save_mode[regno] is correct. */ && reg_save_code (regno, save_mode[regno]) >= 0) -mem = adjust_address (mem, save_mode[regno], 0); +mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem);
Re: [v3] typeinfo tuning
On 15 March 2011 19:19, Benjamin Kosnik wrote: > >> Does exporting some of these symbols and vtables from the library mean >> we're less able to change them? I'm not confident all ofthe C++0x >> bits are entirely stable yet. > > Yes, it does. What are the new exports that concern you? thread::_Impl_base was one I'd been prototyping some changes to. If we need to rework it in order for thread::id to be a trivially-copyable (and less-than-comparable) type then we might need additional virtuals in Impl_base, but as all I have are untested ideas for now it probably shouldn't hold up the changes. We could always preserve the old type and use a new one for any rework needed. > There are some things I purposely did not include. For instance, > . Some of can be further optimized for the void > specializations, but I did not do that to give implementation > flexibility in the future. > >> I see you've given future_base::_Result_base a virtual destructor, is >> there a specific reason for that? > > Yes... > >> Destruction should always be via >> the virtual _M_destroy function and so 'delete' is called in the final >> overrider, where the static type and dynamic type are the same. The >> virtual destructor adds unnecessary overhead, though it's probably >> negligible. > > Yeah on negligible. I don't see the addition as a correctness issue, > right? The __future_base nested classes don't seem to be changing all > that much, but I will defer to you if you are uneasy about specific > changes. > > Doing this may allow the control of all vague symbols in for > standard instantiations in the future. OK, I'm not objecting to the change as all I have is a non-specific sense of unease and the advantages outweigh my slight uneasiness :)
Re: [C++0x patch] constexpr in attribute argument
Applied on trunk. Jason
Minor VRP jump threading improvement
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I noticed that VRP was missing many obvious jump threading opportunities; investigation showed that it wasn't threading through conditionals with pointer types, just those with integral types. Fix is rather obvious. Bootstrapped and regression tested on x86_64-unknown-linux-gnu. OK for trunk? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNf9wXAAoJEBRtltQi2kC7i3gH+wS6SZNEVwMeHrx04LkRUV7i hdWsBKWoWxFCm/JjIVEXkticztRGG2cF6OgtTutXCyYHriVXpHvJSATw0OrYLT2y zMjj1+wy9NKcznIaulyYzCadoFiJUuTnZ3pMDGo+gqx7ThqrG11sJ581CnMtZWxA Y3tpUBebhovORi4IZOvp2atjIFEnI/CCttxzVyTXtzaflysDr6rbZP75z/AGANI4 5gkcDkLCEglGHYL6phT0fxHjZAUaIJN/JHTvZ4MGA6lJjO8wG/Z4ZnDmtUURhLiR z9th3gBzFtdjlkwcu8U1qulXDaxbMEmLLP3zMgmFthvI+PmqITsoshu3c7nn154= =yWE3 -END PGP SIGNATURE- * tree-vrp.c (identify_jump_threads): Also allow comparisons with pointers. Index: tree-vrp.c === *** tree-vrp.c (revision 170949) --- tree-vrp.c (working copy) *** identify_jump_threads (void) *** 7540,7549 /* We're basically looking for any kind of conditional with integral type arguments. */ if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME ! && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))) && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME || is_gimple_min_invariant (gimple_cond_rhs (last))) ! && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_rhs (last { edge_iterator ei; --- 7540,7551 /* We're basically looking for any kind of conditional with integral type arguments. */ if (TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME ! && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))) ! || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (last && (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME || is_gimple_min_invariant (gimple_cond_rhs (last))) ! && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_rhs (last))) ! || POINTER_TYPE_P (TREE_TYPE (gimple_cond_rhs (last) { edge_iterator ei;
Re: [Patch][AVR]: Support tail calls
On 03/11/2011 05:43 AM, Georg-Johann Lay wrote: > I did not find a way to make this work together with -mcall-prologues. > Please let me know if you have suggestion on how call prologues can be > combine with tail calls. You need a new symbol in libgcc for this. It should be easy enough to have the sibcall epilogue load up Z+EIND before jumping to the new symbol (perhaps called __sibcall_restores__). This new symbol would be just like the existing __epilogue_restores__ except that it would finish with an eijmp/ijmp instruction (depending on multilib) instead of a ret instruction. > The implementation uses struct machine_function to pass information > around, i.e. from avr_function_arg_advance to avr_function_ok_for_sibcall. Look at how the s390 port handles this exact problem. /* Register 6 on s390 is available as an argument register but unfortunately "caller saved". This makes functions needing this register for arguments not suitable for sibcalls. */ return !s390_call_saved_register_used (exp); I'll admit that it would be helpful if the cumulative_args pointer was passed into the ok_for_sibcall hook, but it's not *that* hard to recreate that value by hand. This is what the s390_call_saved_register_used function does. > + || (avr_OS_task_function_p (decl_callee) ^ avr_OS_task_function_p > (current_function_decl)) Please just use != instead of ^ here. Also, needs line wrapping. I do like very much how you've cleaned up the call patterns. IMO this should be committed as a separate patch; I'll let the AVR maintainers approve it though. r~ > > Regards, Johann > > > 2011-03-10 Georg-Johann Lay > > * config/avr/avr-protos.h (expand_epilogue): Change prototype > * config/avr/avr.h (struct machine_function): Add field > sibcall_fails. > * config/avr/avr.c (init_cumulative_args, > avr_function_arg_advance): Use it. > * config/avr/avr.c (expand_epilogue): Add bool parameter. Handle > sibcall epilogues. > (TARGET_FUNCTION_OK_FOR_SIBCALL): Define to... > (avr_function_ok_for_sibcall): ...this new function. > (avr_lookup_function_attribute1): New static Function. > (avr_naked_function_p, interrupt_function_p, > signal_function_p, avr_OS_task_function_p, > avr_OS_main_function_p): Use it. > * config/avr/avr.md ("sibcall", "sibcall_value", > "sibcall_epilogue"): New expander. > ("*call_insn", "*call_value_insn"): New insn. > ("call_insn", "call_value_insn"): Remove > ("call", "call_value", "epilogue"): Change expander to handle > sibling calls.
[PATCH] Fix RTL DSE compile time hog (PR rtl-optimization/48141)
Hi! On the attached testcase we spend > 7 minutes in RTL DSE, as we end up with active_local_stores chain with up to 10 entries and we walk it through on each store. The following patch fixes it by throwing away from active_local_stores list stores that don't have any positions needed, but can't be deleted (I believe such stores aren't helpful at all in the list, we aren't going to remove them anyway, and they can't be used by replace_read either). Alternatively (or in addition to this) we might remember the length of the active_local_stores list and just drop it on the floor when it becomes too long (say over 5000 stores or something similar, perhaps a param). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk (and after a while for 4.6)? 2011-03-15 Jakub Jelinek PR rtl-optimization/48141 * dse.c (record_store): If no positions are needed in an insn that cannot be deleted, at least unchain it from active_local_stores. * gcc.dg/pr48141.c: New test. --- gcc/dse.c.jj2011-02-15 15:42:26.0 +0100 +++ gcc/dse.c 2011-03-15 21:25:59.0 +0100 @@ -1530,8 +1530,7 @@ record_store (rtx body, bb_info_t bb_inf /* An insn can be deleted if every position of every one of its s_infos is zero. */ - if (any_positions_needed_p (s_info) - || ptr->cannot_delete) + if (any_positions_needed_p (s_info)) del = false; if (del) @@ -1543,7 +1542,8 @@ record_store (rtx body, bb_info_t bb_inf else active_local_stores = ptr->next_local_store; - delete_dead_store_insn (insn_to_delete); + if (!insn_to_delete->cannot_delete) + delete_dead_store_insn (insn_to_delete); } else last = ptr; --- gcc/testsuite/gcc.dg/pr48141.c.jj 2011-03-15 21:48:46.0 +0100 +++ gcc/testsuite/gcc.dg/pr48141.c 2011-03-15 21:48:27.0 +0100 @@ -0,0 +1,17 @@ +/* PR rtl-optimization/48141 */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#define A i = 0; +#define B A A A A A A A A A A +#define C B B B B B B B B B B +#define D C C C C C C C C C C +#define E D D D D D D D D D D + +int +foo (void) +{ + volatile int i = 0; + E E E E E E E E E E E + return 0; +} Jakub
Re: [PATCH] Fix RTL DSE compile time hog (PR rtl-optimization/48141)
so how much time does this save? I agree that this is a useful simplification, but it seems unlikely to be that important in real code. it seems like the 5000 store test would in general provide a better safety valve. Kenny On 03/15/2011 07:05 PM, Jakub Jelinek wrote: Hi! On the attached testcase we spend> 7 minutes in RTL DSE, as we end up with active_local_stores chain with up to 10 entries and we walk it through on each store. The following patch fixes it by throwing away from active_local_stores list stores that don't have any positions needed, but can't be deleted (I believe such stores aren't helpful at all in the list, we aren't going to remove them anyway, and they can't be used by replace_read either). Alternatively (or in addition to this) we might remember the length of the active_local_stores list and just drop it on the floor when it becomes too long (say over 5000 stores or something similar, perhaps a param). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk (and after a while for 4.6)? 2011-03-15 Jakub Jelinek PR rtl-optimization/48141 * dse.c (record_store): If no positions are needed in an insn that cannot be deleted, at least unchain it from active_local_stores. * gcc.dg/pr48141.c: New test. --- gcc/dse.c.jj2011-02-15 15:42:26.0 +0100 +++ gcc/dse.c 2011-03-15 21:25:59.0 +0100 @@ -1530,8 +1530,7 @@ record_store (rtx body, bb_info_t bb_inf /* An insn can be deleted if every position of every one of its s_infos is zero. */ - if (any_positions_needed_p (s_info) - || ptr->cannot_delete) + if (any_positions_needed_p (s_info)) del = false; if (del) @@ -1543,7 +1542,8 @@ record_store (rtx body, bb_info_t bb_inf else active_local_stores = ptr->next_local_store; - delete_dead_store_insn (insn_to_delete); + if (!insn_to_delete->cannot_delete) + delete_dead_store_insn (insn_to_delete); } else last = ptr; --- gcc/testsuite/gcc.dg/pr48141.c.jj 2011-03-15 21:48:46.0 +0100 +++ gcc/testsuite/gcc.dg/pr48141.c 2011-03-15 21:48:27.0 +0100 @@ -0,0 +1,17 @@ +/* PR rtl-optimization/48141 */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#define A i = 0; +#define B A A A A A A A A A A +#define C B B B B B B B B B B +#define D C C C C C C C C C C +#define E D D D D D D D D D D + +int +foo (void) +{ + volatile int i = 0; + E E E E E E E E E E E + return 0; +} Jakub
Re: [PATCH] Fix RTL DSE compile time hog (PR rtl-optimization/48141)
On Tue, Mar 15, 2011 at 07:12:13PM -0400, Kenneth Zadeck wrote: > so how much time does this save? >From those 7 minutes back to 16 seconds (--enable-checking=yes, it was 4 seconds in 4.3 with release checking), DSE{1,2} takes each 1%, while previously it was together well over 99%. > I agree that this is a useful simplification, but it seems unlikely > to be that important in real code. Maybe, but it doesn't cost us anything, the comparison is just done at a slughtly different place. > it seems like the 5000 store test would in general provide a better > safety valve. Sure, I can try to implement that tomorrow. Jakub
Re: [v3] typeinfo tuning
> thread::_Impl_base was one I'd been prototyping some changes to. If we > need to rework it in order for thread::id to be a trivially-copyable > (and less-than-comparable) type then we might need additional virtuals > in Impl_base, but as all I have are untested ideas for now it probably > shouldn't hold up the changes. We could always preserve the old type > and use a new one for any rework needed. Eh, I'll revert this part. -benjamin
Re: [v3] typeinfo tuning
Like so. -benjamin2011-03-15 Benjamin Kosnik * include/std/thread: Revert. * src/thread.cc: Same. * config/abi/pre/gnu.ver: Same. Index: src/thread.cc === --- src/thread.cc (revision 171019) +++ src/thread.cc (working copy) @@ -54,8 +54,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION - thread::_Impl_base::~_Impl_base() = default; - void thread::join() { Index: include/std/thread === --- include/std/thread (revision 171019) +++ include/std/thread (working copy) @@ -100,7 +100,7 @@ { __shared_base_type _M_this_ptr; - virtual ~_Impl_base(); + inline virtual ~_Impl_base(); virtual void _M_run() = 0; }; @@ -195,6 +195,8 @@ } }; + inline thread::_Impl_base::~_Impl_base() = default; + inline void swap(thread& __x, thread& __y) { __x.swap(__y); } Index: config/abi/pre/gnu.ver === --- config/abi/pre/gnu.ver (revision 171019) +++ config/abi/pre/gnu.ver (working copy) @@ -1255,11 +1255,6 @@ _ZTSNSt13__future_base11_State_baseE; _ZTVNSt13__future_base11_State_baseE; -_ZNSt6thread10_Impl_baseD*; -_ZTINSt6thread10_Impl_baseE; -_ZTSNSt6thread10_Impl_baseE; -_ZTVNSt6thread10_Impl_baseE; - } GLIBCXX_3.4.14; # Symbols in the support library (libsupc++) have their own tag.
Re: [PATCH, committed] Refix 48053, do not abort in loading 0 into VSX register under 32-bit
This is a reduced version of the testcase that shows the bug that was fixed. However it is odd, in that the code that triggered the bug is setting hard register FR3 to 0 as a DImode value just before the call to __gcc_qmul to multiply the two long double values, so it needs some more looking into. 2011-03-15 Michael Meissner * gcc.target/powerpc/pr48053-3.c: New file, add test case for split problem of 0 being loaded in a VSX register. Index: gcc/testsuite/gcc.target/powerpc/pr48053-3.c === --- gcc/testsuite/gcc.target/powerpc/pr48053-3.c(revision 0) +++ gcc/testsuite/gcc.target/powerpc/pr48053-3.c(revision 0) @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O3 -mcpu=power7" } */ + +/* Cut down example from s_scalbnl that aborted on 32-bit when the fix for + 48053 went in to allow creating DImode 0's in VSX registers. */ + +typedef union +{ + long double value; + struct + { +unsigned long long msw; +unsigned long long lsw; + } parts64; + struct + { +unsigned int w0, w1, w2, w3; + } parts32; +} ieee854_long_double_shape_type; + +static const long double twolm54 = 5.55111512312578270212e-17; + +long double foo (long double x, int n) +{ + long long k, hx, lx; + ieee854_long_double_shape_type qw_u; + + qw_u.value = x; + hx = qw_u.parts64.msw; + lx = qw_u.parts64.lsw; + + k = ((hx >> 52) & 0x7ff) + n + 54; + + qw_u.parts64.msw = ((hx & 0x800fULL) | (k << 52)); + qw_u.parts64.lsw = lx; + x = qw_u.value; + + return x*twolm54; +} -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Re: [PATCH] Fix part of PR48037
On Tue, Mar 15, 2011 at 5:19 AM, Richard Guenther wrote: > > This avoids spilling SSE registers to memory just because we access > vector components in a C array way. The trick is to simply rewrite > those accesses to proper vector selects on the tree level and promote > the vector to SSA form. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. I think this fixes comment # 1 in PR 28367 and maybe even that PR. I think you should do the same for complex too (well use REAL_EXPR and IMAG_EXPR instead) (the complex issue was mention in comment #2 in PR 26134 and IIRC that shows up in damn benchmark as part of SPEC 2k6). Thanks, Andrew Pinski
[c++] refactor some data structures into cp/parser.h (issue4295052)
This patch refactors some data structures out of cp/parser.c into cp/parser.h and converts the main lexer buffer into a VEC. No functional changes, other than minor data structure tweaks: - The token buffer is now a VEC. - Instead of clobbering purged tokens, we have a purged_p marker bitfield. Patch approved by Jason. Tested on x86_64 with no new regressions. Barring objections, I will commit it in another 24 hours. 2011-03-15 Diego Novillo * Make-lang.in (CXX_PARSER_H): Define. (cp/cp-lang.o): Add dependency on CXX_PARSER_H. (cp/parser.o): Add dependency on CXX_PARSER_H and tree-pretty-print.h. * cp/cp-lang.c: Include parser.h. * parser.c: Include parser.h and tree-pretty-print.h (struct tree_check): Move to parser.h. (struct cp_lexer): Likewise. (struct cp_token_cache): Likewise. (struct cp_token_ident_d): Likewise. (CPP_KEYWORD): Likewise. (CPP_TEMPLATE_ID): Likewise. (CPP_NESTED_NAME_SPECIFIER): Likewise. (N_CP_TTYPES): Likewise. (enum cp_parser_status_kind): Likewise. (struct cp_parser_context): Likewise. (struct cp_default_arg_entry_d): Likewise. (struct cp_unparsed_functions_entry_d): Likewise. (struct cp_parser): Likewise. (struct cp_token): Likewise. Add field purged_p. Convert field buffer into a VEC. (CPP_PURGED): Remove. Replace all users with access to purged_p field. (cp_lexer_alloc): Factor out of ... (cp_lexer_new_main): ... here. (cp_lexer_print_token): Call print_generic_expr to show CPP_NUMBER tokens. Re-write lexer loop to call VEC_safe_push to store tokens. * config-lang.in (gtfiles): Add cp/parser.h. Index: gcc/cp/Make-lang.in === --- gcc/cp/Make-lang.in (revision 171013) +++ gcc/cp/Make-lang.in (working copy) @@ -243,7 +243,7 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h $(FUNCTION_H) \ $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) $(GGC_H) \ $(srcdir)/../include/hashtab.h - +CXX_PARSER_H = tree.h c-family/c-pragma.h cp/parser.h CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H) cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \ @@ -251,7 +251,7 @@ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) c-family/c-objc.h cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) debug.h langhooks.h \ $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h gt-cp-cp-lang.h \ - cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H) + cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H) $(CXX_PARSER_H) cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \ output.h toplev.h $(HASHTAB_H) $(RTL_H) \ cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \ @@ -316,7 +316,7 @@ cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $ gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H) cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \ gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \ - c-family/c-objc.h + c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \ $(TM_H) coretypes.h pointer-set.h tree-iterator.h Index: gcc/cp/cp-lang.c === --- gcc/cp/cp-lang.c(revision 171013) +++ gcc/cp/cp-lang.c(working copy) @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. #include "cp-objcp-common.h" #include "hashtab.h" #include "target.h" +#include "parser.h" enum c_language_kind c_language = clk_cxx; static void cp_init_ts (void); Index: gcc/cp/parser.c === --- gcc/cp/parser.c (revision 171013) +++ gcc/cp/parser.c (working copy) @@ -37,6 +37,8 @@ along with GCC; see the file COPYING3. #include "c-family/c-common.h" #include "c-family/c-objc.h" #include "plugin.h" +#include "tree-pretty-print.h" +#include "parser.h" /* The lexer. */ @@ -44,110 +46,11 @@ along with GCC; see the file COPYING3. /* The cp_lexer_* routines mediate between the lexer proper (in libcpp and c-lex.c) and the C++ parser. */ -/* A token's value and its associated deferred access checks and - qualifying scope. */ - -struct GTY(()) tree_check { - /* The value associated with the token. */ - tree value; - /* The checks that have been associated with value. */ - VEC (deferred_access_check, gc)* checks; - /* The token's qualifying scope (used when it is a - CPP_NESTED_NAME_SPECIFIER). */ - tree qualifying_scope; -}; - -/* A C++ token. */ - -typedef struct GTY (()) cp_token { - /* The kind of token. */ - ENUM_BITFIELD (cpp_ttype) type : 8; - /* If this token is a keyword, this value indicates which keyword. - Otherwise, this value is RID_MAX. */ - ENUM_BITFIELD (rid) keyword : 8; - /* Token flags. */
Re: [PATCH] Fix RTL DSE compile time hog (PR rtl-optimization/48141)
On Mar 15, 2011, at 4:05 PM, Jakub Jelinek wrote: > --- gcc/testsuite/gcc.dg/pr48141.c.jj 2011-03-15 21:48:46.0 +0100 > +++ gcc/testsuite/gcc.dg/pr48141.c2011-03-15 21:48:27.0 +0100 > @@ -0,0 +1,17 @@ > +/* PR rtl-optimization/48141 */ > +/* { dg-do compile } */ > +/* { dg-options "-O" } */ > + > +#define A i = 0; > +#define B A A A A A A A A A A > +#define C B B B B B B B B B B > +#define D C C C C C C C C C C > +#define E D D D D D D D D D D Long term, I'd welcome a systematic way to test all things like this, but without the expense.
Re: [PATCH] Add check before potentially dividing by 0
I have seen an ICE in 4.4.3 when a corrupted profile file causes a division by 0 in gcc. This is the equivalent code in trunk and this check should help fix it. Thoughts? 2011-03-15 Ahmad Sharif * predict.c (probably_never_executed_bb_p): Add check to see whether profile_info->runs is equal to 0 before doing the division. Index: predict.c === --- predict.c (revision 171019) +++ predict.c (working copy) @@ -200,7 +200,7 @@ bool probably_never_executed_bb_p (const_basic_block bb) { - if (profile_info && flag_branch_probabilities) + if (profile_info && flag_branch_probabilities && profile_info->runs != 0) return ((bb->count + profile_info->runs / 2) / profile_info->runs) == 0; if ((!profile_info || !flag_branch_probabilities) && cgraph_node (current_function_decl)->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)
[x32] PATCH: Properly save the x32 new stack boundary
Hi, I checked in this patch to properly save the x32 new stack boundary. H.J. --- commit 556b6e068c17f0b5775140c29cd5323014775b37 Author: H.J. Lu Date: Tue Mar 15 18:00:01 2011 -0700 Properly save the x32 new stack boundary. diff --git a/libgcc/ChangeLog.x32 b/libgcc/ChangeLog.x32 index d980b39..2fc9d48 100644 --- a/libgcc/ChangeLog.x32 +++ b/libgcc/ChangeLog.x32 @@ -1,3 +1,8 @@ +2011-03-15 H.J. Lu + + * config/i386/morestack.S: Properly save the x32 new stack + boundary. + 2011-02-14 H.J. Lu * config/i386/morestack.S: Replace __LP64___ with __LP64__. diff --git a/libgcc/config/i386/morestack.S b/libgcc/config/i386/morestack.S index 4496e3d..70a6e94 100644 --- a/libgcc/config/i386/morestack.S +++ b/libgcc/config/i386/morestack.S @@ -354,7 +354,11 @@ __morestack: # FIXME: The offset must match # TARGET_THREAD_SPLIT_STACK_OFFSET in # gcc/config/i386/linux64.h. +#ifdef __LP64__ movq%rax,%fs:0x70 # Save the new stack boundary. +#else + movl%eax,%fs:0x40 # Save the new stack boundary. +#endif call__morestack_unblock_signals @@ -392,7 +396,11 @@ __morestack: subq0(%rsp),%rax# Subtract available space. addq$BACKOFF,%rax # Back off 1024 bytes. .LEHE0: +#ifdef __LP64__ movq%rax,%fs:0x70 # Save the new stack boundary. +#else + movl%eax,%fs:0x40 # Save the new stack boundary. +#endif addq$16,%rsp# Remove values from stack. @@ -434,7 +442,11 @@ __morestack: movq%rbp,%rcx # Get the stack pointer. subq%rax,%rcx # Subtract available space. addq$BACKOFF,%rcx # Back off 1024 bytes. +#ifdef __LP64__ movq%rcx,%fs:0x70 # Save new stack boundary. +#else + movl%ecx,%fs:0x40 # Save new stack boundary. +#endif movq(%rsp),%rdi # Restore exception data for call. #ifdef __PIC__ call_Unwind_Resume@PLT # Resume unwinding. @@ -554,7 +566,11 @@ __stack_split_initialize: #else /* defined(__x86_64__) */ leaq-16000(%rsp),%rax # We should have at least 16K. +#ifdef __LP64__ movq%rax,%fs:0x70 +#else + movl%eax,%fs:0x40 +#endif movq%rsp,%rdi movq$16000,%rsi #ifdef __PIC__
Re: [PATCH] Updated DW_OP_GNU_entry_value/DW_TAG_GNU_call_site patch
On 03/15/2011 04:19 AM, Jakub Jelinek wrote: > Hi! > > Now that we are back in stage 1, I'd like move on with the > entry_value/call_site debug info extensions. > > Here is the http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01793.html > patch updated to current trunk, bootstrapped/regtested on x86_64-linux > and i686-linux. Ok for trunk? Ok. r~
Re: [PATCH] Updated ENTRY_VALUE patch (PR debug/45882)
On 03/15/2011 04:20 AM, Jakub Jelinek wrote: > Here is http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01794.html > patch updated to current trunk, bootstrapped/regtested on x86_64-linux and > i686-linux, ok for trunk? Ok. r~
Re: [PATCH] Adjustment to DW_TAG_GNU_call_site patch for ICF debug
On 03/15/2011 04:22 AM, Jakub Jelinek wrote: > Here is the > http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01795.html > patch updated to current trunk, bootstrapped/regtested on x86_64-linux > and i686-linux. Ok for trunk? Ok. r~
Re: [PATCH] Remove -fenable-icf-debug support
On 03/15/2011 04:25 AM, Jakub Jelinek wrote: > As Cary said there are no consumers of the .debug_dcall/.debug_vcall > sections yet and DW_TAG_GNU_call_site info should contain a superset > of that information, this patch removes -fenable-icf-debug support, > if you think it is desirable to remove it. > Bootstrapped/regtested on x86_64-linux and i686-linux. Ok. r~
Re: [x32] PATCH: Update gcc.target/i386 for x32
On Tue, Mar 15, 2011 at 10:50:33AM -0700, H.J. Lu wrote: > On Sat, Mar 12, 2011 at 03:29:30PM -0800, H.J. Lu wrote: > > On Sat, Mar 12, 2011 at 02:44:26PM -0800, H.J. Lu wrote: > > > Many tests gcc.target/i386 use ilp32 to check ia32 and use lp64 to > > > check hardware long long support. I checked in this to fix it. > > > > > > > > > > Another patch. > > > > > > Another 2 patches. > Updates. H.J. >From 7e2d3432a20f64d2ca8beeffb436e22d55eb3630 Mon Sep 17 00:00:00 2001 From: H.J. Lu Date: Tue, 15 Mar 2011 19:59:48 -0700 Subject: [PATCH 1/2] Properly check ilp32, ia32 and x32. --- gcc/testsuite/ChangeLog.x32 |7 +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c | 60 +++--- gcc/testsuite/gcc.dg/tree-ssa/stdarg-3.c | 44 +++--- gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c | 16 gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c | 14 +++--- 5 files changed, 74 insertions(+), 67 deletions(-) diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32 index f93c01c..59e3d21 100644 --- a/gcc/testsuite/ChangeLog.x32 +++ b/gcc/testsuite/ChangeLog.x32 @@ -1,5 +1,12 @@ 2011-03-15 H.J. Lu + * gcc.dg/tree-ssa/stdarg-2.c: Properly check ilp32, ia32 and x32. + * gcc.dg/tree-ssa/stdarg-3.c: Likewise. + * gcc.dg/tree-ssa/stdarg-4.c: Likewise. + * gcc.dg/tree-ssa/stdarg-5.c: Likewise. + +2011-03-15 H.J. Lu + * gcc.target/i386/pr48037-1.c: Also allow x32. 2011-03-15 H.J. Lu diff --git a/gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c index e7a2447..a864399 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c @@ -21,8 +21,8 @@ f1 (int i, ...) va_start (ap, i); va_end (ap); } -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ia32 } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { x32 || lp64 } } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ @@ -41,8 +41,8 @@ f2 (int i, ...) } /* Assume the counters can be number of registers or bytes on 32-bit architecture or bytes on 64-bit architecture. */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ia32 } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { x32 || lp64 } } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ @@ -57,8 +57,8 @@ f3 (int i, ...) d = va_arg (ap, double); va_end (ap); } -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ia32 } } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { x32 || lp64 } } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { d
[x32] PATCH: Also check x32 for vect_cmdline_needed target.
x32 is similar to x86-64. I checked this patch into x32 branch. H.J. --- diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32 index 32c3e34..9bcf223 100644 --- a/gcc/testsuite/ChangeLog.x32 +++ b/gcc/testsuite/ChangeLog.x32 @@ -1,5 +1,10 @@ 2011-03-15 H.J. Lu + * lib/target-supports.exp (check_effective_target_vect_cmdline_needed): + Also check x32. + +2011-03-15 H.J. Lu + * gcc.dg/20050503-1.c: Check ia32 instead of ilp32. * gcc.dg/builtin-apply4.c: Likewise. * gcc.dg/pr35045.c: Likewise. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f46c734..01f7a65 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1715,7 +1715,8 @@ proc check_effective_target_vect_cmdline_needed { } { if { [istarget alpha*-*-*] || [istarget ia64-*-*] || (([istarget x86_64-*-*] || [istarget i?86-*-*]) -&& [check_effective_target_lp64]) +&& ([check_effective_target_x32] +|| [check_effective_target_lp64])) || ([istarget powerpc*-*-*] && ([check_effective_target_powerpc_spe] || [check_effective_target_powerpc_altivec]))
Re: [libgfortran, build] Remove AC_TRY_* macros from libgfortran configury
* FX wrote on Tue, Mar 15, 2011 at 10:33:01AM CET: > The attached patch replaces the deprecated AC_TRY_{COMPILE,LINK,RUN} > macros in libgfortran configury with their AC_*_IFELSE equivalents. > Now (4.7 just branched) seems a good time, and I think I didn't screw > it too much because the regenerated configure file only has whitespace > changes. Still, I'd like to have the opinion of a build maintainer or > autoconf guru. > > Bootstrapped and regtested on x86_64-darwin. > > OK to commit to trunk? Yes, thanks. Out of curiosity, did you update these manually, or did you run autoupdate on the files? Thanks, Ralf
[patch] Enhance conditional store sinking
Hi, This patch adds a support of conditional store sinking for cases with multiple data references in then and else basic blocks. The correctness of the transformation is checked by verifying that there are no read-after-write and write-after-write dependencies. Bootstrapped and tested on powerpc64-suse-linux. OK for trunk? Thanks, Ira ChangeLog: * tree-data-ref.c (dr_equal_offsets_p1): Moved and renamed from tree-vect-data-refs.c vect_equal_offsets. (dr_equal_offsets_p): New function. * tree-data-ref.h (dr_equal_offsets_p): Declare. * tree-vect-data-refs.c (vect_equal_offsets): Move to tree-data-ref.c. (vect_drs_dependent_in_basic_block): Update calls to vect_equal_offsets. (vect_check_interleaving): Likewise. * tree-ssa-phiopt.c: Include cfgloop.h and tree-data-ref.h. (cond_if_else_store_replacement): Rename to... (cond_if_else_store_replacement_1): ... this. Change arguments and documentation. (cond_if_else_store_replacement): New function. * Makefile.in (tree-ssa-phiopt.o): Adjust dependencies. testsuite/ChangeLog: * gcc.dg/vect/vect-cselim-1.c: New test. Index: tree-data-ref.c === --- tree-data-ref.c (revision 170712) +++ tree-data-ref.c (working copy) @@ -991,6 +991,48 @@ create_data_ref (loop_p nest, loop_p loop, tree me return dr; } +/* Check if OFFSET1 and OFFSET2 (DR_OFFSETs of some data-refs) are identical + expressions. */ +static bool +dr_equal_offsets_p1 (tree offset1, tree offset2) +{ + bool res; + + STRIP_NOPS (offset1); + STRIP_NOPS (offset2); + + if (offset1 == offset2) + return true; + + if (TREE_CODE (offset1) != TREE_CODE (offset2) + || (!BINARY_CLASS_P (offset1) && !UNARY_CLASS_P (offset1))) + return false; + + res = dr_equal_offsets_p1 (TREE_OPERAND (offset1, 0), + TREE_OPERAND (offset2, 0)); + + if (!res || !BINARY_CLASS_P (offset1)) + return res; + + res = dr_equal_offsets_p1 (TREE_OPERAND (offset1, 1), + TREE_OPERAND (offset2, 1)); + + return res; +} + +/* Check if DRA and DRB have equal offsets. */ +bool +dr_equal_offsets_p (struct data_reference *dra, + struct data_reference *drb) +{ + tree offset1, offset2; + + offset1 = DR_OFFSET (dra); + offset2 = DR_OFFSET (drb); + + return dr_equal_offsets_p1 (offset1, offset2); +} + /* Returns true if FNA == FNB. */ static bool Index: tree-data-ref.h === --- tree-data-ref.h (revision 170712) +++ tree-data-ref.h (working copy) @@ -430,6 +430,8 @@ extern void compute_all_dependences (VEC (data_ref extern void create_rdg_vertices (struct graph *, VEC (gimple, heap) *); extern bool dr_may_alias_p (const struct data_reference *, const struct data_reference *); +extern bool dr_equal_offsets_p (struct data_reference *, + struct data_reference *); /* Return true when the base objects of data references A and B are @@ -755,5 +757,4 @@ lambda_matrix_new (int m, int n, struct obstack *l return mat; } - #endif /* GCC_TREE_DATA_REF_H */ Index: tree-vect-data-refs.c === --- tree-vect-data-refs.c (revision 170712) +++ tree-vect-data-refs.c (working copy) @@ -289,39 +289,6 @@ vect_update_interleaving_chain (struct data_refere } } - -/* Function vect_equal_offsets. - - Check if OFFSET1 and OFFSET2 are identical expressions. */ - -static bool -vect_equal_offsets (tree offset1, tree offset2) -{ - bool res; - - STRIP_NOPS (offset1); - STRIP_NOPS (offset2); - - if (offset1 == offset2) - return true; - - if (TREE_CODE (offset1) != TREE_CODE (offset2) - || (!BINARY_CLASS_P (offset1) && !UNARY_CLASS_P (offset1))) - return false; - - res = vect_equal_offsets (TREE_OPERAND (offset1, 0), - TREE_OPERAND (offset2, 0)); - - if (!res || !BINARY_CLASS_P (offset1)) - return res; - - res = vect_equal_offsets (TREE_OPERAND (offset1, 1), - TREE_OPERAND (offset2, 1)); - - return res; -} - - /* Check dependence between DRA and DRB for basic block vectorization. If the accesses share same bases and offsets, we can compare their initial constant offsets to decide whether they differ or not. In case of a read- @@ -352,7 +319,7 @@ vect_drs_dependent_in_basic_block (struct data_ref || TREE_CODE (DR_BASE_ADDRESS (drb)) != ADDR_EXPR || TREE_OPERAND (DR_BASE_ADDRESS (dra), 0) != TREE_OPERAND (DR_BASE_ADDRESS (drb),0))) - || !vect_equal_offsets (DR_OFFSET (dra), DR_OFFSET (drb))) + || !dr_equal_offsets_p (dra, drb)) return true; /* Check the types. */ @@ -402,7 +369,7 @@ vect_check_interleaving (struct data_reference *dr || TREE_CODE (DR_BASE_ADDRESS