[llvm] r223763 - Skip declarations in the case of functions.

Rafael Espíndola rafael.espindola at gmail.com
Tue Dec 9 12:09:48 PST 2014


On 9 December 2014 at 12:19, Michael Ilseman <milseman at apple.com> wrote:
> Looking at this more, I agree it’s a little scary. I want to try and catch the case of a declaration as early as we can. The earlier we can assert (or, temporarily, skip), the clearer the intent.
>
> MapValue calls ValueMaterializerTy::materializeValueFor() (if a Materializer is present), which will put the value onto the LazilyLinkGlobalValues. It is LazilyLinkGlobalValues which is being looped over and which yielded a declaration.
>
> Should MapValue ever be allowed to be given a function declaration? I am not familiar with its intended users. If it can’t be allowed, it seems like we should put in the assert. If it can be allowed, then what’s the story for materialization? If we can materialize them, then should we still add them to the LazilyLinkGlobalValues?

I don't see how we would get there. We only skip adding a GV to the map when:

    if (!DGV && (SGV->hasLocalLinkage() || SGV->hasLinkOnceLinkage() ||
                 SGV->hasAvailableExternallyLinkage()))

And those linkages cannot be declarations.

Can you give the attached patch a try? It would at least move the hack
closer to source (whatever that is).

> I’ll try to get IR for a test case.

Thanks.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141209/60c33d19/attachment.bin>


More information about the llvm-commits mailing list