[llvm-commits] [patch][8927] Add an unnamed_addr attribute
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Sat Jan 8 08:55:01 PST 2011
> This patch looks great except for:
>
>> non constant globals are not allowed to have unnamed_addr since I couldn't figure out any use for it.
>
> I also can't figure out any use for it in C, but I don't think that the verifier should reject this. The property is orthogonal from immutability.
>
> Here's a contrived example where it could be useful: imagine a language that doesn't have pointer comparisons: in that language the frontend could mark all globals as unnamed_addr, regardless of whether they are const or not. If the optimizer realizes later that there are no stores to a global, it could be marked const, and then (because it has the attr) merged with other constant globals.
>
> Does that make any sense?
Yes, it is a very good point. I changed the patch to accept regular
globals with the unnamed_addr attribute, updated the documentation and
committed it.
Having clang produce it in simple cases is next.
> -Chris
Thanks,
Rafael
More information about the llvm-commits
mailing list