This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Trivial cleanup of uses of flag_lto || flag_whopr
Hi Rafael,
A few places check whether either flag_lto or flag_whopr are set. It looks
like what they really care about is whether LTO is being generated, so this
patch changes them to check for flag_generate_lto (equivalent to flag_lto ||
flag_whopr, so no functionality change).
You added some includes, you have to update Makefile.in.
like this? (See attached patch). Proposed changelog entry:
+ 2009-12-04 Duncan Sands <baldrick@free.fr>
+
+ * cgraphunit.c (cgraph_decide_is_function_needed): Use flag_generate_lto
+ rather than checking flag_lto and flag_whopr.
+ * ipa.c (local_function_and_variable_visibility): Likewise.
+ * ipa-cp.c (ipcp_init_stage): Likewise.
+ * varpool.c (decide_is_variable_needed): Likewise.
+ * fortran/options.c (gfc_post_options): Likewise.
+ * ipa.c: include flags.h.
+ * Makefile.in: Add ipa.c dependency on flags.h.
I think it is OK with that change, but I also think you have to wait
for the next stage 1 :-(
Ugh :(
Thanks for looking at it,
Duncan.
Index: mainline/gcc/cgraphunit.c
===================================================================
--- mainline.orig/gcc/cgraphunit.c 2009-12-08 17:31:41.004321857 +0100
+++ mainline/gcc/cgraphunit.c 2009-12-08 17:36:47.211914685 +0100
@@ -358,8 +358,7 @@
&& !DECL_DECLARED_INLINE_P (decl)
&& !node->origin))
&& !flag_whole_program
- && !flag_lto
- && !flag_whopr)
+ && !flag_generate_lto)
&& !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
return true;
Index: mainline/gcc/ipa-cp.c
===================================================================
--- mainline.orig/gcc/ipa-cp.c 2009-12-08 17:31:41.024330339 +0100
+++ mainline/gcc/ipa-cp.c 2009-12-08 17:36:47.221953358 +0100
@@ -628,7 +628,7 @@
{
/* We do not need to bother analyzing calls to unknown
functions unless they may become known during lto/whopr. */
- if (!cs->callee->analyzed && !flag_lto && !flag_whopr)
+ if (!cs->callee->analyzed && !flag_generate_lto)
continue;
ipa_count_arguments (cs);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
Index: mainline/gcc/ipa.c
===================================================================
--- mainline.orig/gcc/ipa.c 2009-12-08 17:31:41.034318098 +0100
+++ mainline/gcc/ipa.c 2009-12-08 17:36:47.231861147 +0100
@@ -27,6 +27,7 @@
#include "timevar.h"
#include "gimple.h"
#include "ggc.h"
+#include "flags.h"
/* Fill array order with all nodes with output flag set in the reverse
topological order. */
@@ -401,7 +402,7 @@
static unsigned int
local_function_and_variable_visibility (void)
{
- return function_and_variable_visibility (flag_whole_program && !flag_lto && !flag_whopr);
+ return function_and_variable_visibility (flag_whole_program && !flag_generate_lto);
}
struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility =
Index: mainline/gcc/varpool.c
===================================================================
--- mainline.orig/gcc/varpool.c 2009-12-08 17:31:41.004321857 +0100
+++ mainline/gcc/varpool.c 2009-12-08 17:36:47.241964425 +0100
@@ -244,8 +244,7 @@
COMDAT variables that must be output only when they are needed. */
if (TREE_PUBLIC (decl)
&& !flag_whole_program
- && !flag_lto
- && !flag_whopr
+ && !flag_generate_lto
&& !DECL_COMDAT (decl)
&& !DECL_EXTERNAL (decl))
return true;
Index: mainline/gcc/fortran/options.c
===================================================================
--- mainline.orig/gcc/fortran/options.c 2009-12-08 17:31:41.014317857 +0100
+++ mainline/gcc/fortran/options.c 2009-12-08 17:36:47.241964425 +0100
@@ -243,7 +243,7 @@
gfc_option.flag_whole_file = 1;
/* Enable whole-file mode if LTO is in effect. */
- if (flag_lto || flag_whopr)
+ if (flag_generate_lto)
gfc_option.flag_whole_file = 1;
/* -fbounds-check is equivalent to -fcheck=bounds */
Index: mainline/gcc/Makefile.in
===================================================================
--- mainline.orig/gcc/Makefile.in 2009-12-08 17:31:41.024330339 +0100
+++ mainline/gcc/Makefile.in 2009-12-08 17:36:47.251874518 +0100
@@ -2876,7 +2876,7 @@
$(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(GIMPLE_H) \
$(TREE_FLOW_H) gt-varpool.h
ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
- $(TREE_PASS_H) $(TIMEVAR_H) $(GIMPLE_H) $(GGC_H)
+ $(TREE_PASS_H) $(TIMEVAR_H) $(GIMPLE_H) $(GGC_H) $(FLAGS_H)
ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) \