Re: [PATCH, SMS 2/3] Skip DEBUG_INSNs while recognizing doloop
Hello, + if (reg_mentioned_p (reg, insn) !DEBUG_INSN_P (insn)) It probably makes sense to test for !DEBUG_INSN_P first, since it's much cheaper. Thanks, will commit the following to fix that: * modulo-sched.c (doloop_register_get): Check !DEBUG_INSN_P first. Index: modulo-sched.c === --- modulo-sched.c (revision 173693) +++ modulo-sched.c (working copy) @@ -316,7 +316,7 @@ doloop_register_get (rtx head ATTRIBUTE_ : prev_nondebug_insn (tail)); for (insn = head; insn != first_insn_not_to_check; insn = NEXT_INSN (insn)) -if (reg_mentioned_p (reg, insn) !DEBUG_INSN_P (insn)) +if (!DEBUG_INSN_P (insn) reg_mentioned_p (reg, insn)) { if (dump_file) { Revital
Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
On Wed, May 11, 2011 at 5:46 PM, Kai Tietz ktiet...@googlemail.com wrote: 2011/5/11 Richard Guenther richard.guent...@gmail.com: The most important thing is to get predicate types sane - that affects tcc_comparison codes and the TRUTH_* codes. After that, the TRUTH_* codes are redundant with the BIT_* ones which already are always validly typed. As fold already converts some TRUTH_* to BIT_* variants we usually have a mix of both which is not handled very well by tree optimizers. Well, to boolify comparisions isn't that hard at all, but I don't see here much improvement, as it will lead necessarily for uses without boolean-type always in gimple as '(type) comparison_tcc-ssa', which seems to me like trying to put the cart before the horse. Well, it's of course a matter of consistency. So updated patch inlined (and attached). The type-casting for TRUTH_ANDIF/ORIF is still necessary (without it I get bootstrap failures due perfectly working gimple_cond_expr function, which is producing here happily iftmp variables assigning later on wrong type. Hm, I see ... Regards, Kai Index: gcc/gcc/gimplify.c === --- gcc.orig/gcc/gimplify.c 2011-05-11 17:03:24.853377700 +0200 +++ gcc/gcc/gimplify.c 2011-05-11 17:11:02.018281300 +0200 @@ -2824,9 +2824,6 @@ gimple_boolify (tree expr) } } - if (TREE_CODE (type) == BOOLEAN_TYPE) - return expr; - switch (TREE_CODE (expr)) { case TRUTH_AND_EXPR: @@ -2851,6 +2848,8 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ + if (TREE_CODE (type) == BOOLEAN_TYPE) + return expr; return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -6762,6 +6761,21 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, this happens. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE) + { + *expr_p = fold_convert (org_type, *expr_p); + ret = GS_OK; + break; + } I suppose it makes sense to be consistent with the other TRUTH_* exprs. But when looking at the further context - we call into gimplify_boolean_expr - the conversion back to the original type is not necessary. So I would prefer to inline gimplify_boolean_expr at this single caller location and simply gimple_boolify (*expr_p) without doing the conversion back. Thus, @@ -6762,9 +6761,22 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - /* Pass the source location of the outer expression. */ - ret = gimplify_boolean_expr (expr_p, saved_location); - break; + { + /* Preserve the original type of the expression and the + source location of the outer expression. */ + tree org_type = TREE_TYPE (*expr_p); + *expr_p = gimple_boolify (*expr_p); + *expr_p = build3_loc (saved_location, COND_EXPR, + org_type, *expr_p, + fold_convert_loc +(saved_location, + org_type, boolean_true_node), + fold_convert_loc +(saved_location, + org_type, boolean_false_node)); + ret = GS_OK; + break; + } case TRUTH_NOT_EXPR: if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) and remove the then unused function. Ok with that change if it passes bootstrap and regtest for all languages. Thanks, Richard. + } /* Pass the source location of the outer expression. */ ret = gimplify_boolean_expr (expr_p, saved_location); break; @@ -7203,6 +7217,22 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, this happens. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE) + { + *expr_p = fold_convert (org_type, *expr_p); + ret =
Re: [PATCH] fix PR middle-end/48965, CASE_CHAIN fallout
On Wed, May 11, 2011 at 9:22 PM, Nathan Froyd froy...@codesourcery.com wrote: The comment for pointer_map_traverse says: /* Pass each pointer in PMAP to the function in FN, together with the pointer to the value and the fixed parameter DATA. If FN returns false, the iteration stops. */ However, the code in tree-cfg:edge_to_cases_cleanup does: static bool edge_to_cases_cleanup (const void *key ATTRIBUTE_UNUSED, void **value, void *data ATTRIBUTE_UNUSED) { tree t, next; for (t = (tree) *value; t; t = next) { next = CASE_CHAIN (t); CASE_CHAIN (t) = NULL; } *value = NULL; return false; } ... pointer_map_traverse (edge_to_cases, edge_to_cases_cleanup, NULL); which means that we're only cleaning up one of the case chains stored in EDGE_TO_CASES. Since it's a pointer_map, we can potentially get different chains selected each time. Under -fcompare-debug, this leads to problems later on when we walk the function body and collect all the DECLs referenced therein; we might walk non-NULL CASE_CHAINs and reach more DECLs, depending on the memory layout. This wouldn't have shown up previously, since TREE_CHAIN was used, and we wouldn't walk TREE_CHAIN of expressions to find DECLs. The fix is simple: return true from the above function! I've added logic to verify_expr to catch this sort of thing. Tested on x86_64-unknown-linux-gnu. OK to commit? Ok. Thanks, Richard. -Nathan gcc/ PR middle-end/48965 * tree-cfg.c (edge_to_cases_cleanup): Return true. (verify_expr) [CASE_LABEL_EXPR]: Add checking. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e1f8707..e2e84a2 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -843,7 +843,7 @@ edge_to_cases_cleanup (const void *key ATTRIBUTE_UNUSED, void **value, } *value = NULL; - return false; + return true; } /* Start recording information mapping edges to case labels. */ @@ -2830,6 +2830,14 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) *walk_subtrees = 0; break; + case CASE_LABEL_EXPR: + if (CASE_CHAIN (t)) + { + error (invalid CASE_CHAIN); + return t; + } + break; + default: break; }
Re: [PATCH] comment precising need to use free_dominance_info
On Thu, May 12, 2011 at 12:14 AM, pier...@pvittet.com wrote: After using function flow_loops_find in cfgloop.c, it is needed to use free_dominance_info to clear structure which have beend added by the use of calculate_dominance_info. I have added a comment precising this. My contributor number is 634276. The patch is not correct. Keeping dom info live is ok. Richard. ChangeLog: 2011-05-11 Pierre Vittet pier...@pvittet.com * cfgloop.c (flow_loops_find): Add comment remembering to call free_dominance_info
Re: [Patch, IRA] Fix a function accessing beyond end-of-array
On Thu, May 12, 2011 at 10:09:42AM +0100, Hari Sandanagobalane wrote: The REGNO_REG_CLASS is generally an array of size FIRST_PSEUDO_REGISTER. So, the indexes go from 0 to FIRST_PSEUDO_REGISTER-1. That is true. I think the = condition is fine in that case. Do you agree? That is wrong. It is perfectly fine to handle hard reg with regno (FIRST_PSEUDO_REGISTER - 1) if it has nregs 1, or hard reg with regno (FIRST_PSEUDO_REGISTER - 2) if it has nregs 1 or 2. The following loop starts with nregs--, therefore for hard_regno + nregs == FIRST_PSEUDO_REGISTER at the place of your test REGNO_REG_CLASS will be used in the loop for hard_regno + nregs - 1 down to hard_regno + 0. With this change, the patch is ok. Thanks for the patch. +{ + SET_HARD_REG_BIT (ira_prohibited_class_mode_regs[cl][j], +hard_regno); + continue; +} pclass = ira_pressure_class_translate[REGNO_REG_CLASS (hard_regno)]; for (nregs-- ;nregs= 0; nregs--) if (((enum reg_class) pclass Jakub
[PATCH] use AS_HELP_STRING throughout gcc/configure.ac
This changes all uses of AC_ARG_(WITH|ENABLE) to use AS_HELP_STRING, fixing a few quoting bugs on the way. OK for trunk? Andreas. 2011-05-12 Andreas Schwab sch...@redhat.com * configure.ac: Use AS_HELP_STRING throughout. * configure: Regenerate. diff --git a/gcc/configure.ac b/gcc/configure.ac index 92d9e29..87b7120 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -105,7 +105,8 @@ fi # Specify the local prefix local_prefix= AC_ARG_WITH(local-prefix, -[ --with-local-prefix=DIR specifies directory to put local include], +[AS_HELP_STRING([--with-local-prefix=DIR], + [specifies directory to put local include])], [case ${withval} in yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; no);; @@ -123,8 +124,8 @@ fi gcc_gxx_include_dir= # Specify the g++ header file directory AC_ARG_WITH(gxx-include-dir, -[ --with-gxx-include-dir=DIR - specifies directory to put g++ header files], +[AS_HELP_STRING([--with-gxx-include-dir=DIR], +[specifies directory to put g++ header files])], [case ${withval} in yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; no);; @@ -145,9 +146,9 @@ if test x${gcc_gxx_include_dir} = x; then fi AC_ARG_WITH(cpp_install_dir, -[ --with-cpp-install-dir=DIR - install the user visible C preprocessor in DIR - (relative to PREFIX) as well as PREFIX/bin], +[AC_HELP_STRING([--with-cpp-install-dir=DIR], +[install the user visible C preprocessor in DIR + (relative to PREFIX) as well as PREFIX/bin])], [if test x$withval = xyes; then AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) elif test x$withval != xno; then @@ -163,10 +164,10 @@ fi]) AC_MSG_CHECKING([whether to place generated files in the source directory]) dnl generated-files-in-srcdir is disabled by default AC_ARG_ENABLE(generated-files-in-srcdir, -[ --enable-generated-files-in-srcdir - put copies of generated files in source dir - intended for creating source tarballs for users - without texinfo bison or flex.], +[AS_HELP_STRING([--enable-generated-files-in-srcdir], + [put copies of generated files in source dir +intended for creating source tarballs for users +without texinfo bison or flex])], generated_files_in_srcdir=$enableval, generated_files_in_srcdir=no) @@ -185,13 +186,13 @@ AC_SUBST(GENINSRC) # With GNU ld AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld arrange to work with GNU ld.], +[AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])], gnu_ld_flag=$with_gnu_ld, gnu_ld_flag=no) # With pre-defined ld AC_ARG_WITH(ld, -[ --with-ld arrange to use the specified ld (full pathname)], +[AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])], DEFAULT_LINKER=$with_ld) if test x${DEFAULT_LINKER+set} = xset; then if test ! -x $DEFAULT_LINKER; then @@ -219,7 +220,7 @@ fi # With demangler in GNU ld AC_ARG_WITH(demangler-in-ld, -[ --with-demangler-in-ld try to use demangler in GNU ld.], +[AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])], demangler_in_ld=$with_demangler_in_ld, demangler_in_ld=no) @@ -229,12 +230,12 @@ demangler_in_ld=no) # With GNU as AC_ARG_WITH(gnu-as, -[ --with-gnu-as arrange to work with GNU as], +[AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])], gas_flag=$with_gnu_as, gas_flag=no) AC_ARG_WITH(as, -[ --with-as arrange to use the specified as (full pathname)], +[AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])], DEFAULT_ASSEMBLER=$with_as) if test x${DEFAULT_ASSEMBLER+set} = xset; then if test ! -x $DEFAULT_ASSEMBLER; then @@ -359,12 +360,12 @@ if test x`cat $srcdir/DEV-PHASE` != xexperimental; then fi AC_ARG_ENABLE(checking, -[ --enable-checking[=LIST] - enable expensive run-time checks. With LIST, - enable only specific categories of checks. - Categories are: yes,no,all,none,release. - Flags are: assert,df,fold,gc,gcac,gimple,misc, - rtlflag,rtl,runtime,tree,valgrind,types.], +[AS_HELP_STRING([[--enable-checking[=LIST]]], + [enable expensive run-time checks. With LIST, +enable only specific categories of checks. +Categories are: yes,no,all,none,release. +Flags are: assert,df,fold,gc,gcac,gimple,misc, +rtlflag,rtl,runtime,tree,valgrind,types])], [ac_checking_flags=${enableval}],[ # Determine the default checks. if test x$is_release = x ; then @@ -547,12 +548,12 @@ AC_SUBST(valgrind_command) # Enable code
New Chinese (simplified) PO file for 'cpplib' (version 4.6.0)
Hello, gentle maintainer. This is a message from the Translation Project robot. A revised PO file for textual domain 'cpplib' has been submitted by the Chinese (simplified) team of translators. The file is available at: http://translationproject.org/latest/cpplib/zh_CN.po (This file, 'cpplib-4.6.0.zh_CN.po', has just now been sent to you in a separate email.) All other PO files for your package are available in: http://translationproject.org/latest/cpplib/ Please consider including all of these in your next release, whether official or a pretest. Whenever you have a new distribution with a new version number ready, containing a newer POT file, please send the URL of that distribution tarball to the address below. The tarball may be just a pretest or a snapshot, it does not even have to compile. It is just used by the translators when they need some extra translation context. The following HTML page has been updated: http://translationproject.org/domain/cpplib.html If any question arises, please contact the translation coordinator. Thank you for all your work, The Translation Project robot, in the name of your translation coordinator. coordina...@translationproject.org
Contents of PO file 'cpplib-4.6.0.zh_CN.po'
cpplib-4.6.0.zh_CN.po.gz Description: Binary data The Translation Project robot, in the name of your translation coordinator. coordina...@translationproject.org
RX: 4.6 branch: Obvious fixes
Hi Guys, I am applying the patch below to the RX backend on the 4.6 branch. It fixes several small, obvious bugs, as described in the changelog. Cheers Nick gcc/ChangeLog 2011-05-12 Nick Clifton ni...@redhat.com * config/rx/rx.h (HAVE_PRE_DECREMENT): Fix typo. * config/rx/rx.c (rx_is_legitimate_constant): Use gcc_unreachable instead of abort. (rx_align_for_label): Test label before extracting its number of uses. (rx_max_skip_for_label): Ignore debug insns. Index: gcc/config/rx/rx.h === --- gcc/config/rx/rx.h (revision 173693) +++ gcc/config/rx/rx.h (working copy) @@ -155,7 +155,7 @@ #define LEGITIMATE_CONSTANT_P(X) rx_is_legitimate_constant (X) -#define HAVE_PRE_DECCREMENT1 +#define HAVE_PRE_DECREMENT 1 #define HAVE_POST_INCREMENT1 #define MOVE_RATIO(SPEED) ((SPEED) ? 4 : 2) Index: gcc/config/rx/rx.c === --- gcc/config/rx/rx.c (revision 173693) +++ gcc/config/rx/rx.c (working copy) @@ -2451,8 +2451,7 @@ default: /* FIXME: Can this ever happen ? */ - abort (); - return false; + gcc_unreachable (); } break; @@ -2758,7 +2757,7 @@ because the delay due to the inserted NOPs would be greater than the delay due to the misaligned branch. If uses_threshold is zero then the alignment is always useful. */ - if (LABEL_NUSES (lab) uses_threshold) + if (LABEL_P (lab) LABEL_NUSES (lab) uses_threshold) return 0; return optimize_size ? 1 : 3; @@ -2775,7 +2774,7 @@ op = lab; do { - op = next_nonnote_insn (op); + op = next_nonnote_nondebug_insn (op); } while (op (LABEL_P (op) || (INSN_P (op) GET_CODE (PATTERN (op)) == USE)));
RX: mainline: Fix obvious bugs
Hi Guys, I am applying the patch below to fix some small, obvious problems with the RX backend in the mainline sources. Cheers Nick gcc/ChangeLog 2011-05-12 DJ Delorie d...@redhat.com Nick Clifton ni...@redhat.com * config/rx/rx.h (HAVE_PRE_DECREMENT): Fix typo. * config/rx/rx.c (CC_FLAG_FP): Fix comment. (rx_is_legitimate_address): Add pre-decrement and post-increment addressing in HImode and QImode. Fix test for out of range REG+INT addressing. (rx_legitimate_constant_p): Rename to rx_is_legitimate_constant. (rx_align_for_label): Test label before extracting its usage count. (rx_adjust_insn_lengths): Fix selection of insn codes. (TARGET_LEGITIMATE_CONSTANT_P): Use renamed function. Index: gcc/config/rx/rx.h === --- gcc/config/rx/rx.h (revision 173693) +++ gcc/config/rx/rx.h (working copy) @@ -144,7 +144,7 @@ #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 -#define HAVE_PRE_DECCREMENT1 +#define HAVE_PRE_DECREMENT 1 #define HAVE_POST_INCREMENT1 #define MOVE_RATIO(SPEED) ((SPEED) ? 4 : 2) Index: gcc/config/rx/rx.c === --- gcc/config/rx/rx.c (revision 173693) +++ gcc/config/rx/rx.c (working copy) @@ -58,7 +58,7 @@ #define CC_FLAG_Z (1 1) #define CC_FLAG_O (1 2) #define CC_FLAG_C (1 3) -#define CC_FLAG_FP (1 4)/* fake, to differentiate CC_Fmode */ +#define CC_FLAG_FP (1 4)/* Fake, to differentiate CC_Fmode. */ static unsigned int flags_from_mode (enum machine_mode mode); static unsigned int flags_from_code (enum rtx_code code); @@ -85,7 +85,9 @@ /* Register Indirect. */ return true; - if (GET_MODE_SIZE (mode) = 4 + if ((GET_MODE_SIZE (mode) == 4 + || GET_MODE_SIZE (mode) == 2 + || GET_MODE_SIZE (mode) == 1) (GET_CODE (x) == PRE_DEC || GET_CODE (x) == POST_INC)) /* Pre-decrement Register Indirect or Post-increment Register Indirect. */ @@ -125,7 +127,7 @@ case 1: factor = 1; break; } - if (val = (0x1 * factor)) + if (val (65535 * factor)) return false; return (val % factor) == 0; } @@ -1349,7 +1351,7 @@ insn = emit_insn (gen_addsi3 (dest, src, val)); else { - /* Wrap VAL in an UNSPEC so that rx_legitimate_constant_p + /* Wrap VAL in an UNSPEC so that rx_is_legitimate_constant will not reject it. */ val = gen_rtx_CONST (SImode, gen_rtx_UNSPEC (SImode, gen_rtvec (1, val), UNSPEC_CONST)); insn = emit_insn (gen_addsi3 (dest, src, val)); @@ -2448,7 +2450,7 @@ operand on the RX. X is already known to satisfy CONSTANT_P. */ bool -rx_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) +rx_is_legitimate_constant (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) { switch (GET_CODE (x)) { @@ -2782,7 +2784,7 @@ because the delay due to the inserted NOPs would be greater than the delay due to the misaligned branch. If uses_threshold is zero then the alignment is always useful. */ - if (LABEL_NUSES (lab) uses_threshold) + if (LABEL_P (lab) LABEL_NUSES (lab) uses_threshold) return 0; return optimize_size ? 1 : 3; @@ -2837,7 +2839,7 @@ case CODE_FOR_smaxsi3_zero_extendhi: case CODE_FOR_sminsi3_zero_extendhi: case CODE_FOR_multsi3_zero_extendhi: -case CODE_FOR_comparesi3_zero_extendqi: +case CODE_FOR_comparesi3_zero_extendhi: zero = true; factor = 2; break; @@ -2852,7 +2854,7 @@ case CODE_FOR_smaxsi3_sign_extendhi: case CODE_FOR_sminsi3_sign_extendhi: case CODE_FOR_multsi3_sign_extendhi: -case CODE_FOR_comparesi3_zero_extendhi: +case CODE_FOR_comparesi3_sign_extendhi: zero = false; factor = 2; break; @@ -2867,7 +2869,7 @@ case CODE_FOR_smaxsi3_zero_extendqi: case CODE_FOR_sminsi3_zero_extendqi: case CODE_FOR_multsi3_zero_extendqi: -case CODE_FOR_comparesi3_sign_extendqi: +case CODE_FOR_comparesi3_zero_extendqi: zero = true; factor = 1; break; @@ -2882,7 +2884,7 @@ case CODE_FOR_smaxsi3_sign_extendqi: case CODE_FOR_sminsi3_sign_extendqi: case CODE_FOR_multsi3_sign_extendqi: -case CODE_FOR_comparesi3_sign_extendhi: +case CODE_FOR_comparesi3_sign_extendqi: zero = false; factor = 1; break; @@ -3062,7 +3064,7 @@ #define TARGET_FLAGS_REGNUMCC_REG #undef TARGET_LEGITIMATE_CONSTANT_P -#define TARGET_LEGITIMATE_CONSTANT_P rx_legitimate_constant_p +#define TARGET_LEGITIMATE_CONSTANT_P rx_is_legitimate_constant struct gcc_target targetm = TARGET_INITIALIZER;
RX: Add TARGET_BUILTIN_DECL
Hi Guys, I am checking in this patch, created by DJ Delorie, to add TARGET_BUILTIN_DECL to the RX backend. Cheers Nick gcc/ChangeLog 2011-05-12 DJ Delorie d...@redhat.com (rx_builtins): New arrays - holds builtin functions. (ADD_RX_BUILTIN1, ADD_RX_BUILTIN2, ADD_RX_BUILTIN3): Install created builtin into rx_builtins array. (rx_builtin_decl): New function. (TARGET_BUITLIN_DECL): Define. Include gt-rx.h. Index: gcc/config/rx/rx.c === --- gcc/config/rx/rx.c (revision 173695) +++ gcc/config/rx/rx.c (working copy) @@ -1930,10 +1930,13 @@ RX_BUILTIN_max }; +static GTY(()) tree rx_builtins[(int) RX_BUILTIN_max]; + static void rx_init_builtins (void) { #define ADD_RX_BUILTIN1(UC_NAME, LC_NAME, RET_TYPE, ARG_TYPE) \ + rx_builtins[RX_BUILTIN_##UC_NAME] = \ add_builtin_function (__builtin_rx_ LC_NAME, \ build_function_type_list (RET_TYPE##_type_node, \ ARG_TYPE##_type_node, \ @@ -1942,6 +1945,7 @@ BUILT_IN_MD, NULL, NULL_TREE) #define ADD_RX_BUILTIN2(UC_NAME, LC_NAME, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \ + rx_builtins[RX_BUILTIN_##UC_NAME] = \ add_builtin_function (__builtin_rx_ LC_NAME, \ build_function_type_list (RET_TYPE##_type_node, \ ARG_TYPE1##_type_node,\ @@ -1951,6 +1955,7 @@ BUILT_IN_MD, NULL, NULL_TREE) #define ADD_RX_BUILTIN3(UC_NAME,LC_NAME,RET_TYPE,ARG_TYPE1,ARG_TYPE2,ARG_TYPE3) \ + rx_builtins[RX_BUILTIN_##UC_NAME] = \ add_builtin_function (__builtin_rx_ LC_NAME, \ build_function_type_list (RET_TYPE##_type_node, \ ARG_TYPE1##_type_node,\ @@ -1982,6 +1987,17 @@ ADD_RX_BUILTIN1 (WAIT,wait,void, void); } +/* Return the RX builtin for CODE. */ + +static tree +rx_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) +{ + if (code = RX_BUILTIN_max) +return error_mark_node; + + return rx_builtins[code]; +} + static rtx rx_expand_void_builtin_1_arg (rtx arg, rtx (* gen_func)(rtx), bool reg) { @@ -2955,6 +2971,9 @@ #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS rx_init_builtins +#undef TARGET_BUILTIN_DECL +#define TARGET_BUILTIN_DECLrx_builtin_decl + #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN rx_expand_builtin @@ -3068,4 +3087,4 @@ struct gcc_target targetm = TARGET_INITIALIZER; -/* #include gt-rx.h */ +#include gt-rx.h
Re: [Patch, IRA] Fix a function accessing beyond end-of-array
On 12/05/11 10:18, Jakub Jelinek wrote: On Thu, May 12, 2011 at 10:09:42AM +0100, Hari Sandanagobalane wrote: The REGNO_REG_CLASS is generally an array of size FIRST_PSEUDO_REGISTER. So, the indexes go from 0 to FIRST_PSEUDO_REGISTER-1. That is true. I think the = condition is fine in that case. Do you agree? That is wrong. It is perfectly fine to handle hard reg with regno (FIRST_PSEUDO_REGISTER - 1) if it has nregs 1, or hard reg with regno (FIRST_PSEUDO_REGISTER - 2) if it has nregs 1 or 2. The following loop starts with nregs--, therefore for hard_regno + nregs == FIRST_PSEUDO_REGISTER at the place of your test REGNO_REG_CLASS will be used in the loop for hard_regno + nregs - 1 down to hard_regno + 0. Ooh yes. You are right. Thanks for that! I have now committed the revised patch to mainline as revision 173699. Cheers Hari With this change, the patch is ok. Thanks for the patch. +{ + SET_HARD_REG_BIT (ira_prohibited_class_mode_regs[cl][j], +hard_regno); + continue; +} pclass = ira_pressure_class_translate[REGNO_REG_CLASS (hard_regno)]; for (nregs-- ;nregs= 0; nregs--) if (((enum reg_class) pclass Jakub
Fix inline_merge_summary ICE during kernel build
Hi, the problem is that Andi's test build is with -O0 and we should not allocate ipa-prop datastructures then. We do so via duplication hook by accident since do_whole_program_analysis for some illogical reason calls ipa_register_cgraph_hooks. Comitted as obvoius. Honza PR lto/48952 * lto.c (do_whole_program_analysis): Do not register cgraph hooks. Index: lto/lto.c === --- lto/lto.c (revision 173666) +++ lto/lto.c (working copy) @@ -2511,7 +2511,6 @@ do_whole_program_analysis (void) dump_varpool (cgraph_dump_file); } bitmap_obstack_initialize (NULL); - ipa_register_cgraph_hooks (); cgraph_state = CGRAPH_STATE_IPA_SSA; execute_ipa_pass_list (all_regular_ipa_passes);
Re: [PATCH][4/n] Cleanup LTO type merging
This removes the mode param from the generic type merging machinery and simplifies code accordingly. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Hi, looks the cleanup series makes a progress, now I get 459s for Mozilla WPA (it was 540 last time I tried). Out of that 262s is still ipa lto decl in. oprofile is as follows: 123230 20.1719 lto1 htab_find_slot_with_hash 58203 9.5274 lto1 gimple_type_eq 50017 8.1874 lto1 iterative_hash_hashval_t 40099 6.5639 libc-2.11.1.so _int_malloc ^^ note that the int_malloc calls seems to be mostly due to repetetive creating/destroying the scc pointer map. Honza
[PATCH] Fix PR48172
This fixes PR48172 by properly doing the runtime alias check for vectorization. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk sofar. Richard. 2011-05-12 Richard Guenther rguent...@suse.de PR tree-optimization/48172 * tree-vect-loop-manip.c (vect_vfa_segment_size): Do not exclude the number of iterations from the segment size calculation. (vect_create_cond_for_alias_checks): Adjust. * gcc.dg/vect/pr48172.c: New testcase. Index: gcc/tree-vect-loop-manip.c === *** gcc/tree-vect-loop-manip.c (revision 173693) --- gcc/tree-vect-loop-manip.c (working copy) *** vect_create_cond_for_align_checks (loop_ *** 2354,2379 Input: DR: The data reference. VECT_FACTOR: vectorization factor. Return an expression whose value is the size of segment which will be accessed by DR. */ static tree ! vect_vfa_segment_size (struct data_reference *dr, tree vect_factor) { ! tree segment_length = fold_build2 (MULT_EXPR, integer_type_node, !DR_STEP (dr), vect_factor); ! if (vect_supportable_dr_alignment (dr, false) == dr_explicit_realign_optimized) { tree vector_size = TYPE_SIZE_UNIT (STMT_VINFO_VECTYPE (vinfo_for_stmt (DR_STMT (dr; ! segment_length = fold_build2 (PLUS_EXPR, integer_type_node, ! segment_length, vector_size); } ! return fold_convert (sizetype, segment_length); } --- 2354,2384 Input: DR: The data reference. VECT_FACTOR: vectorization factor. + SCALAR_LOOP_NITERS: number of iterations. Return an expression whose value is the size of segment which will be accessed by DR. */ static tree ! vect_vfa_segment_size (struct data_reference *dr, int vect_factor, ! tree scalar_loop_niters) { ! tree segment_length; ! segment_length = size_binop (MULT_EXPR, ! fold_convert (sizetype, DR_STEP (dr)), ! size_int (vect_factor)); ! segment_length = size_binop (MULT_EXPR, ! segment_length, ! fold_convert (sizetype, scalar_loop_niters)); if (vect_supportable_dr_alignment (dr, false) == dr_explicit_realign_optimized) { tree vector_size = TYPE_SIZE_UNIT (STMT_VINFO_VECTYPE (vinfo_for_stmt (DR_STMT (dr; ! segment_length = size_binop (PLUS_EXPR, segment_length, vector_size); } ! return segment_length; } *** vect_create_cond_for_alias_checks (loop_ *** 2407,2414 struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); VEC (ddr_p, heap) * may_alias_ddrs = LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo); ! tree vect_factor = ! build_int_cst (integer_type_node, LOOP_VINFO_VECT_FACTOR (loop_vinfo)); ddr_p ddr; unsigned int i; --- 2412,2419 struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); VEC (ddr_p, heap) * may_alias_ddrs = LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo); ! int vect_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo); ! tree scalar_loop_iters = LOOP_VINFO_NITERS (loop_vinfo); ddr_p ddr; unsigned int i; *** vect_create_cond_for_alias_checks (loop_ *** 2460,2467 vect_create_addr_base_for_vector_ref (stmt_b, cond_expr_stmt_list, NULL_TREE, loop); ! segment_length_a = vect_vfa_segment_size (dr_a, vect_factor); ! segment_length_b = vect_vfa_segment_size (dr_b, vect_factor); if (vect_print_dump_info (REPORT_DR_DETAILS)) { --- 2465,2474 vect_create_addr_base_for_vector_ref (stmt_b, cond_expr_stmt_list, NULL_TREE, loop); ! segment_length_a = vect_vfa_segment_size (dr_a, vect_factor, ! scalar_loop_iters); ! segment_length_b = vect_vfa_segment_size (dr_b, vect_factor, ! scalar_loop_iters); if (vect_print_dump_info (REPORT_DR_DETAILS)) { Index: gcc/testsuite/gcc.dg/vect/pr48172.c === *** gcc/testsuite/gcc.dg/vect/pr48172.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr48172.c (revision 0) *** *** 0 --- 1,33 + /* { dg-do run } */ + + extern void *memset(void *s, int c, __SIZE_TYPE__ n); + extern void abort (void); + + #define ASIZE 1028 + #define HALF (ASIZE/2) + + int main() { + unsigned int array[ASIZE]; + int i; + + memset(array, 0, sizeof(array)); + + /* initialize first half of the array */ + for (i = 0; i HALF; i++) + array[i] = i; + + /* fill second half of array in by summing
[PR testsuite/47013] Fix SMS testsuite faliures
Hello, The attached patch fixes SMS testsuite failures seen on PowerPC and SPU. Tested ppc64-redhat-linux on both with -m32,-m64 and SPU. OK for mainline? Thanks, Revital testsuite/Changelog PR rtl-optimization/47013 * gcc.dg/sms-2.c: Change scan-tree-dump-times and the code itself to preserve the function. * gcc.dg/sms-6.c: Add --param sms-min-sc=1 -fmodulo-sched-allow-regmoves, and -mno-update for PowerPC. * gcc.dg/sms-3.c: Add --param sms-min-sc=1 and -fmodulo-sched-allow-regmoves flags. * gcc.dg/sms-7.c: Add -fmodulo-sched-allow-regmoves and --param sms-min-sc=1 flags and -mno-update for PowerPC. Increase the SMS succeeded loops for the SPU. * gcc.dg/sms-4.c: Add --param sms-min-sc=1 -mno-update for PowerPC. * gcc.dg/sms-8.c: Add --param sms-min-sc=1 and -m32 for PowerPC. Change scan-rtl-dump-times for PowerPC. * gcc.dg/sms-5.c: Add --param sms-min-sc=1 flag and -mno-update for PowerPC. Index: testsuite/gcc.dg/sms-2.c === --- testsuite/gcc.dg/sms-2.c(revision 173693) +++ testsuite/gcc.dg/sms-2.c(working copy) @@ -4,12 +4,11 @@ /* { dg-do compile } */ /* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms } */ - +int th, h, em, nlwm, nlwS, nlw, sy; void fun (nb) int nb; { - int th, h, em, nlwm, nlwS, nlw, sy; while (nb--) while (h--) @@ -33,5 +32,5 @@ fun (nb) } } -/* { dg-final { scan-rtl-dump-times SMS succeeded 1 sms { target spu-*-* powerpc*-*-* } } } */ +/* { dg-final { scan-rtl-dump-times SMS loop many exits 1 sms { target spu-*-* powerpc*-*-* } } } */ /* { dg-final { cleanup-rtl-dump sms } } */ Index: testsuite/gcc.dg/sms-6.c === --- testsuite/gcc.dg/sms-6.c(revision 173693) +++ testsuite/gcc.dg/sms-6.c(working copy) @@ -1,5 +1,7 @@ /* { dg-do run } */ -/* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms } */ +/* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 } */ +/* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms -mno-update --param sms-min-sc=1 -fmodulo-sched-allow-regmoves { target powerpc*-*-*} } */ + extern void abort (void); Index: testsuite/gcc.dg/sms-3.c === --- testsuite/gcc.dg/sms-3.c(revision 173693) +++ testsuite/gcc.dg/sms-3.c(working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options -O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms } */ +/* { dg-options -O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves } */ extern void abort (void); Index: testsuite/gcc.dg/sms-7.c === --- testsuite/gcc.dg/sms-7.c(revision 173693) +++ testsuite/gcc.dg/sms-7.c(working copy) @@ -1,5 +1,6 @@ /* { dg-do run } */ -/* { dg-options -O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms } */ +/* { dg-options -O3 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms -fmodulo-sched-allow-regmoves --param sms-min-sc=1 } */ +/* { dg-options -O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms --param sms-min-sc=1 -mno-update -fmodulo-sched-allow-regmoves { target powerpc*-*-*} } */ extern void abort (void); @@ -44,7 +45,7 @@ int main() return 0; } -/* { dg-final { scan-rtl-dump-times SMS succeeded 1 sms { target spu-*-* } } } */ +/* { dg-final { scan-rtl-dump-times SMS succeeded 2 sms { target spu-*-* } } } */ /* { dg-final { scan-rtl-dump-times SMS succeeded 3 sms { target powerpc*-*-* } } } */ /* { dg-final { cleanup-rtl-dump sms } } */ Index: testsuite/gcc.dg/sms-4.c === --- testsuite/gcc.dg/sms-4.c(revision 173693) +++ testsuite/gcc.dg/sms-4.c(working copy) @@ -1,6 +1,7 @@ /* Inspired from sbitmap_a_or_b_and_c_cg function in sbitmap.c. */ /* { dg-do run } */ -/* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms } */ +/* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms } */ +/* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms --param sms-min-sc=1 -mno-update { target powerpc*-*-*} } */ extern void abort (void); Index: testsuite/gcc.dg/sms-8.c === --- testsuite/gcc.dg/sms-8.c(revision 173693) +++ testsuite/gcc.dg/sms-8.c(working copy) @@ -3,7 +3,8 @@ that was not fixed by reg-moves. */ /* { dg-do run } */ - /* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms } */ + /* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms --param sms-min-sc=1 } */ + /* { dg-options -O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms --param
Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
While testing some other issues with C++'s __java_boolean type occurred. So I adjusted check in test-cfg.c as you suggested. Additionally due the fact that we are now boolifying conditions for even BOOLEAN_TYPE'ed cases (for making sure inner arms are boolified, too), we possibly would alter here truth-type provided by FE. To restore original type (for types != boolean-type), we do type conversion always back to FE's used type for truth-AND/OR/XOR/etc as result. Patch bootstrapped with all languages on x86_64-pc-linux-gnu (multilib). Ok for apply? Regards, Kai Index: gcc/gcc/gimplify.c === --- gcc.orig/gcc/gimplify.c 2011-05-12 09:02:58.946243000 +0200 +++ gcc/gcc/gimplify.c 2011-05-12 15:13:59.534550700 +0200 @@ -2824,9 +2824,6 @@ gimple_boolify (tree expr) } } - if (TREE_CODE (type) == BOOLEAN_TYPE) -return expr; - switch (TREE_CODE (expr)) { case TRUTH_AND_EXPR: @@ -2851,6 +2848,9 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ + if (TREE_CODE (type) == BOOLEAN_TYPE + type == boolean_type_node) + return expr; return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -4695,31 +4695,6 @@ gimplify_scalar_mode_aggregate_compare ( return GS_OK; } -/* Gimplify TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR expressions. EXPR_P - points to the expression to gimplify. - - Expressions of the form 'a b' are gimplified to: - - a b ? true : false - - LOCUS is the source location to be put on the generated COND_EXPR. - gimplify_cond_expr will do the rest. */ - -static enum gimplify_status -gimplify_boolean_expr (tree *expr_p, location_t locus) -{ - /* Preserve the original type of the expression. */ - tree type = TREE_TYPE (*expr_p); - - *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert_loc (locus, type, boolean_true_node), - fold_convert_loc (locus, type, boolean_false_node)); - - SET_EXPR_LOCATION (*expr_p, locus); - - return GS_OK; -} - /* Gimplify an expression sequence. This function gimplifies each expression and rewrites the original expression with the last expression of the sequence in GIMPLE form. @@ -6762,12 +6737,26 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - /* Pass the source location of the outer expression. */ - ret = gimplify_boolean_expr (expr_p, saved_location); - break; + { + /* Preserve the original type of the expression and the + source location of the outer expression. */ + tree org_type = TREE_TYPE (*expr_p); + *expr_p = gimple_boolify (*expr_p); + *expr_p = build3_loc (saved_location, COND_EXPR, + org_type, *expr_p, + fold_convert_loc + (saved_location, +org_type, boolean_true_node), + fold_convert_loc + (saved_location, +org_type, boolean_false_node)); + ret = GS_OK; + break; + } case TRUTH_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (*expr_p)) != boolean_type_node) { tree type = TREE_TYPE (*expr_p); *expr_p = fold_convert (type, gimple_boolify (*expr_p)); @@ -7203,6 +7192,24 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, we need to keep + orignal type. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (org_type)) != boolean_type_node) + { + *expr_p = fold_convert (org_type, *expr_p); + ret = GS_OK; + break; + } + } + /* Classified as tcc_expression. */ goto expr_2; Index: gcc/gcc/tree-cfg.c === --- gcc.orig/gcc/tree-cfg.c 2011-05-12 09:02:58.989243000 +0200 +++ gcc/gcc/tree-cfg.c 2011-05-12 14:50:19.656249100 +0200 @@ -3541,10 +3541,10 @@ do_pointer_plus_expr_check: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: { -
Re: [PATCH, SMS 1/3] Support closing_branch_deps (second try)
Hello Ramana, Following our conversation; here is the patch again without the arm specific flags. Tested on ARM machine configured with [--with-arch=armv7-a] --with-mode=thumb. OK for mainline? Thanks, Revital testsuite/Changlog: * gcc.target/arm/sms-9.c: New file. * gcc.target/arm/sms-10.c: New file. Index: arm/sms-9.c === --- arm/sms-9.c (revision 0) +++ arm/sms-9.c (revision 0) @@ -0,0 +1,73 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms -fno-auto-inc-dec } */ + +extern void abort (void); + +int filter1[8][4] = { + { + 23170, -23170, -23170, 23170,}, + { + 22005, -26319, -16846, 29621,}, + { + 22005, -26319, -16846, 29621,}, + { + 5, -26319, -16846, 29621,}, + { + 55, -26319, -16846, 29621,}, + { + 77, -26319, -16846, 29621,}, + { + 22005, -26319, -16846, 29621,}, + { + 22005, -26319, -16846, 29621,}, + +}; + + +int out[32] = { + 22, -22, -22, 22, 21, -25, -16, 28, 21, -25, -16, 28, 0, -25, -16, 28, 0, +-25, -16, 28, 0, -25, -16, 28, 21, -25, -16, 28, 21, -25, -16, 28 +}; + +__attribute__ ((noinline)) +static void +foo (int *arr, int *accums) +{ + typedef int NN[8][4]; + static NN *filter; + int i; + filter = filter1; + + int *filterp; + int *arrp; + arrp = arr; + filterp = (int *) ((*filter)[0]); + i = 32; + + while (i--) +{ + *accums++ = (arrp[0] * filterp[0] + arrp[8] * filterp[0]) / 32768; + filterp += 1; +} +} + +int +main () +{ + int inarr[32]; + int accums[32]; + int i; + for (i = 0; i 32; i++) +inarr[i] = i 2; + foo (inarr, accums); + for (i = 0; i 32; i++) +if (out[i] != accums[i]) + abort (); + return 0; +} + +/* { dg-final { scan-rtl-dump-times SMS succeeded 1 sms } } */ +/* { dg-final { cleanup-rtl-dump sms } } */ + + Index: arm/sms-10.c === --- arm/sms-10.c(revision 0) +++ arm/sms-10.c(revision 0) @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-options -O2 -fmodulo-sched -fdump-rtl-sms -fno-auto-inc-dec -fmodulo-sched-allow-regmoves -gtoggle } */ + +extern void abort (void); + +unsigned char filter1[8] = { 2, 3, 1, 2, 3, 2, 2, 1 }; + + +void +foo (int val, unsigned int size, unsigned char *dest) +{ + while (size != 0) +{ + *dest++ = val 0xff; + --size; +} +} + + +int +main () +{ + int i; + foo (50, 4, filter1); + for (i = 0; i 4; i++) +if (filter1[i] != 50) + abort (); + return 0; +} + +/* { dg-final { scan-rtl-dump-times OK 1 sms } } */ +/* { dg-final { cleanup-rtl-dump sms } } */ + +
[PATCH][7/n] LTO type merging cleanup
This improves hashing and comparing both regular and canonical type merging. Bootstrapped and tested on x86_64-unknonw-linux-gnu and SPEC2k6 tested, applied to trunk. Richard. 2011-05-12 Richard Guenther rguent...@suse.de * gimple.c (gtc_visit): Compare TREE_ADDRESSABLE, handle NULLPTR_TYPE similar to VOID_TYPE. Defer type-leader lookup until after simple checks. (gimple_types_compatible_p): Likewise. (iterative_hash_gimple_type): Always hash pointer targets and function return and argument types. (iterative_hash_canonical_type): Do not hash TYPE_QUALS, hash TYPE_ALIGN. Do not hash TYPE_MIN/MAX_VALUE. (gimple_canonical_types_compatible_p): Compare TREE_ADDRESSABLE, handle NULLPTR_TYPE similar to VOID_TYPE. Handle non-aggregates completely in the simple compare section. (gimple_register_canonical_type): Query the cache again after registering. Index: gcc/gimple.c === *** gcc/gimple.c(revision 173702) --- gcc/gimple.c(working copy) *** gtc_visit (tree t1, tree t2, *** 3489,3503 if (t1 == NULL_TREE || t2 == NULL_TREE) return false; - /* If the types have been previously registered and found equal - they still are. */ - leader1 = gimple_lookup_type_leader (t1); - leader2 = gimple_lookup_type_leader (t2); - if (leader1 == t2 - || t1 == leader2 - || (leader1 leader1 == leader2)) - return true; - /* Can't be the same type if the types don't have the same code. */ if (TREE_CODE (t1) != TREE_CODE (t2)) return false; --- 3489,3494 *** gtc_visit (tree t1, tree t2, *** 3506,3528 if (TYPE_QUALS (t1) != TYPE_QUALS (t2)) return false; ! /* Void types are always the same. */ ! if (TREE_CODE (t1) == VOID_TYPE) return true; /* Do some simple checks before doing three hashtable queries. */ if (INTEGRAL_TYPE_P (t1) || SCALAR_FLOAT_TYPE_P (t1) || FIXED_POINT_TYPE_P (t1) || TREE_CODE (t1) == VECTOR_TYPE || TREE_CODE (t1) == COMPLEX_TYPE ! || TREE_CODE (t1) == OFFSET_TYPE) { ! /* Can't be the same type if they have different alignment, !sign, precision or mode. */ ! if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2) ! || TYPE_PRECISION (t1) != TYPE_PRECISION (t2) ! || TYPE_MODE (t1) != TYPE_MODE (t2) || TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) return false; --- 3497,3526 if (TYPE_QUALS (t1) != TYPE_QUALS (t2)) return false; ! if (TREE_ADDRESSABLE (t1) != TREE_ADDRESSABLE (t2)) ! return false; ! ! /* Void types and nullptr types are always the same. */ ! if (TREE_CODE (t1) == VOID_TYPE ! || TREE_CODE (t1) == NULLPTR_TYPE) return true; + /* Can't be the same type if they have different alignment or mode. */ + if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2) + || TYPE_MODE (t1) != TYPE_MODE (t2)) + return false; + /* Do some simple checks before doing three hashtable queries. */ if (INTEGRAL_TYPE_P (t1) || SCALAR_FLOAT_TYPE_P (t1) || FIXED_POINT_TYPE_P (t1) || TREE_CODE (t1) == VECTOR_TYPE || TREE_CODE (t1) == COMPLEX_TYPE ! || TREE_CODE (t1) == OFFSET_TYPE ! || POINTER_TYPE_P (t1)) { ! /* Can't be the same type if they have different sign or precision. */ ! if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2) || TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) return false; *** gtc_visit (tree t1, tree t2, *** 3536,3551 || FIXED_POINT_TYPE_P (t1)) return true; ! /* For integral types fall thru to more complex checks. */ } ! else if (AGGREGATE_TYPE_P (t1) || POINTER_TYPE_P (t1)) ! { ! /* Can't be the same type if they have different alignment or mode. */ ! if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2) ! || TYPE_MODE (t1) != TYPE_MODE (t2)) ! return false; ! } /* If the hash values of t1 and t2 are different the types can't possibly be the same. This helps keeping the type-pair hashtable --- 3534,3550 || FIXED_POINT_TYPE_P (t1)) return true; ! /* For other types fall thru to more complex checks. */ } ! /* If the types have been previously registered and found equal ! they still are. */ ! leader1 = gimple_lookup_type_leader (t1); ! leader2 = gimple_lookup_type_leader (t2); ! if (leader1 == t2 ! || t1 == leader2 ! || (leader1 leader1 == leader2)) ! return true; /* If the hash values of t1 and t2 are different the types can't possibly be the same. This helps keeping the type-pair hashtable *** gimple_types_compatible_p_1 (tree t1, tr *** 3739,3748 goto different_types; } -
Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
On Thu, May 12, 2011 at 3:29 PM, Kai Tietz ktiet...@googlemail.com wrote: While testing some other issues with C++'s __java_boolean type occurred. So I adjusted check in test-cfg.c as you suggested. Additionally due the fact that we are now boolifying conditions for even BOOLEAN_TYPE'ed cases (for making sure inner arms are boolified, too), we possibly would alter here truth-type provided by FE. To restore original type (for types != boolean-type), we do type conversion always back to FE's used type for truth-AND/OR/XOR/etc as result. boolean_type_node is the only BOOLEAN_TYPE node we have, so please remove the !=/== boolean_type_node checks again, or, if you want more visual consistency with the adjustment gimple_boolify makes replace them with !=/== boolean_type_node comparisons completely. Ok with either change. Thanks, Richard. Patch bootstrapped with all languages on x86_64-pc-linux-gnu (multilib). Ok for apply? Regards, Kai Index: gcc/gcc/gimplify.c === --- gcc.orig/gcc/gimplify.c 2011-05-12 09:02:58.946243000 +0200 +++ gcc/gcc/gimplify.c 2011-05-12 15:13:59.534550700 +0200 @@ -2824,9 +2824,6 @@ gimple_boolify (tree expr) } } - if (TREE_CODE (type) == BOOLEAN_TYPE) - return expr; - switch (TREE_CODE (expr)) { case TRUTH_AND_EXPR: @@ -2851,6 +2848,9 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ + if (TREE_CODE (type) == BOOLEAN_TYPE + type == boolean_type_node) + return expr; return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -4695,31 +4695,6 @@ gimplify_scalar_mode_aggregate_compare ( return GS_OK; } -/* Gimplify TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR expressions. EXPR_P - points to the expression to gimplify. - - Expressions of the form 'a b' are gimplified to: - - a b ? true : false - - LOCUS is the source location to be put on the generated COND_EXPR. - gimplify_cond_expr will do the rest. */ - -static enum gimplify_status -gimplify_boolean_expr (tree *expr_p, location_t locus) -{ - /* Preserve the original type of the expression. */ - tree type = TREE_TYPE (*expr_p); - - *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert_loc (locus, type, boolean_true_node), - fold_convert_loc (locus, type, boolean_false_node)); - - SET_EXPR_LOCATION (*expr_p, locus); - - return GS_OK; -} - /* Gimplify an expression sequence. This function gimplifies each expression and rewrites the original expression with the last expression of the sequence in GIMPLE form. @@ -6762,12 +6737,26 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - /* Pass the source location of the outer expression. */ - ret = gimplify_boolean_expr (expr_p, saved_location); - break; + { + /* Preserve the original type of the expression and the + source location of the outer expression. */ + tree org_type = TREE_TYPE (*expr_p); + *expr_p = gimple_boolify (*expr_p); + *expr_p = build3_loc (saved_location, COND_EXPR, + org_type, *expr_p, + fold_convert_loc + (saved_location, + org_type, boolean_true_node), + fold_convert_loc + (saved_location, + org_type, boolean_false_node)); + ret = GS_OK; + break; + } case TRUTH_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (*expr_p)) != boolean_type_node) { tree type = TREE_TYPE (*expr_p); *expr_p = fold_convert (type, gimple_boolify (*expr_p)); @@ -7203,6 +7192,24 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, we need to keep + orignal type. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (org_type)) != boolean_type_node) + { + *expr_p = fold_convert (org_type, *expr_p); + ret = GS_OK; +
[Patch,Fortran] Resolve intrinsic module-procs only once
If an intrinsic module proc [such as ISO_Fortran_env's compiler_options()] is resolved multiple times, with -Wall a warning is printed, claiming that one has manually typed an intrinsic. The fix is to avoid resolving the proc multiple times. Note: Typing of use-associated symbols will always produce an error, thus, the warning is unreachable and not needed for intrinsics originating from modules. Build and regtested on x86-64-linux. OK for the trunk? Tobias 2011-05-12 Tobias Burnus bur...@net-b.de PR fortran/48972 * resolve.c (resolve_intrinsic): Don't resolve module intrinsics multiple times. 2011-05-12 Tobias Burnus bur...@net-b.de PR fortran/48972 * gfortran.dg/iso_c_binding_compiler_3.f90: New. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a19b103..3483bc7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1441,6 +1441,10 @@ resolve_intrinsic (gfc_symbol *sym, locus *loc) if (sym-formal) return SUCCESS; + /* Already resolved. */ + if (sym-from_intmod sym-ts.type != BT_UNKNOWN) +return SUCCESS; + /* We already know this one is an intrinsic, so we don't call gfc_is_intrinsic for full checking but rather use gfc_find_function and gfc_find_subroutine directly to check whether it is a function or --- /dev/null 2011-05-12 07:35:17.079892192 +0200 +++ gcc/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_3.f90 2011-05-12 13:51:04.0 +0200 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options -Wall } +! +! PR fortran/45823 +! +! We used to warn about +! Type specified for intrinsic function for this file +! + +use iso_c_binding +use iso_Fortran_env +implicit none +intrinsic sin +real :: x = 3.4 +print *, sin(x), c_sizeof(c_int), compiler_options(), compiler_version() +end + + +module test_mod +use iso_fortran_env +end module test_mod + +subroutine test +use test_mod +end subroutine test + +! { dg-final { cleanup-modules test_mod } }
[PATCH] Fix expansion of comparisons into signed type with 1-bit precision (PR middle-end/48973)
Hi! The read from a 1-bit signed bitfield initialized by a comparison is optimized into the comparison, which has that 1-bit signed bitfield comparison. Unfortunately that is still expanded as setting the result to 0 resp. 1 instead of this case 0 resp. -1 QImode pseudo, which is then sign extended into SImode for the comparison. Fixed by special casing expansion in that case. I think it is rare enough we can just ignore the fold_single_bit_test optimization in that case, rather than having two versions thereof. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6? 2011-05-12 Jakub Jelinek ja...@redhat.com PR middle-end/48973 * expr.c (expand_expr_real_2) case LT_EXPR: If do_store_flag failed and the comparison has a single bit signed type, use constm1_rtx instead of const1_rtx for true value. (do_store_flag): If ops-type is single bit signed type, disable signel bit test optimization and pass -1 instead of 1 as last parameter to emit_store_flag_force. * gcc.c-torture/execute/pr48973-1.c: New test. * gcc.c-torture/execute/pr48973-2.c: New test. --- gcc/expr.c.jj 2011-05-11 19:39:04.0 +0200 +++ gcc/expr.c 2011-05-12 10:46:52.0 +0200 @@ -8105,7 +8105,10 @@ expand_expr_real_2 (sepops ops, rtx targ op1 = gen_label_rtx (); jumpifnot_1 (code, treeop0, treeop1, op1, -1); - emit_move_insn (target, const1_rtx); + if (TYPE_PRECISION (type) == 1 !TYPE_UNSIGNED (type)) + emit_move_insn (target, constm1_rtx); + else + emit_move_insn (target, const1_rtx); emit_label (op1); return target; @@ -10050,7 +10053,8 @@ do_store_flag (sepops ops, rtx target, e if ((code == NE || code == EQ) TREE_CODE (arg0) == BIT_AND_EXPR integer_zerop (arg1) - integer_pow2p (TREE_OPERAND (arg0, 1))) + integer_pow2p (TREE_OPERAND (arg0, 1)) + (TYPE_PRECISION (ops-type) != 1 || TYPE_UNSIGNED (ops-type))) { tree type = lang_hooks.types.type_for_mode (mode, unsignedp); return expand_expr (fold_single_bit_test (loc, @@ -10070,7 +10074,9 @@ do_store_flag (sepops ops, rtx target, e /* Try a cstore if possible. */ return emit_store_flag_force (target, code, op0, op1, - operand_mode, unsignedp, 1); + operand_mode, unsignedp, + (TYPE_PRECISION (ops-type) == 1 + !TYPE_UNSIGNED (ops-type)) ? -1 : 1); } --- gcc/testsuite/gcc.c-torture/execute/pr48973-1.c.jj 2011-05-12 10:53:49.0 +0200 +++ gcc/testsuite/gcc.c-torture/execute/pr48973-1.c 2011-05-12 10:53:12.0 +0200 @@ -0,0 +1,20 @@ +/* PR middle-end/48973 */ + +extern void abort (void); +struct S { int f : 1; } s; +int v = -1; + +void +foo (unsigned int x) +{ + if (x != -1U) +abort (); +} + +int +main () +{ + s.f = (v 1) 0; + foo (s.f); + return 0; +} --- gcc/testsuite/gcc.c-torture/execute/pr48973-2.c.jj 2011-05-12 10:53:52.0 +0200 +++ gcc/testsuite/gcc.c-torture/execute/pr48973-2.c 2011-05-12 10:53:37.0 +0200 @@ -0,0 +1,14 @@ +/* PR middle-end/48973 */ + +extern void abort (void); +struct S { int f : 1; } s; +int v = -1; + +int +main () +{ + s.f = v 0; + if ((unsigned int) s.f != -1U) +abort (); + return 0; +} Jakub
[PATCH] Fix combine_blocks (PR tree-optimization/48975)
Hi! combine_blocks at the end removes most of the bbs, keeps around just loop header, maybe latch and maybe exit_bb. We need to free bb-aux through free_bb_predicate, but that is done in the caller, using array of (former) loop bbs, with the new loop-num_nodes count (at most 3). While that properly frees bb-aux for loop-header, it might very well access bb-aux of deleted bbs and free that, for most of the deleted bbs will leak memory and might keep around bb-aux for latch and/or exit_bb (which is incorrect as following passes expect that bb-aux is NULL upon entry - shouldn't we with ENABLE_CHECKING verify bb-aux is NULL after every pass instead of just testing it at the beginning of a couple of passes?). Fixed by calling free_bb_predicate already before deleting any bbs, for all bbs in the loop, and making sure the caller doesn't do it again. Bootstrapped/regtested on x86_64linux and i686-linux, ok for trunk? 2011-05-12 Jakub Jelinek ja...@redhat.com PR tree-optimization/48975 * tree-if-conv.c (combine_blocks): Call free_bb_predicate on all bbs here and free and clear ifc_bbs at the end. * gcc.dg/pr48975.c: New test. --- gcc/tree-if-conv.c.jj 2011-05-02 18:39:28.0 +0200 +++ gcc/tree-if-conv.c 2011-05-12 12:20:33.0 +0200 @@ -1637,6 +1637,7 @@ combine_blocks (struct loop *loop) for (i = 0; i orig_loop_num_nodes; i++) { bb = ifc_bbs[i]; + free_bb_predicate (bb); if (bb_with_exit_edge_p (loop, bb)) { exit_bb = bb; @@ -1712,6 +1713,9 @@ combine_blocks (struct loop *loop) exit_bb != loop-header can_merge_blocks_p (loop-header, exit_bb)) merge_blocks (loop-header, exit_bb); + + free (ifc_bbs); + ifc_bbs = NULL; } /* If-convert LOOP when it is legal. For the moment this pass has no --- gcc/testsuite/gcc.dg/pr48975.c.jj 2011-05-12 12:23:59.0 +0200 +++ gcc/testsuite/gcc.dg/pr48975.c 2011-05-12 12:23:51.0 +0200 @@ -0,0 +1,18 @@ +/* PR tree-optimization/48975 */ +/* { dg-do compile } */ +/* { dg-options -O3 -ffast-math -fno-tree-slp-vectorize } */ + +static int +foo (int x) +{ + return (x 0) ? 0 : x + 1; +} + +void +bar (unsigned int x) +{ + int l = 1; +lab: + while (x) +x = foo (x); +} Jakub
Re: [PATCH] Fix combine_blocks (PR tree-optimization/48975)
On Thu, May 12, 2011 at 4:42 PM, Jakub Jelinek ja...@redhat.com wrote: Hi! combine_blocks at the end removes most of the bbs, keeps around just loop header, maybe latch and maybe exit_bb. We need to free bb-aux through free_bb_predicate, but that is done in the caller, using array of (former) loop bbs, with the new loop-num_nodes count (at most 3). While that properly frees bb-aux for loop-header, it might very well access bb-aux of deleted bbs and free that, for most of the deleted bbs will leak memory and might keep around bb-aux for latch and/or exit_bb (which is incorrect as following passes expect that bb-aux is NULL upon entry - shouldn't we with ENABLE_CHECKING verify bb-aux is NULL after every pass instead of just testing it at the beginning of a couple of passes?). I think verify_flow might be a good place to check this. Fixed by calling free_bb_predicate already before deleting any bbs, for all bbs in the loop, and making sure the caller doesn't do it again. Bootstrapped/regtested on x86_64linux and i686-linux, ok for trunk? Ok. Thanks, Richard. 2011-05-12 Jakub Jelinek ja...@redhat.com PR tree-optimization/48975 * tree-if-conv.c (combine_blocks): Call free_bb_predicate on all bbs here and free and clear ifc_bbs at the end. * gcc.dg/pr48975.c: New test. --- gcc/tree-if-conv.c.jj 2011-05-02 18:39:28.0 +0200 +++ gcc/tree-if-conv.c 2011-05-12 12:20:33.0 +0200 @@ -1637,6 +1637,7 @@ combine_blocks (struct loop *loop) for (i = 0; i orig_loop_num_nodes; i++) { bb = ifc_bbs[i]; + free_bb_predicate (bb); if (bb_with_exit_edge_p (loop, bb)) { exit_bb = bb; @@ -1712,6 +1713,9 @@ combine_blocks (struct loop *loop) exit_bb != loop-header can_merge_blocks_p (loop-header, exit_bb)) merge_blocks (loop-header, exit_bb); + + free (ifc_bbs); + ifc_bbs = NULL; } /* If-convert LOOP when it is legal. For the moment this pass has no --- gcc/testsuite/gcc.dg/pr48975.c.jj 2011-05-12 12:23:59.0 +0200 +++ gcc/testsuite/gcc.dg/pr48975.c 2011-05-12 12:23:51.0 +0200 @@ -0,0 +1,18 @@ +/* PR tree-optimization/48975 */ +/* { dg-do compile } */ +/* { dg-options -O3 -ffast-math -fno-tree-slp-vectorize } */ + +static int +foo (int x) +{ + return (x 0) ? 0 : x + 1; +} + +void +bar (unsigned int x) +{ + int l = 1; +lab: + while (x) + x = foo (x); +} Jakub
Patch ping
Hi! - http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00403.html debug info improvement for unused parameters passed in memory - http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01669.html PR48688 optimization, I know Richard asked for trying it during combine, but that attempt failed due to opposite optimization Jakub
[Ada] Fix problem with sliding view conversion on OUT parameter
You can invoke a procedure on a cast (type conversion) in Ada, even if the formal parameter is Out or In Out; if this case, the conversion is deemed a view conversion and is applied in both directions. Geert just found out that we don't properly handle these view conversions for unconstrained array types, because we simply drop them somewhere in gigi. Fixed thusly, tested on i586-suse-linux, applied on the mainline. 2011-05-12 Eric Botcazou ebotca...@adacore.com * gcc-interface/trans.c (call_to_gnu): In the by-reference case, if the type of the parameter is an unconstrained array, convert the actual to the type of the formal in the In Out and Out cases as well. 2011-05-12 Geert Bosch bo...@adacore.com * gnat.dg/view_conversion1.adb: New test. -- Eric Botcazou Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 173693) +++ gcc-interface/trans.c (working copy) @@ -3018,12 +3018,18 @@ call_to_gnu (Node_Id gnat_node, tree *gn /* There is no need to convert the actual to the formal's type before taking its address. The only exception is for unconstrained array types because of the way we build fat pointers. */ - else if (TREE_CODE (gnu_formal_type) == UNCONSTRAINED_ARRAY_TYPE) - gnu_actual = convert (gnu_formal_type, gnu_actual); + if (TREE_CODE (gnu_formal_type) == UNCONSTRAINED_ARRAY_TYPE) + { + /* Put back a view conversion for In Out or Out parameters. */ + if (Ekind (gnat_formal) != E_In_Parameter) + gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)), + gnu_actual); + gnu_actual = convert (gnu_formal_type, gnu_actual); + } /* The symmetry of the paths to the type of an entity is broken here since arguments don't know that they will be passed by ref. */ - gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); + gnu_formal_type = TREE_TYPE (gnu_formal); if (DECL_BY_DOUBLE_REF_P (gnu_formal)) gnu_actual @@ -3036,7 +3042,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn TREE_CODE (gnu_formal) == PARM_DECL DECL_BY_COMPONENT_PTR_P (gnu_formal)) { - gnu_formal_type = TREE_TYPE (get_gnu_tree (gnat_formal)); + gnu_formal_type = TREE_TYPE (gnu_formal); gnu_actual = maybe_implicit_deref (gnu_actual); gnu_actual = maybe_unconstrained_array (gnu_actual); -- { dg-do run } -- { dg-options -gnatws } procedure View_Conversion1 is type Matrix is array (Integer range , Integer range ) of Float; S1 : Matrix (-3 .. -2, 2 .. 3) := ((2.0, -1.0), (-1.0, 2.0)); S2 : Matrix (1 .. 2, 1 .. 2) := S1; S3 : Matrix (2 .. 3, -3 .. -2); S4 : Matrix (1 .. 2, 1 .. 2); function Normal_Last (A : Matrix; N : Natural) return Boolean is begin if A'Last (1) = N and then A'Last (2) = N then return True; else return False; end if; end; procedure Transpose (A : Matrix; B : out Matrix) is N : constant Natural := A'Length (1); subtype Normal_Matrix is Matrix (1 .. N, 1 .. N); begin if not Normal_Last (A, N) or else not Normal_Last (B, N) then Transpose (Normal_Matrix (A), Normal_Matrix (B)); return; end if; for J in 1 .. N loop for K in 1 .. N loop B (J, K) := A (K, J); end loop; end loop; end; begin Transpose (S1, S3); Transpose (S3, S4); if S4 /= S2 then raise Program_Error; end if; end;
Re: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
On Wed, May 11, 2011 at 12:28:18PM -0700, H.J. Lu wrote: This patch restores the old behavior for Pmode. OK for trunk if there are no regressions? That is IMHO wrong, ignoring subregs is a very bad idea. While you can workaround generation of the DW_OP_GNU_convert that way (why do you want that?, just install newer gdb that has typed dwarf stack support, coming hopefully soon), you'd get incorrect debug info for long long to int casts. Jakub
Re: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
On Thu, May 12, 2011 at 7:56 AM, Jakub Jelinek ja...@redhat.com wrote: On Wed, May 11, 2011 at 12:28:18PM -0700, H.J. Lu wrote: This patch restores the old behavior for Pmode. OK for trunk if there are no regressions? That is IMHO wrong, ignoring subregs is a very bad idea. While you can workaround generation of the DW_OP_GNU_convert that way (why do you want that?, just install newer gdb that has typed dwarf stack support, coming hopefully soon), you'd get incorrect debug info for long long to int casts. I will wait for the new gdb. Thanks. -- H.J.
[PATCH] Tweaks to the interface between ipa-inline-analysis and ipa-cp/ipa-prop
Hi, the original intention of this patch was not only to make the interface a bit nicer and internals of the lattice isolated but also so that we do not use struct ipcp_lattice in ipa-inline-analysis.c and thus my large modifications of theat structure do not have to be reflected in the file. Perhaps more importantly however, in my current work on allowing ipa-cp to have more than one value in a lattice, the new function estimate_ipcp_clone_size_and_time cannot pick the parameter values by itself, ipa-cp has to supply the opportunities in a vector and pick among them according to the returned results. Therefore I have also changed the interface of that function too. By the way, in the future we may want ipa-cp to merge clones that are equivalent (let's say one of the predicate says that a parameter is greater than 10 and we have a bunch of callers supplying values 1, 2 and 8, we will want to create just one clone for all three values because the effect is the same). This means that eventually ipa-cp will be interested in the clause_t for various values, merge opportunities which have the same one, create a single clone for them and somehow have the materialization modify the function body accordingly. The infrastructure required is not trivial but it is probably something to think about. I have bootstrapped and tested this patch on x86_64-linux without any issues. OK for trunk? Thanks, Martin 2011-05-10 Martin Jambor mjam...@suse.cz * ipa-prop.c (ipa_cst_from_jfunc): New function. * ipa-prop.h (ipa_cst_from_jfunc): Declare. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Use it. (evaluate_conditions_for_ipcp_clone): Removed. (estimate_ipcp_clone_size_and_time): Accept vector of known constants. * ipa-cp.c (ipcp_estimate_growth): Build vector of known constants. * ipa-inline.h (estimate_ipcp_clone_size_and_time): Update. Index: src/gcc/ipa-inline-analysis.c === --- src.orig/gcc/ipa-inline-analysis.c +++ src/gcc/ipa-inline-analysis.c @@ -592,7 +592,6 @@ evaluate_conditions_for_edge (struct cgr struct ipa_node_params *parms_info; struct ipa_edge_args *args = IPA_EDGE_REF (e); int i, count = ipa_get_cs_argument_count (args); - struct ipcp_lattice lat; VEC (tree, heap) *known_vals = NULL; if (e-caller-global.inlined_to) @@ -603,9 +602,10 @@ evaluate_conditions_for_edge (struct cgr VEC_safe_grow_cleared (tree, heap, known_vals, count); for (i = 0; i count; i++) { - ipa_lattice_from_jfunc (parms_info, lat, ipa_get_ith_jump_func (args, i)); - if (lat.type == IPA_CONST_VALUE) - VEC_replace (tree, known_vals, i, lat.constant); + tree cst = ipa_cst_from_jfunc (parms_info, +ipa_get_ith_jump_func (args, i)); + if (cst) + VEC_replace (tree, known_vals, i, cst); } clause = evaluate_conditions_for_known_args (e-callee, inline_p, known_vals); @@ -619,31 +619,6 @@ evaluate_conditions_for_edge (struct cgr } -/* Work out what conditions might be true at invocation of NODE - that is (future) ipa-cp clone. */ - -static clause_t -evaluate_conditions_for_ipcp_clone (struct cgraph_node *node) -{ - struct ipa_node_params *parms_info = IPA_NODE_REF (node); - int i, count = ipa_get_param_count (parms_info); - struct ipcp_lattice *lat; - VEC (tree, heap) *known_vals = NULL; - clause_t clause; - - VEC_safe_grow_cleared (tree, heap, known_vals, count); - for (i = 0; i count; i++) -{ - lat = ipa_get_lattice (parms_info, i); - if (lat-type == IPA_CONST_VALUE) - VEC_replace (tree, known_vals, i, lat-constant); -} - clause = evaluate_conditions_for_known_args (node, false, known_vals); - VEC_free (tree, heap, known_vals); - return clause; -} - - /* Allocate the inline summary vector or resize it to cover all cgraph nodes. */ static void @@ -1823,18 +1798,19 @@ estimate_node_size_and_time (struct cgra } -/* Estimate size and time needed to execute callee of EDGE assuming - that parameters known to be constant at caller of EDGE are - propagated. If INLINE_P is true, it is assumed that call will - be inlined. */ +/* Estimate size and time needed to execute callee of EDGE assuming that + parameters known to be constant at caller of EDGE are propagated. + KNOWN_VALs is a vector of assumed known constant values for parameters. */ void estimate_ipcp_clone_size_and_time (struct cgraph_node *node, + VEC (tree, heap) *known_vals, int *ret_size, int *ret_time) { - estimate_node_size_and_time (node, - evaluate_conditions_for_ipcp_clone (node), - ret_size, ret_time); + clause_t clause; + +
Re: C6X port 8/11: A new FUNCTION_ARG macro
On 05/10/2011 06:57 PM, Joseph S. Myers wrote: On Tue, 10 May 2011, Bernd Schmidt wrote: On C6X, we have PARM_BOUNDARY == 8 (one byte), but some function argument slots still must be rounded to a larger value. As far as I could tell there's currently no way of telling gcc about this, hence a new target macro which controls this behaviour. Is there a good reason this has to be a macro rather than a hook in targetm.calls? Hooks are generally strongly preferred. New version below. An adapted version of the C6X port will follow. Bernd * doc/tm.texi.in (FUNCTION_ARG_PADDING): Mention TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY. (TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY): Add hook. * function.c (locate_and_pad_parm): Take it into account. * target.def (function_arg_round_to_arg_boundary): New hook. * hooks.c (hook_bool_mode_const_tree_false): New function. * hooks.h (hook_bool_mode_const_tree_false): Declare. * doc/tm.texi: Regenerate. Index: gcc/doc/tm.texi === --- gcc/doc/tm.texi.orig +++ gcc/doc/tm.texi @@ -4163,9 +4163,11 @@ to pad out an argument with extra space. @code{enum direction}: either @code{upward} to pad above the argument, @code{downward} to pad below, or @code{none} to inhibit padding. -The @emph{amount} of padding is always just enough to reach the next -multiple of @code{TARGET_FUNCTION_ARG_BOUNDARY}; this macro does not -control it. +The @emph{amount} of padding is not controlled by this macro. It is +always just enough to reach the next multiple of the alignment boundary, +which is usually @code{PARM_BOUNDARY}, or @code{FUNCTION_ARG_BOUNDARY} +if @code{TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY} is overridden to +return true. This macro has a default definition which is right for most systems. For little-endian machines, the default is to pad upward. For @@ -4198,6 +4200,12 @@ with the specified mode and type. The d @code{PARM_BOUNDARY} for all arguments. @end deftypefn +@deftypefn {Target Hook} bool TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY (enum machine_mode @var{mode}, const_tree @var{type}) +Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY}. +Define this macro if you want the value of @code{FUNCTION_ARG_BOUNDARY} +to be used for this rounding instead. +@end deftypefn + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does Index: gcc/doc/tm.texi.in === --- gcc/doc/tm.texi.in.orig +++ gcc/doc/tm.texi.in @@ -4151,9 +4151,11 @@ to pad out an argument with extra space. @code{enum direction}: either @code{upward} to pad above the argument, @code{downward} to pad below, or @code{none} to inhibit padding. -The @emph{amount} of padding is always just enough to reach the next -multiple of @code{TARGET_FUNCTION_ARG_BOUNDARY}; this macro does not -control it. +The @emph{amount} of padding is not controlled by this macro. It is +always just enough to reach the next multiple of the alignment boundary, +which is usually @code{PARM_BOUNDARY}, or @code{FUNCTION_ARG_BOUNDARY} +if @code{TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY} is overridden to +return true. This macro has a default definition which is right for most systems. For little-endian machines, the default is to pad upward. For @@ -4186,6 +4188,8 @@ with the specified mode and type. The d @code{PARM_BOUNDARY} for all arguments. @end deftypefn +@hook TARGET_FUNCTION_ARG_ROUND_TO_ARG_BOUNDARY + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does Index: gcc/function.c === --- gcc/function.c.orig +++ gcc/function.c @@ -3709,7 +3709,7 @@ locate_and_pad_parm (enum machine_mode p { tree sizetree; enum direction where_pad; - unsigned int boundary; + unsigned int boundary, round_boundary; int reg_parm_stack_space = 0; int part_size_in_regs; @@ -3741,6 +3741,10 @@ locate_and_pad_parm (enum machine_mode p = type ? size_in_bytes (type) : size_int (GET_MODE_SIZE (passed_mode)); where_pad = FUNCTION_ARG_PADDING (passed_mode, type); boundary = targetm.calls.function_arg_boundary (passed_mode, type); + if (targetm.calls.function_arg_round_to_arg_boundary (passed_mode, type)) +round_boundary = boundary; + else +round_boundary = PARM_BOUNDARY; locate-where_pad = where_pad; /* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT. */ @@ -3787,8 +3791,8 @@ locate_and_pad_parm (enum machine_mode p tree s2 = sizetree; if (where_pad != none (!host_integerp (sizetree, 1) - || (tree_low_cst (sizetree, 1) *
Re: C6X port 5/11: Track predication conditions more accurately
On 05/11/2011 12:45 PM, Alexander Monakov wrote: Could the above be conditional on whether the target CPU is exposed-pipeline? Can do. New patch below. I'm concerned this may degrade scheduling for other targets in some cases. On the other hand, it may also improve scheduling. Hard to say which case would be more common. Bernd * sched-int.h (struct _haifa_deps_insn_data): New members cond and reverse_cond. (INSN_COND, INSN_REVERSE_COND): New macros. * sched-deps.c (deps_analyze_insn): Call sched_get_condition_with_rev once. (sched_get_condition_with_rev): Cache the results, and look them up if possible. (sched_analyze_insn): Destroy INSN_COND of previous insns if they are clobbered by the current insn. * target.def (exposed_pipline): New sched data hook. * doc/tm.texi.in: TARGET_SCHED_EXPOSED_PIPELINE: Add hook. * doc/tm.texi: Regenerate. Index: gcc/sched-deps.c === --- gcc/sched-deps.c.orig +++ gcc/sched-deps.c @@ -489,13 +489,27 @@ deps_may_trap_p (const_rtx mem) /* Find the condition under which INSN is executed. If REV is not NULL, it is set to TRUE when the returned comparison should be reversed - to get the actual condition. */ + to get the actual condition. + We only do actual work the first time we come here for an insn; the + results are cached in INSN_COND and INSN_REVERSE_COND. */ static rtx sched_get_condition_with_rev (const_rtx insn, bool *rev) { rtx pat = PATTERN (insn); rtx src; + if (INSN_COND (insn) == const_true_rtx) +return NULL_RTX; + + if (INSN_COND (insn) != NULL_RTX) +{ + if (rev) + *rev = INSN_REVERSE_COND (insn); + return INSN_COND (insn); +} + + INSN_COND (insn) = const_true_rtx; + INSN_REVERSE_COND (insn) = false; if (pat == 0) return 0; @@ -503,7 +517,10 @@ sched_get_condition_with_rev (const_rtx *rev = false; if (GET_CODE (pat) == COND_EXEC) -return COND_EXEC_TEST (pat); +{ + INSN_COND (insn) = COND_EXEC_TEST (pat); + return COND_EXEC_TEST (pat); +} if (!any_condjump_p (insn) || !onlyjump_p (insn)) return 0; @@ -511,7 +528,10 @@ sched_get_condition_with_rev (const_rtx src = SET_SRC (pc_set (insn)); if (XEXP (src, 2) == pc_rtx) -return XEXP (src, 0); +{ + INSN_COND (insn) = XEXP (src, 0); + return XEXP (src, 0); +} else if (XEXP (src, 1) == pc_rtx) { rtx cond = XEXP (src, 0); @@ -522,6 +542,8 @@ sched_get_condition_with_rev (const_rtx if (rev) *rev = true; + INSN_COND (insn) = cond; + INSN_REVERSE_COND (insn) = true; return cond; } @@ -2841,6 +2863,8 @@ sched_analyze_insn (struct deps_desc *de } else { + regset_head set_or_clobbered; + EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i, rsi) { struct deps_reg *reg_last = deps-reg_last[i]; @@ -2871,6 +2895,25 @@ sched_analyze_insn (struct deps_desc *de } } + if (targetm.sched.exposed_pipeline) + { + INIT_REG_SET (set_or_clobbered); + bitmap_ior (set_or_clobbered, reg_pending_clobbers, + reg_pending_sets); + EXECUTE_IF_SET_IN_REG_SET (set_or_clobbered, 0, i, rsi) + { + struct deps_reg *reg_last = deps-reg_last[i]; + rtx list; + for (list = reg_last-uses; list; list = XEXP (list, 1)) + { + rtx other = XEXP (list, 0); + if (INSN_COND (other) != const_true_rtx + refers_to_regno_p (i, i + 1, INSN_COND (other), NULL)) + INSN_COND (other) = const_true_rtx; + } + } + } + /* If the current insn is conditional, we can't free any of the lists. */ if (sched_has_condition_p (insn)) @@ -3245,6 +3288,10 @@ deps_analyze_insn (struct deps_desc *dep if (sched_deps_info-start_insn) sched_deps_info-start_insn (insn); + /* Record the condition for this insn. */ + if (NONDEBUG_INSN_P (insn)) +sched_get_condition_with_rev (insn, NULL); + if (NONJUMP_INSN_P (insn) || DEBUG_INSN_P (insn) || JUMP_P (insn)) { /* Make each JUMP_INSN (but not a speculative check) Index: gcc/sched-int.h === --- gcc/sched-int.h.orig +++ gcc/sched-int.h @@ -716,6 +716,17 @@ struct _haifa_deps_insn_data search in 'forw_deps'. */ deps_list_t resolved_forw_deps; + /* If the insn is conditional (either through COND_EXEC, or because + it is a conditional branch), this records the condition. NULL + for insns that haven't been seen yet or don't have a condition; + const_true_rtx to mark an insn without a condition, or with a + condition that has been clobbered by a subsequent insn. */ + rtx
Re: [PATCH] Tweaks to the interface between ipa-inline-analysis and ipa-cp/ipa-prop
By the way, in the future we may want ipa-cp to merge clones that are equivalent (let's say one of the predicate says that a parameter is greater than 10 and we have a bunch of callers supplying values 1, 2 and 8, we will want to create just one clone for all three values because the effect is the same). This means that eventually ipa-cp will be interested in the clause_t for various values, merge opportunities which have the same one, create a single clone for them and somehow have the materialization modify the function body accordingly. The infrastructure required is not trivial but it is probably something to think about. Yep, I also wondered about this. It will however need some way to promote down the set of known truths to local optimizers... 2011-05-10 Martin Jambor mjam...@suse.cz * ipa-prop.c (ipa_cst_from_jfunc): New function. * ipa-prop.h (ipa_cst_from_jfunc): Declare. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Use it. (evaluate_conditions_for_ipcp_clone): Removed. (estimate_ipcp_clone_size_and_time): Accept vector of known constants. * ipa-cp.c (ipcp_estimate_growth): Build vector of known constants. * ipa-inline.h (estimate_ipcp_clone_size_and_time): Update. OK Honza
[Patch, fortran] PR48955 [4.6/4.7 Regression] Wrong result for array assignment due to missing temporary
This patch fixes the problem in two steps: (i) It reverts r162289; and (ii) It adds the correct initialization for loop.reverse[] in gfc_trans_assignment_1. This was implemented incorrectly in the fix for PR24524 (in spite of the correct comment in dependency.c!) and removed at sometime, I do not know why. Bootstraps and regtests on x86_64/FC9. OK for trunk and 4.6? Paul 2011-05-12 Paul Thomas pa...@gcc.gnu.org PR fortran/48955 * dependency.c (gfc_dep_resolver): Revert r162829 which changed the condition for setting this_dep to GFC_DEP_OVERLAP. * trans-expr.c (gfc_trans_assignment_1): Enable loop reversal. 2011-05-12 Paul Thomas pa...@gcc.gnu.org PR fortran/48955 * gfortran.dg/dependency_40.f90 : New test. Index: gcc/fortran/trans-expr.c === *** gcc/fortran/trans-expr.c (revision 173649) --- gcc/fortran/trans-expr.c (working copy) *** gfc_trans_assignment_1 (gfc_expr * expr1 *** 6052,6057 --- 6052,6061 /* Initialize the scalarizer. */ gfc_init_loopinfo (loop); + /* Enable loop reversal. */ + for (n = 0; n GFC_MAX_DIMENSIONS; n++) + loop.reverse[n] = GFC_CAN_REVERSE; + /* Walk the rhs. */ rss = gfc_walk_expr (expr2); if (rss == gfc_ss_terminator) Index: gcc/fortran/dependency.c === *** gcc/fortran/dependency.c (revision 173649) --- gcc/fortran/dependency.c (working copy) *** gfc_dep_resolver (gfc_ref *lref, gfc_ref *** 1832,1839 /* If no intention of reversing or reversing is explicitly inhibited, convert backward dependence to overlap. */ ! if (this_dep == GFC_DEP_BACKWARD ! (reverse == NULL || reverse[n] == GFC_CANNOT_REVERSE)) this_dep = GFC_DEP_OVERLAP; } --- 1832,1839 /* If no intention of reversing or reversing is explicitly inhibited, convert backward dependence to overlap. */ ! if ((reverse == NULL this_dep == GFC_DEP_BACKWARD) ! || (reverse != NULL reverse[n] == GFC_CANNOT_REVERSE)) this_dep = GFC_DEP_OVERLAP; } Index: gcc/testsuite/gfortran.dg/dependency_40.f90 === *** gcc/testsuite/gfortran.dg/dependency_40.f90 (revision 0) --- gcc/testsuite/gfortran.dg/dependency_40.f90 (revision 0) *** *** 0 --- 1,17 + ! { dg-do run } + !Test the fix for PR48955, in which a temporary was not being generated for + ! the dependent assignment to 'V1'. + ! + ! Reported by Tobias Burnus bur...@gcc.gnu.org + ! + program ala +implicit none +integer, parameter :: n = 8 +real, dimension(n) :: v0, v1, v2 +v0 = [-10.0, -10., -10., -10., 10., 10., 10., 10.] +v1 = v0 +v2 = v0 +v1(2:n-1) = 0.5*(v1(1:n-2) + v1(3:n) + 2.0*v1(2:n-1)) ! Needs temporary +v2(2:n-1) = 0.5*(v0(1:n-2) + v0(3:n) + 2.0*v0(2:n-1)) +if (any (v1 .ne. v2)) call abort + end program ala
Re: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
H.J. == H J Lu hjl.to...@gmail.com writes: H.J. On Thu, May 12, 2011 at 7:56 AM, Jakub Jelinek ja...@redhat.com wrote: On Wed, May 11, 2011 at 12:28:18PM -0700, H.J. Lu wrote: This patch restores the old behavior for Pmode. OK for trunk if there are no regressions? That is IMHO wrong, ignoring subregs is a very bad idea. While you can workaround generation of the DW_OP_GNU_convert that way (why do you want that?, just install newer gdb that has typed dwarf stack support, coming hopefully soon), you'd get incorrect debug info for long long to int casts. H.J. I will wait for the new gdb. I'm going to commit the changes today. Tom
[PATCH] Marking SCCs in ipa_reduced_postorder
Hi, in my current efforts to enhance IPA-CP I propagate values in a single pass over the call graph nodes in the topological order and only resort to propagation until no change in SCCs. In order to do that I need to quickly figure out whether two nodes on both sides of a call graph edge are in the same SCC. I have not found a way of doing that with the current code (please let me know if I overlooked something obvious) but with the patch below it becomes as simple as comparing their ((struct ipa_dfs_info *) node-aux)-low_link The patch bootstraps and tests fine on x86_64-linux. Is it OK for trunk? Thanks, Martin 2011-05-02 Martin Jambor mjam...@suse.cz * ipa-utils.c (searchc): Update low_link to lowest DFN of a SCC. Index: src/gcc/ipa-utils.c === --- src.orig/gcc/ipa-utils.c +++ src/gcc/ipa-utils.c @@ -134,6 +134,7 @@ searchc (struct searchc_env* env, struct x = env-stack[--(env-stack_size)]; x_info = (struct ipa_dfs_info *) x-aux; x_info-on_stack = false; + x_info-low_link = v_info-dfn_number; if (env-reduce) {
Re: C6X port 7/11: Cope with odd section names
On 05/10/2011 06:55 PM, Joseph S. Myers wrote: Unless the documentation is based on pre-existing GFDL-only documentation in tm.texi.in, it's preferable for the documentation of a new hook to go in the doc string in target.def and get to tm.texi that way, rather than putting it directly in tm.texi.in. (So you'd put the @hook in tm.texi.in, but not the main body of the documentation for the hook.) Changed. A default of .rodata instead of NULL would seem to simplify the rest of the patch. Changed. - char name[30]; + char name[80]; There seems to be some undocumented requirement on the maximum length of the string named by the hook, to avoid buffer overruns with these fixed-size buffers. Consider using alloca (or asprintf to avoid needing to work out manually how much to add to the length of the string, but then you need to free things before returning) to avoid such an undocumented bound. Changed. New version below; tests running now on i686-linux after a bootstrap. Bernd * doc/tm.texi.in (TARGET_ASM_MERGEABLE_RODATA_PREFIX): Add hook. * doc/tm.texi: Regenerate. * target.def (mergeable_rodata_prefix: New defhookpod. * varasm.c (mergeable_string_section, mergeable_constant_section): Use it. Allocate name with alloca. Index: gcc/doc/tm.texi === --- gcc/doc/tm.texi.orig +++ gcc/doc/tm.texi @@ -7030,6 +7030,12 @@ if function is in @code{.text.name}, and otherwise. @end deftypefn +@deftypevr {Target Hook} {const char *} TARGET_ASM_MERGEABLE_RODATA_PREFIX +Usually, the compiler uses the prefix @code{.rodata} to construct +section names for mergeable constant data. Define this macro to override +the string if a different section name should be used. +@end deftypevr + @deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align}) Return the section into which a constant @var{x}, of mode @var{mode}, should be placed. You can assume that @var{x} is some kind of Index: gcc/doc/tm.texi.in === --- gcc/doc/tm.texi.in.orig +++ gcc/doc/tm.texi.in @@ -6978,6 +6978,8 @@ if function is in @code{.text.name}, and otherwise. @end deftypefn +@hook TARGET_ASM_MERGEABLE_RODATA_PREFIX + @hook TARGET_ASM_SELECT_RTX_SECTION Return the section into which a constant @var{x}, of mode @var{mode}, should be placed. You can assume that @var{x} is some kind of Index: gcc/target.def === --- gcc/target.def.orig +++ gcc/target.def @@ -296,6 +296,15 @@ DEFHOOK section *, (tree decl), default_function_rodata_section) +/* Nonnull if the target wants to override the default .rodata prefix + for mergeable data sections. */ +DEFHOOKPOD +(mergeable_rodata_prefix, + Usually, the compiler uses the prefix @code{\.rodata\} to construct\n\ +section names for mergeable constant data. Define this macro to override\n\ +the string if a different section name should be used., + const char *, .rodata) + /* Output a constructor for a symbol with a given priority. */ DEFHOOK (constructor, Index: gcc/varasm.c === --- gcc/varasm.c.orig +++ gcc/varasm.c @@ -737,7 +737,8 @@ mergeable_string_section (tree decl ATTR const char *str; HOST_WIDE_INT i; int j, unit; - char name[30]; + const char *prefix = targetm.asm_out.mergeable_rodata_prefix; + char *name = (char *) alloca (strlen (prefix) + 30); mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (decl))); modesize = GET_MODE_BITSIZE (mode); @@ -761,8 +762,8 @@ mergeable_string_section (tree decl ATTR } if (i == len - unit) { - sprintf (name, .rodata.str%d.%d, modesize / 8, - (int) (align / 8)); + sprintf (name, %s.str%d.%d, prefix, + modesize / 8, (int) (align / 8)); flags |= (modesize / 8) | SECTION_MERGE | SECTION_STRINGS; return get_section (name, flags, NULL); } @@ -789,9 +790,10 @@ mergeable_constant_section (enum machine align = 256 (align (align - 1)) == 0) { - char name[24]; + const char *prefix = targetm.asm_out.mergeable_rodata_prefix; + char *name = (char *) alloca (strlen (prefix) + 30); - sprintf (name, .rodata.cst%d, (int) (align / 8)); + sprintf (name, %s.cst%d, prefix, (int) (align / 8)); flags |= (align / 8) | SECTION_MERGE; return get_section (name, flags, NULL); }
Re: [Patch, fortran] PR48955 [4.6/4.7 Regression] Wrong result for array assignment due to missing temporary
On 05/12/2011 05:46 PM, Paul Richard Thomas wrote: This patch fixes the problem in two steps: (i) It reverts r162289; and (ii) It adds the correct initialization for loop.reverse[] in gfc_trans_assignment_1. This was implemented incorrectly in the fix for PR24524 (in spite of the correct comment in dependency.c!) and removed at sometime, I do not know why. Bootstraps and regtests on x86_64/FC9. OK for trunk and 4.6? Looks OK - unless Thomas has objections. I would prefer if you could credit Kacper Kowalik for the example - he reported it on IRC (and CCed himself to the PR after I reported it.) I only relayed the example and did some minor analysis. Tobias PS: Regarding regressions, I think gfortran is doing fine - ignoring the restricted pointer PR 45586. What are your next plans for gfortran? I wouldn't mind if you could fix PR 47674 - it always pops up as only testsuite failure when I regtest. Though, as the test case never worked, I am not sure whether one can classify it as regression or not. (You may need valgrind to reproduce the failure.) 2011-05-12 Paul Thomaspa...@gcc.gnu.org PR fortran/48955 * dependency.c (gfc_dep_resolver): Revert r162829 which changed the condition for setting this_dep to GFC_DEP_OVERLAP. * trans-expr.c (gfc_trans_assignment_1): Enable loop reversal. 2011-05-12 Paul Thomaspa...@gcc.gnu.org PR fortran/48955 * gfortran.dg/dependency_40.f90 : New test.
Re: C++ PATCH for c++/48948 (rejecting constexpr friend that takes the current class)
While thinking about this issue some more it occurred to me that this deferral can be problematic for constructors, since we use whether or not a constructor is really constexpr to decide whether or not a class is literal. The rule that seems to me to make the most sense is to say that if we don't know yet whether a constructor is really constexpr, it doesn't satisfy the literal class requirement for a constexpr constructor. Tested x86_64-pc-linux-gnu, applied to trunk. commit 7919b46302ba6182d2dfa31d33eacbc2335de31e Author: Jason Merrill ja...@redhat.com Date: Thu May 12 12:33:08 2011 -0400 * cp-tree.h (DECL_DEFERRED_CONSTEXPR_CHECK): New. * semantics.c (validate_constexpr_fundecl): Set it. (check_deferred_constexpr_decls): Clear it. (register_constexpr_fundef): Make sure it isn't set. * decl.c (grok_special_member_properties): Check it. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ec59346..bcf78f8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -93,6 +93,7 @@ c-common.h, not after. TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE) LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (in LAMBDA_EXPR) TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR) + DECL_DEFERRED_CONSTEXPR_CHECK (in FUNCTION_DECL) 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) @@ -2338,6 +2339,11 @@ struct GTY((variable_size)) lang_decl { #define DECL_DECLARED_CONSTEXPR_P(DECL) \ DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL))) +/* True if we can't tell yet whether the argument/return types of DECL + are literal because one is still being defined. */ +#define DECL_DEFERRED_CONSTEXPR_CHECK(DECL) \ + TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL))) + /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a template function. */ #define DECL_PRETTY_FUNCTION_P(NODE) \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 87be112..7939140 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10681,6 +10681,9 @@ grok_special_member_properties (tree decl) TYPE_HAS_LIST_CTOR (class_type) = 1; if (DECL_DECLARED_CONSTEXPR_P (decl) + /* It doesn't count if we can't tell yet whether or not +the constructor is actually constexpr. */ + !DECL_DEFERRED_CONSTEXPR_CHECK (decl) !copy_fn_p (decl) !move_fn_p (decl)) TYPE_HAS_CONSTEXPR_CTOR (class_type) = 1; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ffabad1..f1f3121 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5483,7 +5483,10 @@ check_deferred_constexpr_decls (void) deferred_constexpr_decls = NULL; FOR_EACH_VEC_ELT (tree, vec, i, fn) -validate_constexpr_fundecl (fn); +{ + DECL_DEFERRED_CONSTEXPR_CHECK (fn) = false; + validate_constexpr_fundecl (fn); +} if (deferred_constexpr_decls == NULL) { @@ -5516,6 +5519,7 @@ validate_constexpr_fundecl (tree fun) /*defer_ok=*/true); if (valid 0) { + DECL_DEFERRED_CONSTEXPR_CHECK (fun) = true; VEC_safe_push (tree, gc, deferred_constexpr_decls, fun); return NULL; } @@ -5764,6 +5768,9 @@ register_constexpr_fundef (tree fun, tree body) constexpr_fundef entry; constexpr_fundef **slot; + gcc_assert (DECL_DECLARED_CONSTEXPR_P (fun) + !DECL_DEFERRED_CONSTEXPR_CHECK (fun)); + if (DECL_CONSTRUCTOR_P (fun)) body = build_constexpr_constructor_member_initializers (DECL_CONTEXT (fun), body); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C new file mode 100644 index 000..7a9a24d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C @@ -0,0 +1,31 @@ +// A constructor that might or might not be constexpr doesn't make +// its class literal. +// { dg-options -std=c++0x } + +template class T +struct B +{ + constexpr B(T) { } + constexpr B() {} +}; + +struct A +{ + BA b; +}; + +constexpr A a {}; + +template class T +struct C +{ + constexpr C(T) { } + C() {} +}; + +struct D +{ + CD c; +}; + +constexpr D d {}; // { dg-error not literal }
Re: [RFC PATCH] Typed DWARF stack
Just for the record... Tom What my patch does now is that it generally uses a signed integer type Tom of the appropriate width for legacy DWARF values. Then, for mod, if Tom the value's type is this special type, it converts it to an Tom identically-sized unsigned type, and converts back after the operation. Tom For DW_OP_shr, I always convert the LHS to an appropriately-sized Tom unsigned type first. I have since changed this. For explicitly-typed values, I tried DW_OP_shr and DW_OP_shra identically. The type encodes the desired operation. For old-style untyped values, DW_OP_shr converts to unsigned. I thought this approach was most consistent with the rest of the specification. Tom
Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
2011/5/12 Richard Guenther richard.guent...@gmail.com: On Thu, May 12, 2011 at 3:29 PM, Kai Tietz ktiet...@googlemail.com wrote: While testing some other issues with C++'s __java_boolean type occurred. So I adjusted check in test-cfg.c as you suggested. Additionally due the fact that we are now boolifying conditions for even BOOLEAN_TYPE'ed cases (for making sure inner arms are boolified, too), we possibly would alter here truth-type provided by FE. To restore original type (for types != boolean-type), we do type conversion always back to FE's used type for truth-AND/OR/XOR/etc as result. boolean_type_node is the only BOOLEAN_TYPE node we have, so please remove the !=/== boolean_type_node checks again, or, if you want more visual consistency with the adjustment gimple_boolify makes replace them with !=/== boolean_type_node comparisons completely. Ok with either change. Thanks, Richard. Patch bootstrapped with all languages on x86_64-pc-linux-gnu (multilib). Ok for apply? Regards, Kai Index: gcc/gcc/gimplify.c === --- gcc.orig/gcc/gimplify.c 2011-05-12 09:02:58.946243000 +0200 +++ gcc/gcc/gimplify.c 2011-05-12 15:13:59.534550700 +0200 @@ -2824,9 +2824,6 @@ gimple_boolify (tree expr) } } - if (TREE_CODE (type) == BOOLEAN_TYPE) - return expr; - switch (TREE_CODE (expr)) { case TRUTH_AND_EXPR: @@ -2851,6 +2848,9 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ + if (TREE_CODE (type) == BOOLEAN_TYPE + type == boolean_type_node) + return expr; return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -4695,31 +4695,6 @@ gimplify_scalar_mode_aggregate_compare ( return GS_OK; } -/* Gimplify TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR expressions. EXPR_P - points to the expression to gimplify. - - Expressions of the form 'a b' are gimplified to: - - a b ? true : false - - LOCUS is the source location to be put on the generated COND_EXPR. - gimplify_cond_expr will do the rest. */ - -static enum gimplify_status -gimplify_boolean_expr (tree *expr_p, location_t locus) -{ - /* Preserve the original type of the expression. */ - tree type = TREE_TYPE (*expr_p); - - *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert_loc (locus, type, boolean_true_node), - fold_convert_loc (locus, type, boolean_false_node)); - - SET_EXPR_LOCATION (*expr_p, locus); - - return GS_OK; -} - /* Gimplify an expression sequence. This function gimplifies each expression and rewrites the original expression with the last expression of the sequence in GIMPLE form. @@ -6762,12 +6737,26 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - /* Pass the source location of the outer expression. */ - ret = gimplify_boolean_expr (expr_p, saved_location); - break; + { + /* Preserve the original type of the expression and the + source location of the outer expression. */ + tree org_type = TREE_TYPE (*expr_p); + *expr_p = gimple_boolify (*expr_p); + *expr_p = build3_loc (saved_location, COND_EXPR, + org_type, *expr_p, + fold_convert_loc + (saved_location, + org_type, boolean_true_node), + fold_convert_loc + (saved_location, + org_type, boolean_false_node)); + ret = GS_OK; + break; + } case TRUTH_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (*expr_p)) != boolean_type_node) { tree type = TREE_TYPE (*expr_p); *expr_p = fold_convert (type, gimple_boolify (*expr_p)); @@ -7203,6 +7192,24 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, we need to keep + orignal type. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (org_type)) != boolean_type_node) + { + *expr_p =
Re: [RFC PATCH] Typed DWARF stack
Tom I have since changed this. For explicitly-typed values, I tried Tom DW_OP_shr and DW_OP_shra identically. The type encodes the desired Tom operation. Jakub pinged me on irc to say that this is not what GCC actually emits. So, I am going to change GDB to follow. That is, GDB will pick a suitably-sized unsigned type to use for the LHS of DW_OP_shr. Tom
Go patch committed: Fix bug taking address of variable
This patch to the Go frontend fixes a bug when taking the address of a variable when the address of the variable does not escape the function. When the address does escape the variable is moved onto the heap, to avoid danling pointers. When the address does not escape this is not necessary. However, gcc requires that TREE_ADDRESSABLE be set in that case, and the Go frontend was not doing that. This patch fixes that bug. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2011-05-12 Ian Lance Taylor i...@google.com * go-gcc.cc (Gcc_backend::local_variable): Add is_address_taken parameter. (Gcc_backend::parameter_variable): Likewise. Index: gcc/go/go-gcc.cc === --- gcc/go/go-gcc.cc (revision 173685) +++ gcc/go/go-gcc.cc (working copy) @@ -260,11 +260,11 @@ class Gcc_backend : public Backend global_variable_set_init(Bvariable*, Bexpression*); Bvariable* - local_variable(Bfunction*, const std::string name, Btype* type, + local_variable(Bfunction*, const std::string, Btype*, bool, source_location); Bvariable* - parameter_variable(Bfunction*, const std::string name, Btype* type, + parameter_variable(Bfunction*, const std::string, Btype*, bool, source_location); Bvariable* @@ -1074,7 +1074,8 @@ Gcc_backend::global_variable_set_init(Bv Bvariable* Gcc_backend::local_variable(Bfunction* function, const std::string name, - Btype* btype, source_location location) + Btype* btype, bool is_address_taken, + source_location location) { tree type_tree = btype-get_tree(); if (type_tree == error_mark_node) @@ -1084,6 +1085,8 @@ Gcc_backend::local_variable(Bfunction* f type_tree); DECL_CONTEXT(decl) = function-get_tree(); TREE_USED(decl) = 1; + if (is_address_taken) +TREE_ADDRESSABLE(decl) = 1; go_preserve_from_gc(decl); return new Bvariable(decl); } @@ -1092,7 +1095,8 @@ Gcc_backend::local_variable(Bfunction* f Bvariable* Gcc_backend::parameter_variable(Bfunction* function, const std::string name, -Btype* btype, source_location location) +Btype* btype, bool is_address_taken, +source_location location) { tree type_tree = btype-get_tree(); if (type_tree == error_mark_node) @@ -1103,6 +1107,8 @@ Gcc_backend::parameter_variable(Bfunctio DECL_CONTEXT(decl) = function-get_tree(); DECL_ARG_TYPE(decl) = type_tree; TREE_USED(decl) = 1; + if (is_address_taken) +TREE_ADDRESSABLE(decl) = 1; go_preserve_from_gc(decl); return new Bvariable(decl); } Index: gcc/go/gofrontend/gogo.cc === --- gcc/go/gofrontend/gogo.cc (revision 173685) +++ gcc/go/gofrontend/gogo.cc (working copy) @@ -,10 +,11 @@ Variable::Variable(Type* type, Expressio : type_(type), init_(init), preinit_(NULL), location_(location), backend_(NULL), is_global_(is_global), is_parameter_(is_parameter), is_receiver_(is_receiver), is_varargs_parameter_(false), -is_address_taken_(false), seen_(false), init_is_lowered_(false), -type_from_init_tuple_(false), type_from_range_index_(false), -type_from_range_value_(false), type_from_chan_element_(false), -is_type_switch_var_(false), determined_type_(false) +is_address_taken_(false), is_non_escaping_address_taken_(false), +seen_(false), init_is_lowered_(false), type_from_init_tuple_(false), +type_from_range_index_(false), type_from_range_value_(false), +type_from_chan_element_(false), is_type_switch_var_(false), +determined_type_(false) { go_assert(type != NULL || init != NULL); go_assert(!is_parameter || init == NULL); @@ -3722,11 +3723,15 @@ Variable::get_backend_variable(Gogo* gog { tree fndecl = function-func_value()-get_decl(); Bfunction* bfunction = tree_to_function(fndecl); + bool is_address_taken = (this-is_non_escaping_address_taken_ +!this-is_in_heap()); if (is_parameter) bvar = backend-parameter_variable(bfunction, n, btype, + is_address_taken, this-location_); else bvar = backend-local_variable(bfunction, n, btype, + is_address_taken, this-location_); } this-backend_ = bvar; @@ -3757,7 +3762,10 @@ Result_variable::get_backend_variable(Go tree fndecl = function-func_value()-get_decl(); Bfunction* bfunction = tree_to_function(fndecl); std::string n = Gogo::unpack_hidden_name(name); + bool is_address_taken = (this-is_non_escaping_address_taken_ +!this-is_in_heap()); this-backend_ = backend-local_variable(bfunction, n, btype, + is_address_taken, this-location_); } } Index: gcc/go/gofrontend/gogo.h === --- gcc/go/gofrontend/gogo.h (revision 173685) +++ gcc/go/gofrontend/gogo.h (working copy) @@ -1160,6 +1160,22 @@
Re: [PATCH] use AS_HELP_STRING throughout gcc/configure.ac
* Andreas Schwab wrote on Thu, May 12, 2011 at 11:22:12AM CEST: This changes all uses of AC_ARG_(WITH|ENABLE) to use AS_HELP_STRING, fixing a few quoting bugs on the way. OK for trunk? Yes, if you visually compared the diff of configure and of './configure --help' before and after the change, to only contain intended changes. (Which I'm sure you have done.) Thanks, Ralf 2011-05-12 Andreas Schwab sch...@redhat.com * configure.ac: Use AS_HELP_STRING throughout. * configure: Regenerate.
PATCH: Change maybe_eh_return to bool
Hi, This patch changes maybe_eh_return to bool. OK for trunk? Thanks. H.J. --- 2011-05-12 H.J. Lu hongjiu...@intel.com * config/i386/i386.c (ix86_save_reg): Change maybe_eh_return to bool. (ix86_emit_restore_regs_using_mov): Likewise. (ix86_emit_restore_sse_regs_using_mov): Likewise. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1cf8933..357e57c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9066,7 +9066,7 @@ ix86_select_alt_pic_regnum (void) /* Return 1 if we need to save REGNO. */ static int -ix86_save_reg (unsigned int regno, int maybe_eh_return) +ix86_save_reg (unsigned int regno, bool maybe_eh_return) { if (pic_offset_table_rtx regno == REAL_PIC_OFFSET_TABLE_REGNUM @@ -10898,7 +10898,7 @@ ix86_emit_leave (void) First register is restored from CFA - CFA_OFFSET. */ static void ix86_emit_restore_regs_using_mov (HOST_WIDE_INT cfa_offset, - int maybe_eh_return) + bool maybe_eh_return) { struct machine_function *m = cfun-machine; unsigned int regno; @@ -10937,7 +10937,7 @@ ix86_emit_restore_regs_using_mov (HOST_WIDE_INT cfa_offset, First register is restored from CFA - CFA_OFFSET. */ static void ix86_emit_restore_sse_regs_using_mov (HOST_WIDE_INT cfa_offset, - int maybe_eh_return) + bool maybe_eh_return) { unsigned int regno;
Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
On Thu, May 12, 2011 at 11:19 AM, Kai Tietz ktiet...@googlemail.com wrote: 2011/5/12 Richard Guenther richard.guent...@gmail.com: On Thu, May 12, 2011 at 3:29 PM, Kai Tietz ktiet...@googlemail.com wrote: While testing some other issues with C++'s __java_boolean type occurred. So I adjusted check in test-cfg.c as you suggested. Additionally due the fact that we are now boolifying conditions for even BOOLEAN_TYPE'ed cases (for making sure inner arms are boolified, too), we possibly would alter here truth-type provided by FE. To restore original type (for types != boolean-type), we do type conversion always back to FE's used type for truth-AND/OR/XOR/etc as result. boolean_type_node is the only BOOLEAN_TYPE node we have, so please remove the !=/== boolean_type_node checks again, or, if you want more visual consistency with the adjustment gimple_boolify makes replace them with !=/== boolean_type_node comparisons completely. Ok with either change. Thanks, Richard. Patch bootstrapped with all languages on x86_64-pc-linux-gnu (multilib). Ok for apply? Regards, Kai Index: gcc/gcc/gimplify.c === --- gcc.orig/gcc/gimplify.c 2011-05-12 09:02:58.946243000 +0200 +++ gcc/gcc/gimplify.c 2011-05-12 15:13:59.534550700 +0200 @@ -2824,9 +2824,6 @@ gimple_boolify (tree expr) } } - if (TREE_CODE (type) == BOOLEAN_TYPE) - return expr; - switch (TREE_CODE (expr)) { case TRUTH_AND_EXPR: @@ -2851,6 +2848,9 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ + if (TREE_CODE (type) == BOOLEAN_TYPE + type == boolean_type_node) + return expr; return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -4695,31 +4695,6 @@ gimplify_scalar_mode_aggregate_compare ( return GS_OK; } -/* Gimplify TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR expressions. EXPR_P - points to the expression to gimplify. - - Expressions of the form 'a b' are gimplified to: - - a b ? true : false - - LOCUS is the source location to be put on the generated COND_EXPR. - gimplify_cond_expr will do the rest. */ - -static enum gimplify_status -gimplify_boolean_expr (tree *expr_p, location_t locus) -{ - /* Preserve the original type of the expression. */ - tree type = TREE_TYPE (*expr_p); - - *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert_loc (locus, type, boolean_true_node), - fold_convert_loc (locus, type, boolean_false_node)); - - SET_EXPR_LOCATION (*expr_p, locus); - - return GS_OK; -} - /* Gimplify an expression sequence. This function gimplifies each expression and rewrites the original expression with the last expression of the sequence in GIMPLE form. @@ -6762,12 +6737,26 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - /* Pass the source location of the outer expression. */ - ret = gimplify_boolean_expr (expr_p, saved_location); - break; + { + /* Preserve the original type of the expression and the + source location of the outer expression. */ + tree org_type = TREE_TYPE (*expr_p); + *expr_p = gimple_boolify (*expr_p); + *expr_p = build3_loc (saved_location, COND_EXPR, + org_type, *expr_p, + fold_convert_loc + (saved_location, + org_type, boolean_true_node), + fold_convert_loc + (saved_location, + org_type, boolean_false_node)); + ret = GS_OK; + break; + } case TRUTH_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE (*expr_p)) != boolean_type_node) { tree type = TREE_TYPE (*expr_p); *expr_p = fold_convert (type, gimple_boolify (*expr_p)); @@ -7203,6 +7192,24 @@ gimplify_expr (tree *expr_p, gimple_seq case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: + { + tree org_type = TREE_TYPE (*expr_p); + + *expr_p = gimple_boolify (*expr_p); + + /* This shouldn't happen, but due fold-const (and here especially + fold_truth_not_expr) happily uses operand type and doesn't + automatically uses boolean_type as result, we need to keep + orignal type. */ + if (TREE_CODE (org_type) != BOOLEAN_TYPE + || TREE_CODE (TREE_TYPE
A five character qualifier saves the C++ build ...
[ Strong Typing Is For People With Weak Memories ] The attached patch fixes the C++ (--disable-werror) bootstrap: 2011-05-12 Toon Moene t...@moene.org * objc-next-runtime-abi-02.c (objc_build_internal_classname): Add const qualifier to constant variable pointer declaration. Apply as obvious ? -- Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/ Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news Index: objc-next-runtime-abi-02.c === --- objc-next-runtime-abi-02.c (revision 173710) +++ objc-next-runtime-abi-02.c (working copy) @@ -1879,7 +1879,7 @@ objc_build_internal_classname (tree ident, bool me static const char * newabi_append_ro (const char *name) { - char *dollar; + const char *dollar; char *p; static char string[BUFSIZE]; dollar = strchr (name, '$');
Re: A five character qualifier saves the C++ build ...
On May 12, 2011, at 1:33 PM, Toon Moene wrote: [ Strong Typing Is For People With Weak Memories ] :-) 2011-05-12 Toon Moene t...@moene.org * objc-next-runtime-abi-02.c (objc_build_internal_classname): Add const qualifier to constant variable pointer declaration. Apply as obvious ? Yes, it was obvious... Ok.
Re: PATCH: Change maybe_eh_return to bool
On Thu, May 12, 2011 at 9:55 PM, H.J. Lu hongjiu...@intel.com wrote: Hi, This patch changes maybe_eh_return to bool. OK for trunk? Thanks. H.J. --- 2011-05-12 H.J. Lu hongjiu...@intel.com * config/i386/i386.c (ix86_save_reg): Change maybe_eh_return to bool. (ix86_emit_restore_regs_using_mov): Likewise. (ix86_emit_restore_sse_regs_using_mov): Likewise. OK. FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok and perhaps many others...) can also be changed to bool. Thanks, Uros.
Re[2]: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P
Hello, Rainer. this is the patch I've checked in after it passed sparc-sun-solaris2.11 andi i386-pc-solaris2.11 bootstrap. Rainer 2011-05-05 Rainer Orth r...@cebitec.uni-bielefeld.de * config/sparc/sol2.h (ASM_OUTPUT_CALL): Use targetm.asm_out.print_operand. * config/sol2.c: Include target.h. This patch adds a missing dependency to config/t-sol2. Patch is untested. OK to install? * (sol2.o): Add dependency to $(TARGET_H). Index: gcc/config/t-sol2 === --- gcc/config/t-sol2 (revision 173714) +++ gcc/config/t-sol2 (working copy) @@ -25,7 +25,7 @@ # Solaris-specific attributes sol2.o: $(srcdir)/config/sol2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - tree.h output.h $(TM_H) $(TM_P_H) $(GGC_H) + tree.h output.h $(TARGET_H) $(TM_H) $(TM_P_H) $(GGC_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/sol2.c Anatoly.
x86 option handling cleanup, use more .opt features
This patch cleans up x86 option handling to use .opt features where possible for options with string arguments, instead of decoding those strings in ix86_option_override_internal. (The only options with string arguments that may be generated through target attributes are -march=, -mtune= and -mfpmath=; I've left cleaning those up for separate patches.) The following order of preference for where options are handled applies: 1. To the extent possible options should be handled through .opt features. This means using UInteger for options with unsigned integer arguments (unless it's useful to support arguments outside the range of than host int) and Enum for options with enumerated sets of arguments; it means using Mask and Var where those features suffice to record the option settings. 2. Where option handling cannot be done purely with .opt features, it should go in the targetm.handle_option hook as far as possible. This includes code checking an integer argument is in a valid range (that doesn't depend on other options) or setting multiple variables or flags bits in a way that .opt files cannot describe - anything that does not involve modifiable global state (only state accessed through the opts and opts_set pointers) and only depends on a single option, not on the state of other options that might be passed later on the command line. 3. Where global state is involved or it is necessary to look at the final state after all options have been seen, such processing goes in the targetm.target_option.override. For making multilib selection work based on logical state, I plan to split targetm.target_option.override into two hooks, so there will be (3a) use the hook that can see all options but does not use global state and (3b) the hook that does use global state. In preparation for setting up the new hook, it's desirable to simplify existing targetm.target_option.override hook definitions first, which is the function of this patch. Various options with enumerated string arguments are changed to use Enum. Some checking of those arguments was still needed, because the valid values depend on e.g. the -m64 setting, but that checking now works with the enumerated values not strings. I didn't change the existing logic that -mcmodel=32 isn't allowed with PIC even though the 32-bit default is -mcmodel=32 and the implicit option is allowed with PIC, though that logic doesn't make sense to me. Similarly, integer arguments are now handled through UInteger. This eliminates several calls to atoi in the compiler. (We should eliminate atoi completely and poison it - see PR 44574. The UInteger code calls atoi itself, so this patch doesn't actually eliminate the undefined behavior potential for these options, but it reduces the number of places needing changing to get rid of atoi.) UInteger is stricter (checking the whole argument is made of decimal digits); I think that increased strictness is what we want consistently for all integer-argument options. In the case of -mpc, the three options -mpc32, -mpc64 and -mpc80 are handled by specs as separate options, and it seemed most appropriate just to list them as three options in the .opt file as well, rather than using Enum or validating the values of an integer argument. (The compiler doesn't actually use these options at all; they are purely used by specs when linking. Properly the compiler *should* use them to adjust double and long double formats as needed to reflect reduced precision as applicable. That is, -mpc64 should have the effects that the setting of TARGET_96_ROUND_53_LONG_DOUBLE in i386/freebsd.h does, and -mpc32 should similarly adjust the formats of both float and double.) The old handling of -malign-* options (deprecated) had a couple of problems: it would do nothing for -O0 or -O1 because the align_functions etc. variables (global_options fields) would have been set to 1 rather than 0 in that case, and some of the diagnostics had the wrong option names. I moved the handling to ix86_handle_option, so -malign-* and -falign-* now interact in the expected way (the last option specified wins), and fixed the diagnostics. ix86_option_override_internal had many diagnostics that tried to allow for options being passed either on the command line or through attributes. Some of these have i18n problems - see PR 46676. None of the string-argument options affected by this patch can be passed by attributes, so those diagnostics (where still needed given the generic checking of option arguments through increased use of .opt features) are adjusted just to name the options directly. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. Will commit to trunk in the absence of target maintainer objections. 2011-05-12 Joseph Myers jos...@codesourcery.com * config/i386/i386-opts.h: New. * gcc/config/i386/i386.c (stringop_alg, ix86_cmodel, ix86_asm_dialect, ix86_regparm, ix86_abi, ix86_branch_cost,
Re: PATCH: Change maybe_eh_return to bool
On Thu, May 12, 2011 at 2:09 PM, Uros Bizjak ubiz...@gmail.com wrote: On Thu, May 12, 2011 at 9:55 PM, H.J. Lu hongjiu...@intel.com wrote: Hi, This patch changes maybe_eh_return to bool. OK for trunk? Thanks. H.J. --- 2011-05-12 H.J. Lu hongjiu...@intel.com * config/i386/i386.c (ix86_save_reg): Change maybe_eh_return to bool. (ix86_emit_restore_regs_using_mov): Likewise. (ix86_emit_restore_sse_regs_using_mov): Likewise. OK. FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok and perhaps many others...) can also be changed to bool. I will prepare a separate patch. Thanks. -- H.J.
[Patch, Fortran] Reject non-default-kind characters as flags to I/O statements
The patch is a correctness issue as the Fortran standard has those as constraints - and the results of passing kind=4 strings is also odd ... I used also the chance to resolve INQUIRE's decimal ... Build and partially regtested on x86-64-linux. OK for the trunk? Tobias PS: I will regtest again after PR 48984 has been fixed, which caused many test-suite failures. 2011-05-12 Tobias Burnus bur...@net-b.de PR fortran/48972 * io.c (resolve_tag_format, resolve_tag): Make sure that the string is of default kind. (gfc_resolve_inquire): Also resolve decimal tag. 2011-05-12 Tobias Burnus bur...@net-b.de PR fortran/48972 * gfortran.dg/io_constraints_8.f90: New. * gfortran.dg/io_constraints_9.f90: New. diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index df9ee1e..c2d46af 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -1394,10 +1394,12 @@ resolve_tag_format (const gfc_expr *e) || e-symtree-n.sym-as == NULL || e-symtree-n.sym-as-rank == 0)) { - if (e-ts.type != BT_CHARACTER e-ts.type != BT_INTEGER) + if ((e-ts.type != BT_CHARACTER + || e-ts.kind != gfc_default_character_kind) + e-ts.type != BT_INTEGER) { - gfc_error (FORMAT tag at %L must be of type CHARACTER or INTEGER, - e-where); + gfc_error (FORMAT tag at %L must be of type default-kind CHARACTER + or of INTEGER, e-where); return FAILURE; } else if (e-ts.type == BT_INTEGER e-expr_type == EXPR_VARIABLE) @@ -1478,6 +1480,13 @@ resolve_tag (const io_tag *tag, gfc_expr *e) return FAILURE; } + if (e-ts.type == BT_CHARACTER e-ts.kind != gfc_default_character_kind) +{ + gfc_error (%s tag at %L must be a character string of default kind, + tag-name, e-where); + return FAILURE; +} + if (e-rank != 0) { gfc_error (%s tag at %L must be scalar, tag-name, e-where); @@ -4059,6 +4068,7 @@ gfc_resolve_inquire (gfc_inquire *inquire) INQUIRE_RESOLVE_TAG (tag_s_round, inquire-round); INQUIRE_RESOLVE_TAG (tag_pending, inquire-pending); INQUIRE_RESOLVE_TAG (tag_size, inquire-size); + INQUIRE_RESOLVE_TAG (tag_s_decimal, inquire-decimal); #undef INQUIRE_RESOLVE_TAG if (gfc_reference_st_label (inquire-err, ST_LABEL_TARGET) == FAILURE) --- /dev/null 2011-05-12 07:35:17.079892192 +0200 +++ gcc/gcc/testsuite/gfortran.dg/io_constraints_8.f90 2011-05-12 23:19:51.0 +0200 @@ -0,0 +1,72 @@ +! { dg-do compile } +! { dg-options -fmax-errors=100 -Wall } +! +! PR fortran/48972 +! +! +! All string arguments to I/O statements shall +! be of default-character type. (Except for the +! internal unit.) +! + +character(len=30, kind=4) :: str1 +integer :: i + +OPEN(99, access=4_'direct') ! { dg-error must be a character string of default kind } +OPEN(99, action=4_'read') ! { dg-error must be a character string of default kind } +OPEN(99, asynchronous=4_'no') ! { dg-error must be a character string of default kind }) +OPEN(99, blank=4_'null')! { dg-error must be a character string of default kind } +OPEN(99, decimal=4_'comma') ! { dg-error must be a character string of default kind } +OPEN(99, delim=4_'quote') ! { dg-error must be a character string of default kind } +OPEN(99, encoding=4_'default') ! { dg-error must be a character string of default kind } +OPEN(99, file=4_'Test.dat') ! { dg-error must be a character string of default kind } +OPEN(99, form=4_'formatted')! { dg-error must be a character string of default kind } +OPEN(99, pad=4_'yes') ! { dg-error must be a character string of default kind } +OPEN(99, position=4_'asis') ! { dg-error must be a character string of default kind } +OPEN(99, round=4_'down')! { dg-error must be a character string of default kind } +OPEN(99, sign=4_'plus') ! { dg-error must be a character string of default kind } +OPEN(99, status=4_'old')! { dg-error must be a character string of default kind } +OPEN(99, IOSTAT=i, iomsg=str1) ! { dg-error must be a character string of default kind } + +close(99, iostat=i, iomsg=str1) ! { dg-error must be a character string of default kind } +close(99, status=4_'delete')! { dg-error must be a character string of default kind } + +write(99, '(a)', advance=4_'no')! { dg-error must be a character string of default kind } +read (99, *, blank=4_'null')! { dg-error must be a character string of default kind } +write(99, *, decimal=4_'comma') ! { dg-error must be a character string of default kind } +write(99, *, delim=4_'quote') ! { dg-error must be a character string of default kind } +read (99, *, pad=4_'yes') ! { dg-error must be a character string of default kind } +write(99, *, round=4_'down')! { dg-error must be a character string of default kind } +write(99, *, sign=4_'plus') ! { dg-error must be a character string of default kind } + +wait(99, iostat=i, iomsg=str1) ! { dg-error must be a character string of default kind } + +endfile (99, iostat=i, iomsg=str1) ! {
Re: PATCH: Change maybe_eh_return to bool
On Thu, May 12, 2011 at 2:09 PM, Uros Bizjak ubiz...@gmail.com wrote: FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok and perhaps many others...) can also be changed to bool. This patch changes the return type of ix86_save_reg to bool and return value of ix86_hard_regno_mode_ok to bool. OK for trunk? Thanks. -- H.J. --- 2011-05-12 H.J. Lu hongjiu...@intel.com * config/i386/i386.c (ix86_save_reg): Change return type to bool. (ix86_hard_regno_mode_ok): Change return value to bool. 2011-05-12 H.J. Lu hongjiu...@intel.com * config/i386/i386.c (ix86_save_reg): Change return type to bool. (ix86_hard_regno_mode_ok): Change return value to bool. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 357e57c..c06b45d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9065,7 +9065,7 @@ ix86_select_alt_pic_regnum (void) } /* Return 1 if we need to save REGNO. */ -static int +static bool ix86_save_reg (unsigned int regno, bool maybe_eh_return) { if (pic_offset_table_rtx @@ -9074,11 +9074,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return) || crtl-profile || crtl-calls_eh_return || crtl-uses_const_pool)) -{ - if (ix86_select_alt_pic_regnum () != INVALID_REGNUM) - return 0; - return 1; -} +return ix86_select_alt_pic_regnum () == INVALID_REGNUM; if (crtl-calls_eh_return maybe_eh_return) { @@ -9089,12 +9085,12 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return) if (test == INVALID_REGNUM) break; if (test == regno) - return 1; + return true; } } if (crtl-drap_reg regno == REGNO (crtl-drap_reg)) -return 1; +return true; return (df_regs_ever_live_p (regno) !call_used_regs[regno] @@ -29010,7 +29006,7 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode) if (GET_MODE_CLASS (mode) == MODE_CC || GET_MODE_CLASS (mode) == MODE_RANDOM || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) -return 0; +return false; if (FP_REGNO_P (regno)) return VALID_FP_MODE_P (mode); if (SSE_REGNO_P (regno)) @@ -29040,26 +29036,26 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode) /* Take care for QImode values - they can be in non-QI regs, but then they do cause partial register stalls. */ if (regno = BX_REG || TARGET_64BIT) - return 1; + return true; if (!TARGET_PARTIAL_REG_STALL) - return 1; - return reload_in_progress || reload_completed; + return true; + return reload_in_progress != 0 || reload_completed != 0; } /* We handle both integer and floats in the general purpose registers. */ else if (VALID_INT_MODE_P (mode)) -return 1; +return true; else if (VALID_FP_MODE_P (mode)) -return 1; +return true; else if (VALID_DFP_MODE_P (mode)) -return 1; +return true; /* Lots of MMX code casts 8 byte vector modes to DImode. If we then go on to use that value in smaller contexts, this can easily force a pseudo to be allocated to GENERAL_REGS. Since this is no worse than supporting DImode, allow it. */ else if (VALID_MMX_REG_MODE_3DNOW (mode) || VALID_MMX_REG_MODE (mode)) -return 1; +return true; - return 0; + return false; } /* A subroutine of ix86_modes_tieable_p. Return true if MODE is a
Re: [patch][gimplefe] Preliminary variable declaration support
On Wed, May 11, 2011 at 1:19 AM, Diego Novillo dnovi...@google.com wrote: Please add a ChangeLog entry. OK with that change. Committed after adding the ChangeLog entry. -- Cheers Sandy
Re: PR 47793 - Support relative paths using -fprofile-generate
Is this patch ok for trunk? Hi, the patch is OK. Sorry for delayed reply, I was very busy by the inliner/thunk bits and this code is not really in my area of expertise, so it needed some consideration to make sense of it. Honza Allowing relative path in -fprofile-generate= is very useful when running the program remotely -- the profile data will be just dumped in the dir relative to the working dir in the remote machine. Using GCOV_PREFIX_STRIP can workaround the problem, but it is not always to pass environment around. Thanks, David On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson mart...@google.com wrote: On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson mart...@google.com wrote: Change 165596 and 168475 updated the code for handling gcda-paths. As part of this change, relative paths stopped working. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793 This patch adds a guard so that / is not added when no prefix is given. The added testcase uses the path ../gcc/. This puts the gcda in the same directory, so that the cleanup-coverage-files will find them. I have tested the patch using make bootstrap; make -k check with target x86_64-unknown-linux-gnu and saw no additional test failures. Let me know if there is any other testing I should do. ChangeLog gcc/ 2011-02-23 Martin Thuresson mart...@google.com PR gcov-profile/47793 * libgcov.c (gcov_exit): Support relative profile paths. gcc/testsuite/ 2011-02-23 Martin Thuresson mart...@google.com PR gcov-profile/47793 * gcc.dg/pr47793.c: New. Thanks, Martin
[google] support for building Linux kernel with FDO (issue4523061)
This patch add support to build Linux kernel with FDO. Building Linux kernel with FDO needs both compiler change and kernel changes. This part only contains the gcc changes. I'll attach kernel changes to the reveiew thread for reference. Source files gcov-io.c gcov-io.h and libgcov.c will be copied to kernel source and directly used in the kernel build. When building for kernel, we assume option '-D__KERNEL__' is used. To enable profile generation, we need to a.1) set the following config: CONFIG_GCOV_KERNEL=y CONFIG_GCOV_PROFILE_ALL=y a.2) set COMPILER_LIB_PATH to the absolute path to the parent directory of gcov-src. gcov-src is a directory containing the following 4 files: gcov-iov.h gcov-io.h gcov-io.c and libgcov.c. It usually sits at ${GCC_ROOT}/lib/gcc/x86_64-unknown-linux-gnu/${GCC_VERSION}/ a.3) set CFLAGS_GCOV as -fprofile-generate and build the kernel (prof_gen). To obtain the profile data b.1) install profile_gen kernel, mount debugfs. b.2) reset the profile count: echo 1 /sys/kernel/debug/gcov/reset b.3) run the benchmark b.4) cp -r /sys/kernel/debug/gcov/your_kernel_build_dir/ dest_dir To build FDO optimized kernel: c.1 ) same as a.1). c.2 ) same as a.2). c.3) set set CFLAGS_GCOV as -fprofile-use -fprofile-correction -Wcoverage-mismatch and build. Performance results: Tested with 2.6.34 and 2.6.36 kernel with stand-alone benchmarks: tbench(~23%), dbench(~4%), unixbench(1%-2%), no noticable regressions. This patch has been testd with bootstraps, regression test, standalong kernel benchmarks (tbench, dbench, membench, unixbench, iozone, specjbb, and kernbench), and google internal FDO tests. 2011-05-12 Rong Xu x...@google.com * gcc/gcov-io.c (revision 173717): FDO support to build Linux kernel. * gcc/gcov-io.h (revision 173717): FDO support to build Linux kernel. * gcc/coverage.c(revision 173717): set a flag if building for Linux kernel. * gcc/tree-profile.c(revision 173717): don't emit TLS declarations for Linux kernel builds. * gcc/libgcov.c (revision 173717): FDO support to build Linux kernel. Index: gcc/gcov-io.c === --- gcc/gcov-io.c (revision 173717) +++ gcc/gcov-io.c (working copy) @@ -32,6 +32,10 @@ static void gcov_allocate (unsigned); #endif +#ifdef __GCOV_KERNEL__ +struct gcov_var gcov_var ATTRIBUTE_HIDDEN; +#endif + static inline gcov_unsigned_t from_file (gcov_unsigned_t value) { #if !IN_LIBGCOV @@ -54,6 +58,7 @@ Return zero on failure, 0 on opening an existing file and 0 on creating a new one. */ +#ifndef __GCOV_KERNEL__ GCOV_LINKAGE int #if IN_LIBGCOV gcov_open (const char *name) @@ -148,7 +153,24 @@ return 1; } +#else /* __GCOV_KERNEL__ */ +extern _GCOV_FILE *gcov_current_file; + +GCOV_LINKAGE int +gcov_open (const char *name) +{ + gcov_var.start = 0; + gcov_var.offset = gcov_var.length = 0; + gcov_var.overread = -1u; + gcov_var.error = 0; + gcov_var.file = gcov_current_file; + gcov_var.mode = 1; + + return 1; +} +#endif /* __GCOV_KERNEL__ */ + /* Close the current gcov file. Flushes data to disk. Returns nonzero on failure or error flag set. */ @@ -161,7 +183,7 @@ if (gcov_var.offset gcov_var.mode 0) gcov_write_block (gcov_var.offset); #endif - fclose (gcov_var.file); + _GCOV_fclose (gcov_var.file); gcov_var.file = 0; gcov_var.length = 0; } @@ -217,7 +239,7 @@ static void gcov_write_block (unsigned size) { - if (fwrite (gcov_var.buffer, size 2, 1, gcov_var.file) != 1) + if (_GCOV_fwrite (gcov_var.buffer, size 2, 1, gcov_var.file) != 1) gcov_var.error = 1; gcov_var.start += size; gcov_var.offset -= size; @@ -413,7 +435,7 @@ gcov_allocate (gcov_var.length + words); excess = gcov_var.alloc - gcov_var.length; #endif - excess = fread (gcov_var.buffer + gcov_var.length, + excess = _GCOV_fread (gcov_var.buffer + gcov_var.length, 1, excess 2, gcov_var.file) 2; gcov_var.length += excess; if (gcov_var.length words) @@ -554,6 +576,10 @@ GCOV_LINKAGE void gcov_sync (gcov_position_t base, gcov_unsigned_t length) { +#ifdef __GCOV_KERNEL__ + /* should not reach this point */ + gcc_assert (0); +#else /* __GCOV_KERNEL__ */ gcc_assert (gcov_var.mode 0); base += length; if (base - gcov_var.start = gcov_var.length) @@ -561,9 +587,10 @@ else { gcov_var.offset = gcov_var.length = 0; - fseek (gcov_var.file, base 2, SEEK_SET); - gcov_var.start = ftell (gcov_var.file) 2; + _GCOV_fseek (gcov_var.file, base 2, SEEK_SET); + gcov_var.start = _GCOV_ftell (gcov_var.file) 2; } +#endif /* __GCOV_KERNEL__ */ } #endif @@ -576,8 +603,8 @@ gcc_assert (gcov_var.mode 0); if (gcov_var.offset) gcov_write_block (gcov_var.offset); - fseek (gcov_var.file, base 2, SEEK_SET); -