[PATCH] New optimize(0) versioning fix (PR target/60026, take 2)
Jakub Jelinek
jakub@redhat.com
Thu Feb 6 21:59:00 GMT 2014
On Thu, Feb 06, 2014 at 10:45:23AM +0100, Richard Biener wrote:
> On Thu, 6 Feb 2014, Jakub Jelinek wrote:
>
> > On Wed, Feb 05, 2014 at 08:42:27PM +0100, Jakub Jelinek wrote:
> > > So, where do we want to do that instead? E.g. should it be e.g. in
> > > tree_versionable_function_p directly and let the inliner (if it doesn't do
> > > already) also treat optimize(0) functions that aren't always_inline as
> > > noinline?
> >
> > So, another attempt to put the && opt_for_fn (fndecl, optimize) into
> > tree_versionable_function_p also failed, because e.g. for TM (but also for
> > SIMD clones) we need to clone -O0 functions. So, can I fix PR600{6,7}2
> > without touching tree-inline.c and fix PR60026 again separately somehow else
> > as follow-up? Bootstrapped/regtested on x86_64-linux and i686-linux.
>
> That works for me.
Here it is. Bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?
2014-02-06 Jakub Jelinek <jakub@redhat.com>
PR ipa/60026
* ipa-cp.c (determine_versionability): Fail at -O0
or __attribute__((optimize (0))) functions.
* tree-sra.c (ipa_sra_preliminary_function_checks): Likewise.
Revert:
2014-02-04 Jakub Jelinek <jakub@redhat.com>
PR ipa/60026
* tree-inline.c (copy_forbidden): Fail for
__attribute__((optimize (0))) functions.
--- gcc/tree-inline.c.jj 2014-02-05 16:18:50.000000000 +0100
+++ gcc/tree-inline.c 2014-02-06 17:12:03.008993548 +0100
@@ -3315,18 +3315,6 @@ copy_forbidden (struct function *fun, tr
goto fail;
}
- tree fs_opts;
- fs_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fun->decl);
- if (fs_opts)
- {
- struct cl_optimization *os = TREE_OPTIMIZATION (fs_opts);
- if (!os->x_optimize)
- {
- reason = G_("function %q+F compiled without optimizations");
- goto fail;
- }
- }
-
fail:
fun->cannot_be_copied_reason = reason;
fun->cannot_be_copied_set = true;
--- gcc/tree-sra.c.jj 2014-01-03 11:40:57.000000000 +0100
+++ gcc/tree-sra.c 2014-02-06 17:15:43.348804011 +0100
@@ -4900,6 +4900,13 @@ ipa_sra_preliminary_function_checks (str
return false;
}
+ if (!opt_for_fn (node->decl, optimize))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Function not optimized.\n");
+ return false;
+ }
+
if (DECL_VIRTUAL_P (current_function_decl))
{
if (dump_file)
--- gcc/ipa-cp.c.jj 2014-02-05 10:38:01.000000000 +0100
+++ gcc/ipa-cp.c 2014-02-06 17:19:13.405671970 +0100
@@ -430,6 +430,8 @@ determine_versionability (struct cgraph_
reason = "not a tree_versionable_function";
else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
reason = "insufficient body availability";
+ else if (!opt_for_fn (node->decl, optimize))
+ reason = "non-optimized function";
else if (lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (node->decl)))
{
/* Ideally we should clone the SIMD clones themselves and create
Jakub
More information about the Gcc-patches
mailing list