[llvm-commits] [patch] Enable unnamed_addr in declarations again

Nick Lewycky nicholas at mxc.ca
Fri Jan 14 22:33:12 PST 2011


Rafael Ávila de Espíndola wrote:
> I was convinced that we should allow unnamed_addr in declarations. This
> patch does it. I am just not entirely convinced what the behavior should
> be when resolving a declaration to a definition.
>
> This patch implements what I understood is sabre's preference:
>
> bool HasUnnamedAddr = SGV->hasUnnamedAddr();
> if (DGV && (!LinkFromSrc || DGV->isDeclaration()))
> HasUnnamedAddr = HasUnnamedAddr && DGV->hasUnnamedAddr();
>
> i.e, set drop the unnamed_addr unless both have it except for weak defs,
> where we keep the strong def.

I don't see what makes the weak def'n exemption correct. If the weak 
global is used in ways where its address matters, but the strong global 
isn't, linking them would produce uses of the strong global where the 
address matters. What am I missing?

Otherwise it sounds correct!

Nick

> I find
>
> bool HasUnnamedAddr = SGV->hasUnnamedAddr();
> if (DGV && !LinkFromSrc)
> HasUnnamedAddr = HasUnnamedAddr && DGV->hasUnnamedAddr();
>
> to be a bit more natural (in the included testcase, this changes the
> result of @d).
>
> Cheers,
> Rafael
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list