[Bug middle-end/14684] [4.0 Regression] -fprofile-use/-fprofile-generate failure because of coverage mismatch

kcook at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Oct 5 18:05:00 GMT 2004


------- Additional Comments From kcook at gcc dot gnu dot org  2004-10-05 18:05 -------
Subject: Re: Is profiledbootstrap supposed to work currently? [PR bootstrap/14684]

On Oct 5, 2004, at 10:22 AM, Richard Guenther wrote:

    Trying profiledbootstrap today on ia32-linux leads to

    is this supposed to happen at the moment, i.e. are there pending
    fixes, or
    is this a genuine bug? 

> This was caused by the fact -funroll-loops is supplied only when
> -fprofile-use is supplied and some unrolling is done on the tree level
> but profiling is done on the RTL level so there is a mismatch.

 >
 > This is PR 14684.
 >
 > A workaround is to change -fprofile-generate to imply -funroll-loops too.

I've attached the seemingly obvious cut-and-paste patch which causes 
-fprofile-generate to match the same options implied by -fprofile-use.

It does survive make bootstrap.  Unfortunately, it leads to a new 
problem when attempting a make profiledbootstrap:

stage1/xgcc.exe -Bstage1/ -B/usr/local/i686-pc-cygwin/bin/ -c   -g -O2 
-fprofile-generate -DIN_GCC   -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -fno-common   -DHAVE_CONFIG_H 
-DGENERATOR_FILE    -I. -Ibuild -I../../gcc-snapshot/gcc 
-I../../gcc-snapshot/gcc/build -I../../gcc-snapshot/gcc/../include 
-I../../gcc-snapshot/gcc/../libcpp/include -o build/gengtype.o 
../../gcc-snapshot/gcc/gengtype.c
../../gcc-snapshot/gcc/gengtype.c: In function 'get_base_file_bitmap':
../../gcc-snapshot/gcc/gengtype.c:1194: internal compiler error: 
Segmentation fault

I have a feeling that this patch is nevertheless correct and should be 
applied.

Kelley Cook
2004-10-05  Kelley Cook  <kcook@gcc.gnu.org>

	PR middle-end/14684
	* opts.c (OPT_fprofile_generate): Default to -funroll-loops,
	-fpeel-loops and -ftracer to match -fprofile-use.

--- gcc-orig/gcc/opts.c	2004-09-10 07:02:25.000000000 -0400
+++ gcc-snapshot/gcc/opts.c	2004-10-05 13:04:09.383317700 -0400
@@ -850,10 +850,16 @@ common_handle_option (size_t scode, cons
     case OPT_fprofile_generate:
       if (!profile_arc_flag_set)
         profile_arc_flag = value;
       if (!flag_profile_values_set)
         flag_profile_values = value;
+      if (!flag_unroll_loops_set)
+        flag_unroll_loops = value;
+      if (!flag_peel_loops_set)
+        flag_peel_loops = value;
+      if (!flag_tracer_set)
+        flag_tracer = value;
       if (!flag_value_profile_transformations_set)
         flag_value_profile_transformations = value;
 #ifdef HAVE_prefetch
       if (!flag_speculative_prefetching_set)
 	flag_speculative_prefetching = value;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14684



More information about the Gcc-bugs mailing list