stevenb@iowa:~/devel/build$ ./prev-gcc/xgcc -v Using built-in specs. COLLECT_GCC=./prev-gcc/xgcc Target: ia64-unknown-linux-gnu Configured with: ../trunk/configure --with-gmp=/home/stevenb --with-mpfr=/home/stevenb --enable-languages=c --disable-checking --disable-nls --disable-libmudflap --disable-libssp Thread model: posix gcc version 4.6.0 20101117 (experimental) [trunk revision 166881] (GCC) stevenb@iowa:~/devel/build$ /home/stevenb/devel/build/./prev-gcc/xgcc -B/home/stevenb/devel/build/./prev-gcc/ -B/usr/local/ia64-unknown-linux-gnu/bin/ -B/usr/local/ia64-unknown-linux-gnu/bin/ -B/usr/local/ia64-unknown-linux-gnu/lib/ -isystem /usr/local/ia64-unknown-linux-gnu/include -isystem /usr/local/ia64-unknown-linux-gnu/sys-include -I../../trunk/libcpp -I. -I../../trunk/libcpp/../include -I../../trunk/libcpp/include -g -O2 -fprofile-use -W -Wall -Wwrite-strings -Wmissing-format-attribute -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wc++-compat -pedantic -Wno-long-long -Werror -I../../trunk/libcpp -I. -I../../trunk/libcpp/../include -I../../trunk/libcpp/include -c -o macro.o -MT macro.o -MMD -MP -MF .deps/macro.Tpo ../../trunk/libcpp/macro.c ../../trunk/libcpp/macro.c: In function 'cpp_macro_definition': ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: profile data is not flow-consistent ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-59 thought to be -104 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-1 thought to be 104 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-56 thought to be 10 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-57 thought to be -5 make[3]: *** [macro.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[3]: Leaving directory `/home/stevenb/devel/build/libcpp' make[2]: *** [all-stagefeedback-libcpp] Error 2 make[2]: Leaving directory `/home/stevenb/devel/build' make[1]: *** [stagefeedback-bubble] Error 2 make[1]: Leaving directory `/home/stevenb/devel/build' make: *** [profiledbootstrap] Error 2 Configured with with --disable-checking, so may be related to PR32917. I have no idea how to reduce this to a test case for debugging. I will try with --enable-checking=release also.
What you do is look at the gimple before pass_ipa_tree_profile at profile-use and profile-generate time, they should have matching CFGs. If they don't then that's the bug.
Also confirmed on x86_64-unknown-linux-gnu. The execution numbers are exactly the same as on ia64.
Also happens with --enable-checking=release on ia64: ../../trunk/libcpp/macro.c: In function 'cpp_macro_definition': ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: profile data is not flow-consistent ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-59 thought to be -104 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-1 thought to be 104 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-56 thought to be 10 ../../trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-57 thought to be -5 make[3]: *** [macro.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[3]: Leaving directory `/home/stevenb/devel/build-test/libcpp' make[2]: *** [all-stagefeedback-libcpp] Error 2 make[2]: Leaving directory `/home/stevenb/devel/build-test' make[1]: *** [stagefeedback-bubble] Error 2 make[1]: Leaving directory `/home/stevenb/devel/build-test' make: *** [profiledbootstrap] Error 2 stevenb@iowa:~/devel/build-test$ cat gcc/configargs.h /* Generated automatically. */ static const char configuration_arguments[] = "../trunk/configure --with-gmp=/home/stevenb --with-mpfr=/home/stevenb --enable-languages=c --enable-checking=release --disable-nls --disable-libmudflap --disable-libssp"; static const char thread_model[] = "posix";
Also on alpha, you will need [1] to get this far. Using built-in specs. COLLECT_GCC=./prev-gcc/xgcc Target: alphaev68-unknown-linux-gnu Configured with: ../gcc-svn/trunk/configure --enable-languages=c,c++,fortran Thread model: posix gcc version 4.6.0 20101120 (experimental) [trunk revision 166974] (GCC) Marked as 4.6 regression. [1] http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02118.html
It is caused by revision revision 164986: http://gcc.gnu.org/ml/gcc-cvs/2010-10/msg00168.html
Created attachment 22514 [details] preprocessed file
Created attachment 22516 [details] corresponding profile ~/gcc-build/prev-gcc/cc1 -g -O2 -fprofile-use -quiet macro.i ../../gcc-svn/trunk/libcpp/macro.c: In function ‘cpp_macro_definition’: ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: profile data is not flow-consistent ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-59 thought to be -104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-1 thought to be 104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-56 thought to be 10 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-57 thought to be -5
I can't reproduce it on x86_64-unknown-linux-gnu with ./configure --disable-checking --enable-languages=c or with ./configure --enable-languages=c,c++,fortran I can reproduce it with the attached testcase and stage1 xgcc though: > ./xgcc -B. -O2 -g -fprofile-use -c macro.i ../../gcc-svn/trunk/libcpp/macro.c: In function 'cpp_macro_definition': ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: profile data is not flow-consistent ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-59 thought to be -104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-1 thought to be 104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-56 thought to be 10 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-57 thought to be -5 would be nice to know if BOOT_CFLAGS="-O2 -g -fno-inline" ./configure --enable-languages=c make profiledbootstrap BOOT_CFLAGS="-O2 -g -fno-inline" also fails, alternatively s/-g -fno-inline/-g0/ or s/-fno-inline/-fno-partial-inlining.
The CFGs match, the spanning tree as well. Instrumenting needs to split two edges, but that shouldn't matter and happens elsewhere as well. But we have in .optimized (of the -fprofile-generate case) <bb 11>: pretmp.676_490 = (unsigned int) D.8874_415; pretmp.677_491 = macro_39->params; pretmp.681_496 = *.LPBX1[67]; <bb 12>: # len_429 = PHI <len_55(12), len_44(11)> # ivtmp.698_171 = PHI <ivtmp.698_92(12), 0(11)> D.8871_52 = MEM[base: pretmp.677_491, index: ivtmp.698_171, step: 8, offset: 0B]; D.8872_53 = D.8871_52->ident.len; D.8873_54 = D.8872_53 + 1; len_55 = D.8873_54 + len_429; # DEBUG len => len_55 # DEBUG i => D#11 # DEBUG len => len_55 # DEBUG i => D#11 ivtmp.698_92 = ivtmp.698_171 + 1; i_64 = (unsigned int) ivtmp.698_92; if (i_64 < pretmp.676_490) goto <bb 12>; else goto <bb 13>; <bb 13>: D.11695_474 = pretmp.681_496 + 1; D.11697_493 = pretmp.676_490 + 4294967295; D.11698_127 = (long int) D.11697_493; *.LPBX1_I_lsm.686_486 = D.11695_474 + D.11698_127; *.LPBX1[67] = *.LPBX1_I_lsm.686_486; which at least looks odd to me and produced by SCCP (supposedly *.LPBX1[67] + 1 + (long)(niter - 1), so not 100% invalid). Soooo ... for those who can reproduce it, can you try with -fno-tree-scev-cprop? I'll wrap my brain around that above computation tomorrow ;)
Created attachment 22517 [details] -fno-inline preprocessed source
Created attachment 22518 [details] corresponding -fno-inline profile ~/gcc-build/prev-gcc/cc1 -g -O2 -fno-inline -fprofile-use -quiet macro.i ../../gcc-svn/trunk/libcpp/macro.c: In function ‘cpp_macro_definition’: ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: profile data is not flow-consistent ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-59 thought to be -104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 45-1 thought to be 104 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-56 thought to be 10 ../../gcc-svn/trunk/libcpp/macro.c:2123:1: error: corrupted profile info: number of executions for edge 55-57 thought to be -5
glibc data form F14: ./libc.so.6 GNU C Library development release version 2.12.90, by Roland McGrath et al. Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.5.1 20100924 (Red Hat 4.5.1-4). Compiled on a Linux 2.6.35 system on 2010-11-12. Available extensions: Support for some architectures added on, not maintained in glibc core. The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>.
(In reply to comment #9) > Soooo ... for those who can reproduce it, can you try with > -fno-tree-scev-cprop? Bootstrap also fails with -fno-tree-scev-cprop :( The configure/build commands were similar to ones in comment 8.
Created attachment 22520 [details] dump from stageprofile
Created attachment 22521 [details] dump from stagefedback
In your dump files there is a CFG inconsistency that I can't reproduce. At least basic block numbers are not consistent. I also see DEBUG insns in stagefeedback but not stageprofile (my dumps have DEBUG insns in both dump files). Which hints at for example: <bb 17>: PROF_edge_counter.65_257 = *.LPBX1[69]; PROF_edge_counter.65_258 = PROF_edge_counter.65_257 + 1; *.LPBX1[69] = PROF_edge_counter.65_258; count_61 = macro_real_token_count (macro_39); <bb 18>: PROF_edge_counter.65_259 = *.LPBX1[70]; PROF_edge_counter.65_260 = PROF_edge_counter.65_259 + 1; *.LPBX1[70] = PROF_edge_counter.65_260; goto <bb 30>; vs. <bb 17>: Invalid sum of outgoing probabilities 0.0% Invalid sum of outgoing counts 0, should be 211 count_61 = macro_real_token_count (macro_39); # DEBUG count => count_61 # DEBUG i => 0 goto <bb 29>; it would be interesting to see when the CFGs start to differ. Can you also check logs if really -g0 is used at stageprofile and -g at stagefeedback. I'm trying to look why I have -g consistently.
Please try Index: gcc/profile.c =================================================================== --- gcc/profile.c (revision 167127) +++ gcc/profile.c (working copy) @@ -940,7 +943,8 @@ branch_prob (void) for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) { last = gsi_stmt (gsi); - if (gimple_has_location (last)) + if (!is_gimple_debug (last) + && gimple_has_location (last)) break; } we do CFG manipulations based on debug stmts (verified with a later assert that triggers on -O2 -g -fprofile-use). It's of course unfortunate that we do this BB splitting at all when not doing coverage test.
> we do CFG manipulations based on debug stmts (verified with a later > assert that triggers on -O2 -g -fprofile-use). > > It's of course unfortunate that we do this BB splitting at all when > not doing coverage test. The BB splitting is neccesary so the CFG can be solved (i.e. you have explicit edges to exit when program can terminate). Honza
I started profiledbootstrap tracking: http://gcc.gnu.org/ml/gcc-regression/2010-11/msg00378.html
(In reply to comment #17) > Please try > > Index: gcc/profile.c > =================================================================== > --- gcc/profile.c (revision 167127) > +++ gcc/profile.c (working copy) > @@ -940,7 +943,8 @@ branch_prob (void) > for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) > { > last = gsi_stmt (gsi); > - if (gimple_has_location (last)) > + if (!is_gimple_debug (last) > + && gimple_has_location (last)) > break; > } Great, this bootstrapped OK for -enable-languages=c.
Author: rguenth Date: Fri Nov 26 09:49:47 2010 New Revision: 167171 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167171 Log: 2010-11-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/46528 PR debug/46338 * profile.c (branch_prob): Do not split blocks based on locations from debug statements. Modified: trunk/gcc/ChangeLog trunk/gcc/profile.c
Fixed.
Author: jakub Date: Mon Dec 6 19:30:31 2010 New Revision: 167515 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167515 Log: PR tree-optimization/46528 PR debug/46338 * profile.c (branch_prob): Make sure last is never set to a debug stmt. Modified: trunk/gcc/ChangeLog trunk/gcc/profile.c