Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
On Fri, Jun 10, 2011 at 20:27, jerry DeLisle jvdeli...@charter.net wrote: On 06/03/2011 05:51 AM, jerry DeLisle wrote: Hi, The attached patch, which includes test cases, fixes this bug by eliminating the code which used floating point instructions to determine the 'r' value as outlined in the Fortran standard under G formatting. Essentially, the code now examines the d and e values to determine the number of digits before and after the decimal point and whether or not to display the 'E' exponent symbol. Adjustments are made for various corner cases, including when rounding has resulted in a carry. (see PR for details of the trials) This patch is intrusive. It results in a minor performance improvement. It eliminates a bit of code. Regression tested on x86-64. OK for trunk? then later back port to 4.6 after some proving time? Attached is updated patch based on comments from Thomas Henlich. See my comment #33 and subsequent comments in the PR48906 explaining the issue with test case fmt_g0_6.f08 which is revised by the updated patch. Regression tested on X86-64. OK for trunk. (please ;) ) Index: gcc/testsuite/gfortran.dg/char4_iunit_1.f03 === --- gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (revision 174673) +++ gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (working copy) @@ -24,7 +24,7 @@ program char4_iunit_1 write(string, *) .true., .false. , .true. if (string .ne. 4_ T F T) call abort write(string, *) 1.2345e-06, 4.2846e+10_8 - if (string .ne. 4_ 1.23450002E-06 4284600.00 ) call abort + if (string .ne. 4_ 1.234500019E-06 4284600.00 ) call abort write(string, *) nan, inf I don't agree with this; with the patch we now output 10 significant digits, whereas 9 is sufficient for a binary-ascii-binary roundtrip. So please retain the reduce d by one when E editing is used thing for list format and G0. This is just a side effect of using 1PGw.d format for list format and G0 in order to avoid duplicating code, but we don't need to follow this particular craziness that is due to how the scale factor is specified in the standard. Otherwise it looks nice. Good job! FWIW, as this is quite tricky code and not a regression, IMHO we should not backport it. -- Janne Blomqvist
Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
I don't agree with this; with the patch we now output 10 significant digits, whereas 9 is sufficient for a binary-ascii-binary roundtrip. So please retain the reduce d by one when E editing is used thing for list format and G0. This is just a side effect of using 1PGw.d format for list format and G0 in order to avoid duplicating code, but we don't need to follow this particular craziness that is due to how the scale factor is specified in the standard. I hadn't noticed this, but I agree with Janne. It should be easy to implement: After the switch between F and E editing, we just need to shift the decimal point and decrement the exponent. No new rounding is required, because we keep the number of significant digits.
Re: [patch, fortran] Some more TRIM optimizations
Hi Jerry, Ping ** 0.5714 Full patch can be found at http://gcc.gnu.org/ml/fortran/2011-06/msg00053.html OK and thanks for patch. Sendingfortran/ChangeLog Sendingfortran/frontend-passes.c Sendingtestsuite/ChangeLog Adding testsuite/gfortran.dg/trim_optimize_7.f90 Transmitting file data Committed revision 174944. Thanks for the review! Thomas
Re: [PATCH PR45098, 7/10] Nowrap limits iterations
Hi Zdenek, On 05/31/2011 10:04 AM, Zdenek Dvorak wrote: Hi, As far as I can tell, what is current calculated in i_bound (and assigned to nb_iterations_upper_bound), is the maximum amount of times any statement in the loop is executed, where any includes exit tests. Differently put, the maximum amount of times the loop header is executed. hmm... this is rather confusing, I don't really recall why I gave nb_iterations_upper_bound a different semantics from any other instance of what # of iterations of a loop means. This is confirmed by this comment in tree-vrp.c: /* Try to use estimated number of iterations for the loop to constrain the final value in the evolution. We are interested in the number of executions of the latch, while nb_iterations_upper_bound includes the last execution of the exit test. */ I modified the patch to improved the comment. I think a better fix would be to make the nb_iterations_upper_bound semantics consistent with that of nb_iterations. Let me try to do it, hopefully this should be mostly mechanical, This patch changes the semantics of nb_iterations_upper_bound and nb_iterations_estimate, to mean: the amount of latch executions. That change is countered at all use sites, except for tree-ssa-loop-ivopts.c:may_eliminate_iv. Passed x86_64 bootstrapping and reg-testing. OK for trunk? 2011-06-10 Zdenek Dvorak o...@ucw.cz Tom de Vries t...@codesourcery.com PR target/45098 * cfgloop.h (nb_iterations_upper_bound, nb_iterations_estimate): Document changed semantics. (max_stmt_executions, max_stmt_executions_int): Declare. * tree-data-ref.c (estimated_loop_iterations) (estimated_loop_iterations_int): Move functions... * tree-ssa-loop-niter.c (estimated_loop_iterations) (estimated_loop_iterations_int): here. (record_estimate): Change nb_iterations_upper_bound and nb_iterations_estimate semantics. (max_stmt_executions, max_stmt_executions_int): New function. * tree-data-ref.c (estimated_loop_iterations_tree): Rename to ... (max_stmt_executions_tree): this. (analyze_miv_subscript): Use max_stmt_executions_tree instead of estimated_loop_iterations_tree. tree-ssa-loop-ivopts.c (avg_loop_niter): Use max_stmt_executions_int instead of estimated_loop_iterations_int. * predict.c (predict_loops): Idem. * tree-parloops.c (parallelize_loops): Idem. * tree-data-ref.c (analyze_siv_subscript_cst_affine) (compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine) (init_omega_for_ddr_1): Idem. * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse) (loop_prefetch_arrays): Idem * graphite-sese-to-poly.c (build_loop_iteration_domains): Use max_stmt_executions instead of estimated_loop_iterations. * tree-data-ref.c (estimated_loop_iterations_tree): Idem. * tree-vrp.c (adjust_range_with_scev): Use estimated_loop_iterations instead of nb_iterations_upper_bound. Index: gcc/tree-vrp.c === --- gcc/tree-vrp.c (revision 174810) +++ gcc/tree-vrp.c (working copy) @@ -3403,44 +3403,42 @@ adjust_range_with_scev (value_range_t *v tmax = TYPE_MAX_VALUE (type); /* Try to use estimated number of iterations for the loop to constrain the - final value in the evolution. - We are interested in the number of executions of the latch, while - nb_iterations_upper_bound includes the last execution of the exit test. */ + final value in the evolution. */ if (TREE_CODE (step) == INTEGER_CST - loop-any_upper_bound - !double_int_zero_p (loop-nb_iterations_upper_bound) is_gimple_val (init) (TREE_CODE (init) != SSA_NAME || get_value_range (init)-type == VR_RANGE)) { - value_range_t maxvr = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }; - double_int dtmp; - bool unsigned_p = TYPE_UNSIGNED (TREE_TYPE (step)); - int overflow = 0; + double_int nit; - dtmp = double_int_mul_with_sign (tree_to_double_int (step), - double_int_sub ( - loop-nb_iterations_upper_bound, - double_int_one), - unsigned_p, overflow); - /* If the multiplication overflowed we can't do a meaningful - adjustment. Likewise if the result doesn't fit in the type - of the induction variable. For a signed type we have to - check whether the result has the expected signedness which - is that of the step as nb_iterations_upper_bound is unsigned. */ - if (!overflow - double_int_fits_to_tree_p (TREE_TYPE (init), dtmp) - (unsigned_p - || ((dtmp.high ^ TREE_INT_CST_HIGH (step)) = 0))) + if (estimated_loop_iterations (loop,
[Patch, libfortran] PR 49296 List read of file without EOR
Hi, attached patch fixes PR 49296. A new test for the testsuite is also included. Regtested on x86_64-unknown-linux-gnu, Ok for trunk? 2011-06-11 Janne Blomqvist j...@gcc.gnu.org PR libfortran/49296 * io/list_read.c (read_character): Accept EOF as a separator when reading string. -- Janne Blomqvist diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 38a92e1..baf2f54 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1022,7 +1022,7 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) for (;;) { if ((c = next_char (dtp)) == EOF) - goto eof; + goto done_eof; switch (c) { case '': @@ -1068,26 +1068,26 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) invalid. */ done: c = next_char (dtp); - eof: - if (is_separator (c) || c == '!') + done_eof: + if (is_separator (c) || c == '!' || c == EOF) { unget_char (dtp, c); eat_separator (dtp); dtp-u.p.saved_type = BT_CHARACTER; free_line (dtp); } - else + else { free_saved (dtp); - if (c == EOF) - { - hit_eof (dtp); - return; - } snprintf (message, MSGLEN, Invalid string input in item %d, dtp-u.p.item_count); generate_error (dtp-common, LIBERROR_READ_VALUE, message); } + return; + + eof: + free_saved (dtp); + hit_eof (dtp); } ! { dg-do run } ! PR 49296 List formatted read of file without EOR marker (\n). program read_list_eof_1 implicit none integer, parameter :: strmx = 255 character(len=strmx) :: s1, s2 call genfil () open (unit=20, file='read.dat', form='FORMATTED', action='READ', status='OLD') read (20, fmt=*) s1, s2 close (20, status='delete') if (trim(s1) /= abcd .or. trim(s2) /= efgh) then call abort () end if contains subroutine genfil open(10, file='read.dat', form='unformatted', action='write', status='replace', access='stream') write(10) 'abcd efgh' close(10) end subroutine genfil end program read_list_eof_1
[PATCH, i386]: Use default value in isa attribute.
Hello! base is the default value for isa attribute. Also, reimplement long lines with cond RTX. 2011-06-11 Uros Bizjak ubiz...@gmail.com * config/i386/i386.md: Use default value in isa attribute. * config/i386/sse.md: Ditto. * config/i386/mmx.md: Ditto. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: i386.md === --- i386.md (revision 174944) +++ i386.md (working copy) @@ -2151,7 +2151,7 @@ [(set (attr isa) (if_then_else (eq_attr alternative 9,10,11,12) (const_string noavx) - (const_string base))) + (const_string *))) (set (attr type) (cond [(eq_attr alternative 0,1) (const_string multi) @@ -12700,7 +12700,7 @@ (if_then_else (match_operand:MODEF 3 mult_operator ) (const_string fmul) (const_string fop - (set_attr isa base,noavx,avx) + (set_attr isa *,noavx,avx) (set_attr prefix orig,orig,vex) (set_attr mode MODE)]) @@ -12760,7 +12760,7 @@ (const_string fdiv) ] (const_string fop))) - (set_attr isa base,base,noavx,avx) + (set_attr isa *,*,noavx,avx) (set_attr prefix orig,orig,orig,vex) (set_attr mode MODE)]) Index: mmx.md === --- mmx.md (revision 174944) +++ mmx.md (working copy) @@ -85,7 +85,19 @@ %vmovq\t{%1, %0|%0, %1} %vmovd\t{%1, %0|%0, %1} %vmovd\t{%1, %0|%0, %1} - [(set_attr type imov,imov,mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,sselog1,ssemov,ssemov,ssemov,ssemov) + [(set (attr type) + (cond [(eq_attr alternative 0,1) + (const_string imov) + (eq_attr alternative 2) + (const_string mmx) + (eq_attr alternative 3,4,5) + (const_string mmxmov) + (eq_attr alternative 6,7) + (const_string ssecvt) + (eq_attr alternative 8) + (const_string sselog1) + ] + (const_string ssemov))) (set_attr unit *,*,*,*,*,*,mmx,mmx,*,*,*,*,*) (set_attr prefix_rep *,*,*,*,*,*,1,1,*,1,*,*,*) (set_attr prefix_data16 *,*,*,*,*,*,*,*,*,*,1,1,1) @@ -125,8 +137,20 @@ [(set (attr isa) (if_then_else (eq_attr alternative 9,10,11,12) (const_string noavx) - (const_string base))) - (set_attr type mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,sselog1,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov,*,*) + (const_string *))) + (set (attr type) + (cond [(eq_attr alternative 0) + (const_string mmx) + (eq_attr alternative 1,2,3) + (const_string mmxmov) + (eq_attr alternative 4,5) + (const_string ssecvt) + (eq_attr alternative 6,9) + (const_string sselog1) + (eq_attr alternative 13,14) + (const_string multi) + ] + (const_string ssemov))) (set_attr unit *,*,*,*,mmx,mmx,*,*,*,*,*,*,*,*,*) (set (attr prefix_rep) (if_then_else @@ -179,7 +203,19 @@ %vmovlps\t{%1, %0|%0, %1} %vmovd\t{%1, %0|%0, %1} %vmovd\t{%1, %0|%0, %1} - [(set_attr type imov,imov,mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,sselog1,ssemov,ssemov,ssemov,ssemov) + [(set (attr type) + (cond [(eq_attr alternative 0,1) + (const_string imov) + (eq_attr alternative 2) + (const_string mmx) + (eq_attr alternative 3,4,5) + (const_string mmxmov) + (eq_attr alternative 6,7) + (const_string ssecvt) + (eq_attr alternative 9) + (const_string sselog1) + ] + (const_string ssemov))) (set_attr unit *,*,*,*,*,*,mmx,mmx,*,*,*,*,*,*) (set_attr prefix_rep *,*,*,*,*,*,1,1,*,*,*,*,*,*) (set (attr length_vex) @@ -214,7 +250,19 @@ %vmovlps\t{%1, %0|%0, %1} # # - [(set_attr type mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,sselog1,ssemov,ssemov,ssemov,*,*) + [(set (attr type) + (cond [(eq_attr alternative 0) + (const_string mmx) + (eq_attr alternative 1,2,3) + (const_string mmxmov) + (eq_attr alternative 4,5) + (const_string ssecvt) + (eq_attr alternative 6) + (const_string sselog1) + (eq_attr alternative 10,11) + (const_string multi) + ] + (const_string ssemov))) (set_attr unit *,*,*,*,mmx,mmx,*,*,*,*,*,*) (set_attr prefix_rep *,*,*,*,1,1,*,*,*,*,*,*) (set (attr prefix) @@ -228,8 +276,8 @@ [(set (match_operand:MMXMODE 0 nonimmediate_operand ) (match_operand:MMXMODE 1 general_operand ))] !TARGET_64BIT reload_completed -(!MMX_REG_P (operands[0]) !SSE_REG_P (operands[0])) -(!MMX_REG_P (operands[1]) !SSE_REG_P (operands[1])) +!(MMX_REG_P (operands[0]) || SSE_REG_P (operands[0]) + || MMX_REG_P (operands[1]) || SSE_REG_P
[Patch, libfortran, committed] Use lseek() to figure out if a file is seekable
Hi, currently we try to figure out whether a fd is seekable by looking at the mode returned by fstat(). Turns out this is not enough, as there are some character special files that are seekable. Thus, change the logic to try an lseek(). Committed as obvious. Index: ChangeLog === --- ChangeLog (revision 174945) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-06-11 Janne Blomqvist j...@gcc.gnu.org + + * io/unix.c (fd_to_stream): Figure out if a fd is seekable by + trying lseek(). + 2011-06-10 Daniel Carrera dcarr...@gmail.com * caf/mpi.c (_gfortran_caf_sync_all, Index: io/unix.c === --- io/unix.c (revision 174945) +++ io/unix.c (working copy) @@ -952,15 +952,15 @@ fd_to_stream (int fd) if (S_ISREG (statbuf.st_mode)) s-file_length = statbuf.st_size; - else if (S_ISBLK (statbuf.st_mode)) + else { - /* Hopefully more portable than ioctl(fd, BLKGETSIZE64, size)? */ - gfc_offset cur = lseek (fd, 0, SEEK_CUR); + /* Some character special files are seekable but most are not, +so figure it out by trying to seek. On Linux, /dev/null is +an example of such a special file. */ s-file_length = lseek (fd, 0, SEEK_END); - lseek (fd, cur, SEEK_SET); + if (s-file_length 0) + lseek (fd, 0, SEEK_SET); } - else -s-file_length = -1; if (!(S_ISREG (statbuf.st_mode) || S_ISBLK (statbuf.st_mode)) || options.all_unbuffered -- Janne Blomqvist
[PATCH, i386]: Fix mode of forced register in vec_dupv4sf
Hello! 2011-06-11 Uros Bizjak ubiz...@gmail.com * config/i386/sse.md (vec_dupv4sf): Correct mode of forced register. (*vec_dupv2df): Rename from vec_dupv2df. (vec_dupv2df): New expander. Tested on x86_64-pc-linux-gnu {,-m32}. Committed to mainline SVN, will also be committed to 4.5 and 4.6 branch. Uros. Index: sse.md === --- sse.md (revision 174946) +++ sse.md (working copy) @@ -3816,7 +3816,7 @@ TARGET_SSE { if (!TARGET_AVX) -operands[1] = force_reg (V4SFmode, operands[1]); +operands[1] = force_reg (SFmode, operands[1]); }) (define_insn *vec_dupv4sf_avx @@ -5117,6 +5117,16 @@ (set_attr length_immediate *,*,*,1,*,*) (set_attr mode DF,V1DF,V1DF,V2DF,V1DF,V1DF)]) +(define_expand vec_dupv4sf + [(set (match_operand:V2DF 0 register_operand ) + (vec_duplicate:V2DF + (match_operand:DF 1 nonimmediate_operand )))] + TARGET_SSE2 +{ + if (!TARGET_SSE3) +operands[1] = force_reg (DFmode, operands[1]); +}) + (define_insn *vec_dupv2df_sse3 [(set (match_operand:V2DF 0 register_operand =x) (vec_duplicate:V2DF @@ -5127,7 +5137,7 @@ (set_attr prefix maybe_vex) (set_attr mode DF)]) -(define_insn vec_dupv2df +(define_insn *vec_dupv2df [(set (match_operand:V2DF 0 register_operand =x) (vec_duplicate:V2DF (match_operand:DF 1 register_operand 0)))]
[v3] test uses_allocator for promise and packaged_task
2011-06-11 Jonathan Wakely jwakely@gmail.com * testsuite/30_threads/packaged_task/uses_allocator.cc: New. * testsuite/30_threads/promise/uses_allocator.cc: Likewise. A couple of new tests to verify that uses_allocator is specialized for promise and packaged_task. Tested x86_84-linux and committed to trunk. Index: testsuite/30_threads/packaged_task/uses_allocator.cc === --- testsuite/30_threads/packaged_task/uses_allocator.cc(revision 0) +++ testsuite/30_threads/packaged_task/uses_allocator.cc(revision 0) @@ -0,0 +1,32 @@ +// { dg-do compile } +// { dg-options -std=gnu++0x } +// { dg-require-cstdint } +// { dg-require-gthreads } +// { dg-require-atomic-builtins } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + + +#include future +#include memory + +using std::uses_allocator; +using std::allocator; +using std::packaged_task; +static_assert( uses_allocatorpackaged_taskint(), allocatorint::value, + packaged_task supports uses-allocator construction ); Index: testsuite/30_threads/promise/uses_allocator.cc === --- testsuite/30_threads/promise/uses_allocator.cc (revision 0) +++ testsuite/30_threads/promise/uses_allocator.cc (revision 0) @@ -0,0 +1,32 @@ +// { dg-do compile } +// { dg-options -std=gnu++0x } +// { dg-require-cstdint } +// { dg-require-gthreads } +// { dg-require-atomic-builtins } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + + +#include future +#include memory + +using std::uses_allocator; +using std::allocator; +using std::promise; +static_assert( uses_allocatorpromiseint, allocatorint::value, + promise supports uses-allocator construction );
Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
On 06/11/2011 12:23 AM, Thomas Henlich wrote: I don't agree with this; with the patch we now output 10 significant digits, whereas 9 is sufficient for a binary-ascii-binary roundtrip. So please retain the reduce d by one when E editing is used thing for list format and G0. This is just a side effect of using 1PGw.d format for list format and G0 in order to avoid duplicating code, but we don't need to follow this particular craziness that is due to how the scale factor is specified in the standard. I hadn't noticed this, but I agree with Janne. It should be easy to implement: After the switch between F and E editing, we just need to shift the decimal point and decrement the exponent. No new rounding is required, because we keep the number of significant digits. Our default formats for kind=4 are: static void set_fnode_default (st_parameter_dt *dtp, fnode *f, int length) { f-format = FMT_G; switch (length) { case 4: f-u.real.w = 16; f-u.real.d = 9; f-u.real.e = 2; break; This was established as solution to PR48488 where we had two choices for selecting the significant digits. Nine significant digits was established as a requirement to guarantee round trip in all cases. The char4_iunit_1.f03 test case was revised because after we corrected the formatting in PR48906, it started to fail and I observed the test case was looking for the wrong number of significant digits. Based on this, I would suggest we leave it as I have it, which is correct. Jerry
Cgraph alias reorg 16/14 (fix latent bug in ipa.c)
Hi, there is typo in cgraph_comdat_can_be_unshared_p that causes us to sometimes diverge in visibility of the single comdat group that leads to undefined symbols in Mozlla. Fixed thus. Bootstrapped/regtested x86_64-linux, comitted. Index: ChangeLog === --- ChangeLog (revision 174952) +++ ChangeLog (working copy) @@ -1,5 +1,9 @@ 2011-06-11 Jan Hubicka j...@suse.cz + * ipa.c (cgraph_comdat_can_be_unshared_p): Fix pasto. + +2011-06-11 Jan Hubicka j...@suse.cz + * lto-symtab.c (lto_cgraph_replace_node): Kill same body alias code. (lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_merge_cgraph_nodes): Update merging of aliases. Index: ipa.c === --- ipa.c (revision 174952) +++ ipa.c (working copy) @@ -571,7 +571,7 @@ cgraph_comdat_can_be_unshared_p (struct address taken. */ for (next = node-same_comdat_group; next != node; next = next-same_comdat_group) - if (cgraph_address_taken_from_non_vtable_p (node) + if (cgraph_address_taken_from_non_vtable_p (next) !DECL_VIRTUAL_P (next-decl)) return false; }
Cgraph alias reorg 17/14 (fix ipa-prop computation of varying args)
Hi, while breaking up the patch Imissed two pots in ipa-prop, where we need to walk aliases. This leads to segfault while compiling Mozilla. Also because alled_with_var_arguments is recomputed at IPA time, we don't need to stream it. Bootstrapped/regtested x86_64-linux, comitted. Honza Index: ChangeLog === --- ChangeLog (revision 174954) +++ ChangeLog (working copy) @@ -1,5 +1,12 @@ 2011-06-11 Jan Hubicka j...@suse.cz + * ipa-prop.c (ipa_make_edge_direct_to_target): Fix code setting varying args. + (ipa_update_after_lto_read): Likewise. + (ipa_write_node_info): Do not sream call_with_var_arguments. + (ipa_read_node_info): Likewise. + +2011-06-11 Jan Hubicka j...@suse.cz + * ipa.c (cgraph_comdat_can_be_unshared_p): Fix pasto. 2011-06-11 Jan Hubicka j...@suse.cz Index: ipa-prop.c === --- ipa-prop.c (revision 174951) +++ ipa-prop.c (working copy) @@ -1719,6 +1719,7 @@ ipa_make_edge_direct_to_target (struct c fprintf (dump_file, \n); } } + callee = cgraph_function_or_thunk_node (callee, NULL); if (ipa_get_cs_argument_count (IPA_EDGE_REF (ie)) != ipa_get_param_count (IPA_NODE_REF (callee))) @@ -2815,7 +2816,6 @@ ipa_write_node_info (struct output_block lto_output_uleb128_stream (ob-main_stream, node_ref); bp = bitpack_create (ob-main_stream); - bp_pack_value (bp, info-called_with_var_arguments, 1); gcc_assert (info-uses_analysis_done || ipa_get_param_count (info) == 0); gcc_assert (!info-node_enqueued); @@ -2858,7 +2858,6 @@ ipa_read_node_info (struct lto_input_blo ipa_initialize_node_params (node); bp = lto_input_bitpack (ib); - info-called_with_var_arguments = bp_unpack_value (bp, 1); if (ipa_get_param_count (info) != 0) info-uses_analysis_done = true; info-node_enqueued = false; @@ -3015,9 +3014,12 @@ ipa_update_after_lto_read (void) if (node-analyzed) for (cs = node-callees; cs; cs = cs-next_callee) { + struct cgraph_node *callee; + + callee = cgraph_function_or_thunk_node (cs-callee, NULL); if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs)) - != ipa_get_param_count (IPA_NODE_REF (cs-callee))) - ipa_set_called_with_variable_arg (IPA_NODE_REF (cs-callee)); + != ipa_get_param_count (IPA_NODE_REF (callee))) + ipa_set_called_with_variable_arg (IPA_NODE_REF (callee)); } }
[v3] adjust allocator_traits testcase
2011-06-11 Jonathan Wakely jwakely@gmail.com * testsuite/20_util/allocator_traits/requirements/typedefs.cc: Check for allocator_type and value_type. Tested x86_64-linux, committed to trunk. Index: testsuite/20_util/allocator_traits/requirements/typedefs.cc === --- testsuite/20_util/allocator_traits/requirements/typedefs.cc (revision 174931) +++ testsuite/20_util/allocator_traits/requirements/typedefs.cc (working copy) @@ -29,6 +29,8 @@ void test01() { // Check for required typedefs typedef std::allocator_traitsT test_type; + typedef typename test_type::allocator_typeallocator_type; + typedef typename test_type::value_typevalue_type; typedef typename test_type::pointer pointer; typedef typename test_type::const_pointer const_pointer; typedef typename test_type::void_pointer void_pointer;
PATCH [0/n]: Prepare middle-end for x32 branch merge
Hi, I am submitting a series of middle-end patches to prepare for x32 branch merge. GCC has a very good support for Pmode != ptr_mode. However x32 branch exposes some corner cases where GCC generates x86 specific optimizations, like strlen expansion. Those patches are needed for x32 support. H.J.
PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355
Hi, expand_builtin_strlen has src_reg = gen_reg_rtx (Pmode); ... pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); if (pat != src_reg) emit_move_insn (src_reg, pat); But src_reg may be in ptr_mode, wich may not be the same as Pmode. This patch checks it. OK for trunk? Thanks. H.J. --- 2011-06-11 H.J. Lu hongjiu...@intel.com PR middle-end/47364 * builtins.c (expand_builtin_strlen): Properly handle target not in Pmode. diff --git a/gcc/builtins.c b/gcc/builtins.c index 7b24a0c..4e2cf31 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2941,7 +2941,11 @@ expand_builtin_strlen (tree exp, rtx target, start_sequence (); pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); if (pat != src_reg) - emit_move_insn (src_reg, pat); + { + if (GET_MODE (pat) != Pmode) + pat = convert_to_mode (Pmode, pat, 1); + emit_move_insn (src_reg, pat); + } pat = get_insns (); end_sequence ();
Cgraph alias reorg 18/14 (fix LTO symtab streaming)
Hi, another hunk that got lost. We need to stream aliases into the symbol table. For some reason this cuase very little trouble... Bootstrapped/regtested x86_64-linux. Comitted. Honza Index: ChangeLog === --- ChangeLog (revision 174955) +++ ChangeLog (working copy) @@ -1,5 +1,10 @@ 2011-06-11 Jan Hubicka j...@suse.cz + * lto-streamer-out.c (produce_symtab): Stream out the newly represented + aliases. + +2011-06-11 Jan Hubicka j...@suse.cz + * ipa-prop.c (ipa_make_edge_direct_to_target): Fix code setting varying args. (ipa_update_after_lto_read): Likewise. (ipa_write_node_info): Do not sream call_with_var_arguments. Index: lto-streamer-out.c === --- lto-streamer-out.c (revision 174952) +++ lto-streamer-out.c (working copy) @@ -2582,7 +2582,7 @@ produce_symtab (struct output_block *ob, if (DECL_COMDAT (node-decl) cgraph_comdat_can_be_unshared_p (node)) continue; - if (node-alias || node-global.inlined_to) + if ((node-alias !node-thunk.alias) || node-global.inlined_to) continue; write_symbol (cache, stream, node-decl, seen, false); } @@ -2594,7 +2594,7 @@ produce_symtab (struct output_block *ob, if (DECL_COMDAT (node-decl) cgraph_comdat_can_be_unshared_p (node)) continue; - if (node-alias || node-global.inlined_to) + if ((node-alias !node-thunk.alias) || node-global.inlined_to) continue; write_symbol (cache, stream, node-decl, seen, false); }
[v3] improve allocator_traits test
2011-06-11 Jonathan Wakely jwakely@gmail.com * testsuite/20_util/allocator_traits/requirements/ explicit_instantiation.cc: Add another instantiation. Tested x86_64-linux, committed to trunk. Index: testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc === --- testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc (revision 174931) +++ testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc (working copy) @@ -22,8 +22,21 @@ #include memory +typedef short test_type; + +templatetypename T + struct minimal_allocator + { +typedef T value_type; +minimal_allocator(); +template typename U + minimal_allocator(const minimal_allocatorU); +T* allocate(std::size_t); +void deallocate(T*, std::size_t); + }; + namespace std { - typedef short test_type; template struct allocator_traitsstd::allocatortest_type; + template struct allocator_traitsminimal_allocatortest_type; }
RFC: __gnu_cxx::__alloc_traits extension
Here's the next piece of my ongoing allocator work, which I think is ready to check in. I've moved allocator_traits to a separate header, so it can be used without including the definition of std::allocator, so this means we'll have: bits/uses_allocator.h: std::allocator_arg, std::uses_allocator bits/alloc_traits.h: std::allocator_traits bits/allocator.h: std::allocator These are all independent and sometimes useful in isolation (e.g. tuple only needs the first two, containers only need the last two) so I think it's good to have separate headers not a single big one. This patch also adds ext/alloc_traits.h which defines a new extension, __gnu_cxx::__alloc_traits, which provides a subset of the allocator_traits API in both C++98 and C++0x mode. The rest of the library can use __alloc_traits::construct(a, p, x) and have that call a.construct(p, x) for C++98 or allocator_traits::construct(a, p, x) in C++0x. The patch modifies stl_construct.h and stl_uninitialized.h to use that new utility, demonstrating that it makes supporting the C++0x allocator model easier. Fellow maintainers, do you think this is worth declaring in its own header as an extension which users can use, or should it just be an internal implementation detail, defined in bits/alloc_traits.h and not meant for users? This passes the testsuite in both c++98 and c++0x modes, so I'd like to commit it soon unless I hear objections to ext/alloc_traits.h 2011-06-11 Jonathan Wakely jwakely@gmail.com * include/Makefile.am: Add alloc_traits.h headers. * include/Makefile.in: Regenerate. * include/std/memory: Include uses_allocator.h explicitly. * include/bits/allocator.h (allocator_traits): Move to ... * include/bits/alloc_traits.h: New header. * include/ext/alloc_traits.h (__alloc_traits): Extension to provide a common allocator interface for C++98 and C++0x. * include/bits/stl_construct.h: Use __alloc_traits. * include/bits/stl_uninitialized.h: Likewise. Index: include/Makefile.am === --- include/Makefile.am (revision 174931) +++ include/Makefile.am (working copy) @@ -79,6 +80,7 @@ bits_srcdir = ${glibcxx_srcdir}/include/ bits_builddir = ./bits bits_headers = \ ${bits_srcdir}/algorithmfwd.h \ + ${bits_srcdir}/alloc_traits.h \ ${bits_srcdir}/allocator.h \ ${bits_srcdir}/atomic_base.h \ ${bits_srcdir}/atomic_0.h \ @@ -493,6 +495,7 @@ ext_srcdir = ${glibcxx_srcdir}/include/e ext_builddir = ./ext ext_headers = \ ${ext_srcdir}/algorithm \ + ${ext_srcdir}/alloc_traits.h \ ${ext_srcdir}/atomicity.h \ ${ext_srcdir}/array_allocator.h \ ${ext_srcdir}/bitmap_allocator.h \ Index: include/std/memory === --- include/std/memory (revision 174931) +++ include/std/memory (working copy) @@ -76,6 +76,7 @@ # include ext/concurrence.h # include bits/functexcept.h # include bits/stl_function.h // std::less +# include bits/uses_allocator.h # include type_traits # include functional # include debug/debug.h Index: include/bits/allocator.h === --- include/bits/allocator.h(revision 174931) +++ include/bits/allocator.h(working copy) @@ -47,12 +47,6 @@ // Define the base class to std::allocator. #include bits/c++allocator.h -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -#include bits/ptr_traits.h -#include bits/uses_allocator.h -#include ext/numeric_traits.h -#endif - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -62,6 +56,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @ingroup memory * * Classes encapsulating memory operations. + * + * @{ */ templatetypename _Tp @@ -85,7 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief The @a standard allocator, as per [20.4]. - * @ingroup allocators * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html * for further details. @@ -139,6 +134,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator!=(const allocator_Tp, const allocator_Tp) { return false; } + /** + * @} + */ + // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE @@ -197,404 +196,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return false; } } - templatetypename _Alloc, typename _Tp -class __alloctr_rebind_helper -{ - templatetypename _Alloc2, typename _Tp2 - static constexpr bool - _S_chk(typename _Alloc2::template rebind_Tp2::other*) - { return true; } - - templatetypename, typename -static constexpr bool - _S_chk(...) - { return false; } - -public: - static const bool __value =
PATCH [2/n]: Prepare x32: Convert pointer to TLS symbol if needed
Hi, Backend may promote pointers to Pmode. Before we force a TLS symbol to a pseudo, we may need to convert it to proper mode. OK for trunk? Thanks. H.J. 2011-06-11 H.J. Lu hongjiu...@intel.com * calls.c (precompute_register_parameters): Convert pointer to TLS symbol if needed. diff --git a/gcc/calls.c b/gcc/calls.c index feb98d2..de98267 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -706,7 +706,13 @@ precompute_register_parameters (int num_actuals, struct arg_data *args, pseudo now. TLS symbols sometimes need a call to resolve. */ if (CONSTANT_P (args[i].value) !targetm.legitimate_constant_p (args[i].mode, args[i].value)) - args[i].value = force_reg (args[i].mode, args[i].value); + { + if (GET_MODE (args[i].value) != args[i].mode) + args[i].value = convert_to_mode (args[i].mode, + args[i].value, + args[i].unsignedp); + args[i].value = force_reg (args[i].mode, args[i].value); + } /* If we are to promote the function arg to a wider mode, do it now. */
PATCH [3/n]: Prepare x32: PR rtl-optimization/49088: Combine fails to properly handle zero-extension and signed int constant
See: http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02150.html for an analysis. OK for trunk? Thanks. H.J. --- 2011-05-21 H.J. Lu hongjiu...@intel.com PR rtl-optimization/49088 * combine.c (force_to_mode): If X is narrower than MODE and we want all the bits in X's mode, just use the operand when it is CONST_INT. diff --git a/gcc/combine.c b/gcc/combine.c index 8af86f2..710fe0e 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8321,8 +8321,26 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, /* For most binary operations, just propagate into the operation and change the mode if we have an operation of that mode. */ - op0 = force_to_mode (XEXP (x, 0), mode, mask, next_select); - op1 = force_to_mode (XEXP (x, 1), mode, mask, next_select); + /* If X is narrower than MODE and we want all the bits in X's +mode, just use the operand when it is CONST_INT. */ + if (SCALAR_INT_MODE_P (mode) + GET_MODE_SIZE (GET_MODE (x)) GET_MODE_SIZE (mode) + (GET_MODE_MASK (GET_MODE (x)) ~mask) == 0) + { + if (CONST_INT_P (XEXP (x, 0))) + op0 = XEXP (x, 0); + else + op0 = force_to_mode (XEXP (x, 0), mode, mask, next_select); + if (CONST_INT_P (XEXP (x, 1))) + op1 = XEXP (x, 1); + else + op1 = force_to_mode (XEXP (x, 1), mode, mask, next_select); + } + else + { + op0 = force_to_mode (XEXP (x, 0), mode, mask, next_select); + op1 = force_to_mode (XEXP (x, 1), mode, mask, next_select); + } /* If we ended up truncating both operands, truncate the result of the operation instead. */
Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
On Sat, Jun 11, 2011 at 14:41, jerry DeLisle jvdeli...@charter.net wrote: This was established as solution to PR48488 where we had two choices for selecting the significant digits. Nine significant digits was established as a requirement to guarantee round trip in all cases. The char4_iunit_1.f03 test case was revised because after we corrected the formatting in PR48906, it started to fail and I observed the test case was looking for the wrong number of significant digits. Based on this, I would suggest we leave it as I have it, which is correct. I'm afraid it's not. 1.23450002E-06 has nine significant digits. That's how it should be. We don't want 1PG16.9E2 editing for list-directed and G0, but G16.9E2 for the F editing range and 1PE16.8E2 editing for the E range. This is to make sure the result always has nine significant digits, whether in the F or E range.
PATCH [4/n]: Prepare x32: Permute the conversion and addition if one operand is a constant
Hi, convert_memory_address_addr_space has a special PLUS/MULT case for POINTERS_EXTEND_UNSIGNED 0. It turns out that it is also needed for all Pmode != ptr_mode cases. OK for trunk? Thanks. H.J. --- 2011-06-11 H.J. Lu hongjiu...@intel.com PR middle-end/47727 * explow.c (convert_memory_address_addr_space): Permute the conversion and addition if one operand is a constant. diff --git a/gcc/explow.c b/gcc/explow.c index 7387dad..b343bf8 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -383,18 +383,13 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED, case PLUS: case MULT: - /* For addition we can safely permute the conversion and addition -operation if one operand is a constant and converting the constant -does not change it or if one operand is a constant and we are -using a ptr_extend instruction (POINTERS_EXTEND_UNSIGNED 0). -We can always safely permute them if we are making the address -narrower. */ + /* For addition we safely permute the conversion and addition +operation if one operand is a constant since we can't generate +new instructions. We can always safely permute them if we are +making the address narrower. */ if (GET_MODE_SIZE (to_mode) GET_MODE_SIZE (from_mode) || (GET_CODE (x) == PLUS - CONST_INT_P (XEXP (x, 1)) - (XEXP (x, 1) == convert_memory_address_addr_space - (to_mode, XEXP (x, 1), as) - || POINTERS_EXTEND_UNSIGNED 0))) + CONST_INT_P (XEXP (x, 1 return gen_rtx_fmt_ee (GET_CODE (x), to_mode, convert_memory_address_addr_space (to_mode, XEXP (x, 0), as),
Re: _ExtPtr_allocator
On 10 June 2011 22:06, Jonathan Wakely wrote: * overload construct and destroy so both the old- and new-style signatures are present. templatetypename... _Args void construct(pointer __p, _Args... __args) { construct(__p.get(), std::forward_Args(__args)...); } void destroy(pointer __p) { destroy(__p.get()); } Here's a patch implementing this option along with some tests to use the ExtPtr_allocator in C++0x mode Those tests fail without the patch so I'm committing this so that ExtPtr_allocator isn't completely broken in C++0x mode. 2011-06-11 Jonathan Wakely jwakely@gmail.com * include/ext/extptr_allocator.h (construct, destroy): Fix for C++0x mode by overloading to take allocator's pointer type. * testsuite/23_containers/vector/ext_pointer/types/2.cc: New. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 2.cc: New. Tested x86_64-linux, committed to trunk. Index: include/ext/extptr_allocator.h === --- include/ext/extptr_allocator.h (revision 174931) +++ include/ext/extptr_allocator.h (working copy) @@ -107,10 +107,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION construct(_Up* __p, _Args... __args) { ::new((void *)__p) _Up(std::forward_Args(__args)...); } + templatetypename... _Args +void +construct(pointer __p, _Args... __args) + { construct(__p.get(), std::forward_Args(__args)...); } + templatetypename _Up void destroy(_Up* __p) { __p-~_Up(); } + + void destroy(pointer __p) + { destroy(__p.get()); } + #else void construct(pointer __p, const _Tp __val) Index: testsuite/23_containers/vector/ext_pointer/types/2.cc === --- testsuite/23_containers/vector/ext_pointer/types/2.cc (revision 0) +++ testsuite/23_containers/vector/ext_pointer/types/2.cc (revision 0) @@ -0,0 +1,63 @@ +// Test for Container using non-standard pointer types. + +// Copyright (C) 2011 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + + +// { dg-options -std=gnu++0x } + +// This is a copy of vector/types/1.cc with altered allocator. +// The operator+()s in this test initially failed the test - +// they stress the accurate recognition, by the compiler, +// of _Pointer_adapter's own pointer arithmetic functions, +// which have to match perfectly on the int type to get +// chosen by the compiler when it sees: _Pointer_adapterT + int, etc. + +#include vector +#include ext/extptr_allocator.h + +namespace N +{ + struct X { }; + + templatetypename T +X operator+(T, std::size_t) +{ return X(); } + + templatetypename T +X operator-(T, T) +{ return X(); } +} + +int main() +{ + std::vectorN::X, __gnu_cxx::_ExtPtr_allocatorN::X v(5); + const std::vectorN::X, __gnu_cxx::_ExtPtr_allocatorN::X w(1); + + v[0]; + w[0]; + v.size(); + v.capacity(); + v.resize(1); + v.insert(v.begin(), N::X()); + v.insert(v.begin(), 1, N::X()); + v.insert(v.begin(), w.begin(), w.end()); + v = w; + + return 0; +} Index: testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc === --- testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc (revision 0) +++ testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc (revision 0) @@ -0,0 +1,28 @@ +// Test for Container using non-standard pointer types. + +// Copyright (C) 2011 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this
PATCH [5/n]: Prepare x32: PR middle-end/48016: Inconsistency in non-local goto save area
Hi, We are very inconsistent when saving and restoring non-local goto save area. See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48016 for detailed analysis. OK for trunk? Thanks. H.J. --- 2011-06-07 H.J. Lu hongjiu...@intel.com PR middle-end/48016 * explow.c (emit_stack_save): Adjust mode of stack save area. * function.c (expand_function_start): Properly store frame pointer for non-local goto. diff --git a/gcc/explow.c b/gcc/explow.c index 7387dad..b343bf8 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -1035,6 +1030,14 @@ emit_stack_save (enum save_level save_level, rtx *psave) do_pending_stack_adjust (); if (sa != 0) sa = validize_mem (sa); + /* FIXME: update_nonlocal_goto_save_area may pass SA in the wrong mode. */ + if (GET_MODE (sa) != mode) +{ + gcc_assert (ptr_mode != Pmode + GET_MODE (sa) == ptr_mode + mode == Pmode); + sa = adjust_address (sa, mode, 0); +} emit_insn (fcn (sa, stack_pointer_rtx)); } diff --git a/gcc/function.c b/gcc/function.c index 30cc9ff..47fd5b7 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4779,7 +4779,7 @@ expand_function_start (tree subr) cfun-nonlocal_goto_save_area, integer_zero_node, NULL_TREE, NULL_TREE); r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE); - r_save = convert_memory_address (Pmode, r_save); + r_save = adjust_address (r_save, Pmode, 0); emit_move_insn (r_save, targetm.builtin_setjmp_frame_value ()); update_nonlocal_goto_save_area ();
Re: Cgraph alias reorg 15/14 (New infrastructure for same body aliases)
On Sat, Jun 11, 2011 at 5:55 AM, Jan Hubicka hubi...@ucw.cz wrote: Hi, this patch complettes the same body alias rework by removing the old same body alias code and adding new representation. Same body aliases are now separate function nodes that have IPA_REF_ALIAS reference to the node they are alias of. I am still getting one failure: FAIL: g++.dg/torture/pr43879-1_1.C It tests IPA PTA in presence of same body aliases. I honestly have no idea what is wrong there. I decided to go ahead with the patch anyway, given the current state of affair of aliases and IPA-PTA. Hope Richard will help me fixing this on Monday. The major pain with this change is that C++ FE gets same body aliases wrong. It creates them with random visibilities that are not final ones, it also creates them late in game via DECL_ASSEMBLER_NAME langhook, it forgets to set them same_comdat_group links and it do not set DECLARED_INLINE and DISREGARD_INLINE_LIMITS flags. I fix that up at cgraphunit side for now, but it would be cool to resolve those problems. I will followup with two extra fixes needed to fully build Mozilla with LTO again. Once things settle down, I will switch real aliases to the new infrastructure, too. Bootstrapped/regtested x86_64-linux, will commit it today. * lto-symtab.c (lto_cgraph_replace_node): Kill same body alias code. (lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_merge_cgraph_nodes): Update merging of aliases. * cgraph.c (same_body_aliases_done): New global var. (cgraph_same_body_alias_1): Rename to ... (cgraph_create_function_alias): ... this one; reorg to new representation. (cgraph_same_body_alias): Use cgraph_create_function_alias; record references when asked to. (cgraph_add_thunk): Fix formating. (cgraph_get_node): Kill same body alias code. (cgraph_node_for_asm): Likewise. (cgraph_remove_same_body_alias): Remove. (cgraph_remove_node): Kill same body alias code. (cgraph_mark_address_taken_node): Mark also the aliased function as having address taken. (dump_cgraph_node): Dump same body aliases. (cgraph_for_node_thunks_and_aliases): Update for new alias representation. (cgraph_for_node_and_aliases): Likewise. * cgraph.h (same_body): Kll pointer. (same_body_alias): Update comment. (same_body_aliases_done): Declare. (cgraph_remove_same_body_alias): Remove declaration. (cgraph_create_function_alias): Declare. (cgraph_process_same_body_aliases): Declare. (cgraph_function_with_gimple_body_p): Check for alias. (cgraph_can_remove_if_no_direct_calls_p): Look for aliases. (cgraph_alias_aliased_node): New function. (cgraph_function_node): Update for new aliases. (cgraph_function_or_thunk_node): Likewise. * ipa-inline-transform.c (can_remove_node_now_p): Look for aliases. (inline_call): Remove dead aliases. * cgraphunit.c (cgraph_decide_is_function_needed): Disable assembler name hack for same body aliases. (clone_of_p): Look through aliases. (verify_cgraph_node): Verify aliases. (cgraph_analyze_function): Analyze aliases; fixup C++ bugs. (cgraph_process_same_body_aliases): New function. (process_function_and_variable_attributes): Disable weakref warning on alias. (cgraph_analyze_functions): Handle aliases. (cgraph_mark_functions_to_output): Handle aliases same way as thunks. (assemble_thunks): Rename to ... (assemble_thunks_and_aliases): ... this one; handle aliases, too. (cgraph_expand_function): Remove alias output code. (cgraph_output_in_order): Skip aliases. (cgraph_preserve_function_body_p): Aliases don't need preserving. * ipa-ref.c (ipa_ref_use_name): Add alias reference. (ipa_record_reference): Do not assert on alias references. (ipa_ref_has_aliases_p): New function. * ipa-ref.h (enum ipa_ref_use): Add IPA_REF_ALIAS. (ipa_ref_has_aliases_p): Declare. * lto-cgraph.c (lto_output_node): Handle aliases. (input_node): Likewise. * lto-streamer-out.c (lto_output): Skip aliases. (produce_symtab): Kill same_body_alias code. * ipa-utils.c (ipa_reverse_postorder): Add FIXME. (ipa_reverse_postorder): Use cgraph_only_called_directly_or_aliased_p. * ipa-inline.c (update_caller_keys): Walk aliases. (inline_small_functions): Fix thinko in previous patch. * ipa.c (cgraph_externally_visible_p): Do not walk aliases. (function_and_variable_visibility): Do not walk same body aliases. * tree-ssa-structalias.c (associate_varinfo_to_alias): New function. (ipa_pta_execute): Use it. * lto.c (add_cgraph_node_to_partition_1): Break out from ...
Re: [PATCH, i386]: Fix mode of forced register in vec_dupv4sf
On Sat, Jun 11, 2011 at 4:16 AM, Uros Bizjak ubiz...@gmail.com wrote: Hello! 2011-06-11 Uros Bizjak ubiz...@gmail.com * config/i386/sse.md (vec_dupv4sf): Correct mode of forced register. (*vec_dupv2df): Rename from vec_dupv2df. (vec_dupv2df): New expander. Tested on x86_64-pc-linux-gnu {,-m32}. Committed to mainline SVN, will also be committed to 4.5 and 4.6 branch. This may have caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49374 -- H.J.
Re: [patch, testsuite] Fix g++.dg/opt/devirt2.C scanning, PR 48727
On Jun 10, 2011, at 9:28 AM, Steve Ellcey wrote: I will check in this testsuite fix as obvious if there are no objections. Thanks for the comments. When doing a port, having a comment on other port's issues with a testcase, is useful, as you get to say, gosh, I'm in that class too, and just blindly follow the same path for the same reason.
Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))
On Jun 10, 2011, at 7:20 AM, Richard Guenther wrote: On Fri, 10 Jun 2011, Jason Merrill wrote: On 06/10/2011 10:03 AM, Richard Guenther wrote: *((volatile int *)a[0] + 1) It would be correct to fold it to VIEW_CONVERT_EXPRvolatile int,a[1] No, it wouldn't be correct. It isn't correct to fold it to an array-ref that isn't volatile. Hmm? The C expression produces a volatile int lvalue referring to the second element of a, as does the VIEW_CONVERT_EXPR. They seem equivalent to me. no, a VIEW_CONVERT_EXPR is generally not an lvalue (fold for example would turn the above to (volatile int) a[1]). Curious. We have built up a built-in infrastructure that allows for lvalue register references. I noticed that for vector types, vectors with different type names but the same in every other respect come out different, and a VIEW_CONVERT_EXPR is placed on it to get the types to match. Presently I'm treating VIEW_CONVERT_EXPR as an lvalue. For me not to, I'd need either for the same type to be used, or, for another conversion node to be used that can preserve the lvalueness of registers. Now, if people want to know why, lvalue for registers, it is to support in/out and output only parameters to built-ins. Thoughts?
Re: [google] Enhance Annotalysis to support cloned functions/methods (issue4591066)
OK with some minor nits. Diego. http://codereview.appspot.com/4591066/diff/3001/gcc/tree-threadsafe-analyze.c File gcc/tree-threadsafe-analyze.c (right): http://codereview.appspot.com/4591066/diff/3001/gcc/tree-threadsafe-analyze.c#newcode1159 gcc/tree-threadsafe-analyze.c:1159: gcc_assert (false); + else + gcc_assert (false); + Change to gcc_unreachable (); http://codereview.appspot.com/4591066/diff/3001/gcc/tree-threadsafe-analyze.c#newcode2151 gcc/tree-threadsafe-analyze.c:2151: gimple_call_num_args(call) 0) 2147 starting from GCC-4.5.). The clones could be created as early as when 2148 constructing SSA. Also note that the parameters of a cloned method could 2149 be optimized away. */ 2150 if (TREE_CODE (TREE_TYPE (DECL_ORIGIN (fdecl))) == METHOD_TYPE 2151gimple_call_num_args(call) 0) Wouldn't it be easier to make fdecl == DECL_ORIGIN (fdecl) earlier in the function? It's OK either way, though. http://codereview.appspot.com/4591066/
Re: [patch, libgfortran] PR48906 Wrong rounding results with -m32
On Sat, Jun 11, 2011 at 8:56 AM, Thomas Henlich wrote: On Sat, Jun 11, 2011 at 14:41, jerry DeLisle jvdeli...@charter.net wrote: This was established as solution to PR48488 where we had two choices for selecting the significant digits. Nine significant digits was established as a requirement to guarantee round trip in all cases. The char4_iunit_1.f03 test case was revised because after we corrected the formatting in PR48906, it started to fail and I observed the test case was looking for the wrong number of significant digits. Based on this, I would suggest we leave it as I have it, which is correct. I'm afraid it's not. 1.23450002E-06 has nine significant digits. That's how it should be. We don't want 1PG16.9E2 editing for list-directed and G0, but G16.9E2 for the F editing range and 1PE16.8E2 editing for the E range. This is to make sure the result always has nine significant digits, whether in the F or E range. My bad, I counted across wrong. Working on it. Coffee deficiency in the early morning. ;) Jerry Jerry