This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
-fbranch-probabilities fix
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com, patches at x86-64 dot org
- Subject: -fbranch-probabilities fix
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 19 Jun 2001 22:03:52 +0200
Hi
-fbranchp-probabilities is broken for larger programs, unless it is used
together with -fprofile-arcs.
This patch should fix it.
Tue Jun 19 22:02:30 CEST 2001 Jan Hubicka <jh@suse.cz>
* toplev.c (rest_of_compilation): Run mark_constant_function
before profile-arcs.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.470
diff -c -3 -p -r1.470 toplev.c
*** toplev.c 2001/06/13 03:21:48 1.470
--- toplev.c 2001/06/19 20:01:28
*************** rest_of_compilation (decl)
*** 3258,3263 ****
--- 3262,3276 ----
cleanup_cfg ();
check_function_return_warnings ();
+ /* It may make more sense to mark constant functions after dead code is
+ eliminated by life_analyzis, but we need to do it early, as -fprofile-arcs
+ may insert code making function non-constant, but we still must consider
+ it as constant, otherwise -fbranch-probabilities will not read data back.
+
+ life_analyzis rarely eliminates modifycation of external memory.
+ */
+ mark_constant_function ();
+
close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
*************** rest_of_compilation (decl)
*** 3290,3296 ****
flow_loops_free (&loops);
}
life_analysis (insns, rtl_dump_file, PROP_FINAL);
- mark_constant_function ();
timevar_pop (TV_FLOW);
register_life_up_to_date = 1;
--- 3303,3308 ----