[PATCH, committed] Function specific option changes (IA-64, hot/cold, scheduling)
Michael Meissner
meissner@the-meissners.org
Sat Jul 26 18:56:00 GMT 2008
On Sat, Jul 26, 2008 at 01:38:29PM +0200, Jan Hubicka wrote:
> Hi,
> there was regression on SPECFP2000 tester today
> http://gcc.opensuse.org/SPEC/CFP/sb-vangelis-head-64/recent.html
> they are happening on x86-64 only, not on ia64. I believe they are
> related to these changes. We now disable inlining in many cases during
> bootstrap because optimize_size does not match. This feel wrong.
This patch should disable the code that prevents the inlining of a hot function
into a cold function, and also prevents -Os/-O3 from being applied to cold/hot
functions. I haven't done a full build right now, but I'm providing it for
testing.
2008-07-26 Michael Meissner <gnu@the-meissners.org>
* doc/extend.texi (hot attribute): Don't document x86_64, i386,
and ia-64 setting optimize option.
(cold attribute): Ditto.
* tree-inline.c (tree_can_inline_p): Disable disabling inlining if
the caller and callee have different optimization attributes.
* config/i386/i386.c
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Don't set for
now.
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Ditto.
* config/ia64/ia64.c
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Don't set for
now.
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Ditto.
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (revision 138172)
+++ gcc/doc/extend.texi (working copy)
@@ -2903,10 +2903,6 @@ are automatically detected and this attr
The @code{hot} attribute is not implemented in GCC versions earlier
than 4.3.
-Starting with GCC 4.4, the @code{cold} attribute sets
-@code{optimize("O3")} to turn on more aggressive optimization on the
-the i386, x86_64, and IA-64 targets.
-
@item cold
@cindex @code{cold} function attribute
The @code{cold} attribute is used to inform the compiler that a function is
@@ -2924,10 +2920,6 @@ are automatically detected and this attr
The @code{cold} attribute is not implemented in GCC versions earlier than 4.3.
-Starting with GCC 4.4, the @code{cold} attribute sets
-@code{optimize("Os")} to save space on the the i386, x86_64, and IA-64
-targets.
-
@item regparm (@var{number})
@cindex @code{regparm} attribute
@cindex functions that are passed arguments in registers on the 386
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c (revision 138172)
+++ gcc/tree-inline.c (working copy)
@@ -3688,6 +3688,11 @@ build_duplicate_type (tree type)
bool
tree_can_inline_p (tree caller, tree callee)
{
+#if 0
+ /* This causes a regression in SPEC in that it prevents a cold function from
+ inlining a hot function. Perhaps this should only apply to functions
+ that the user declares hot/cold/optimize explicitly. */
+
/* Don't inline a function with a higher optimization level than the
caller, or with different space constraints (hot/cold functions). */
tree caller_tree = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (caller);
@@ -3709,6 +3714,7 @@ tree_can_inline_p (tree caller, tree cal
|| (caller_opt->optimize_size != callee_opt->optimize_size))
return false;
}
+#endif
/* Allow the backend to decide if inlining is ok. */
return targetm.target_option.can_inline_p (caller, callee);
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c (revision 138172)
+++ gcc/config/i386/i386.c (working copy)
@@ -27344,11 +27344,14 @@ ix86_enum_va_list (int idx, const char *
#undef TARGET_OPTION_CAN_INLINE_P
#define TARGET_OPTION_CAN_INLINE_P ix86_can_inline_p
+#if 0
+/* disable turning -Os on for cold functions and -O3 for now. */
#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
+#endif
struct gcc_target targetm = TARGET_INITIALIZER;
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c (revision 138172)
+++ gcc/config/ia64/ia64.c (working copy)
@@ -493,11 +493,14 @@ static const struct attribute_spec ia64_
#undef TARGET_C_MODE_FOR_SUFFIX
#define TARGET_C_MODE_FOR_SUFFIX ia64_c_mode_for_suffix
+#if 0
+/* disable turning -Os on for cold functions and -O3 for now. */
#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
+#endif
struct gcc_target targetm = TARGET_INITIALIZER;
--
Michael Meissner
email: meissner@the-meissners.org
http://www.the-meissners.org
More information about the Gcc-patches
mailing list