On 12/11/2013 08:55 AM, Jan Hubicka wrote:
+ /* Don't clone decls local to a comdat group. */
+ if (comdat_local_p (node))
+ return false;
Why? It seems this should work if the clone becomes another comdat local?
Right, I think the problem was that the clone wasn't becoming comdat
local. And for the specific case of decloning, there's no point in
cloning the decloned constructor.
If it does not make sense, how we ended up cloning it?
I guess the heuristics are making a mistake.
Can you show me some code sample of decloning?
I assume that we basically turn original cloned constructors into wrappers
around common "worker" that is now comdat local.
Right.
I think ipa-cp may end up
deciding on clonning the wrapper that will break because it will end up static
calling the local comdat function.
On the other hand it may decide to clone both the wrapper and the actual
function
and in that case bringing both static is fine.
In the case I'm looking at (g++.dg/torture/pr41257.C, with decloning
forced on), we're cloning the local function in order to propagate in a
'0' passed in from one of the wrappers. This is pointless because the
wrapper contains just the one call, so in any situation where cloning
makes sense, inlining is better.
So, it's probably possible to make it work to clone the comdat local
function into another comdat local function, but it's not useful, and
it's easier to just prevent it.
Jason