[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2023-05-22 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990

Ivan Sorokin  changed:

   What|Removed |Added

 CC||vanyacpp at gmail dot com

--- Comment #5 from Ivan Sorokin  ---
I encountered the same issue as in this PR. GCC never inlines functions with
target_clone attribute. Therefore when the function is small and benefits from
inlining applying target_clone to it can pessimize it.

It would be great if GCC were able to inline functions with target_clone
attribute and propagate target_clone attribute as comment #3 suggests.

On this example:

__attribute__((target_clones("default", "arch=x86-64-v3")))
static int foo(int a, int b)
{
return a & ~b;
}

int bar(int a, int b)
{
return foo(a, b);
}

An ideal behavior would be foo to be inlined into bar (and bar becoming
multiversioned) and foo removed completely as none of its usages left.

[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2016-07-25 Thread sgunderson at bigfoot dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990

--- Comment #4 from sgunderson at bigfoot dot com ---
OK, so it would have to be a special kind of cloning, not the one you can do
yourself from code as of today?

As a user, I suppose there's no really good way of dealing with this currently,
right? Short of maybe doing manual multiversioning with
__builtin_cpu_supports() and hoping that the compiler can hoist that out of all
the loops.

[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2016-07-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990

--- Comment #3 from Richard Biener  ---
(In reply to sgunderson from comment #2)
> Would pushing the mv automatically upwards into callers really help? There's
> still no way that I can see to inline the function; I mean, pushing upwards
> is what I've been trying to do here manually with the target clones.

Well, you'd effectively generate two target clones for bar() and call
the respective foo overload directly so it can be inlined.

[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2016-07-25 Thread sgunderson at bigfoot dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990

--- Comment #2 from sgunderson at bigfoot dot com ---
Would pushing the mv automatically upwards into callers really help? There's
still no way that I can see to inline the function; I mean, pushing upwards is
what I've been trying to do here manually with the target clones.

[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2016-07-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990

Richard Biener  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #1 from Richard Biener  ---
The features are mutually exclusive right now, we don't know how to "inline"
the
ifunc resolver.  I guess auto-multi-versioning callers instead would make more
sense (thus, push the mv upward to allow inlining).