[PATCH] D158223: [clang] Add clang::unnamed_addr attribute that marks globals' address as not significant

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 15:17:59 PDT 2023


rnk added a comment.

So, I'm strongly in favor of the feature, but I want to get feedback on the name.

The major pro is that it maps directly to LLVM IR: the attribute does exactly what it says. The major con is that the name isn't really related to what the user wants to do, which is to merge duplicate constant data. This attribute is also not sufficient, since you also need `-fdata-sections` for ICF to fire on readonly data.

Some alternatives:

- no_addrsig
- enable_icf
- allow_icf
- allow_merging

If you force me to pick now, I would say let's go with `[[clang:unnamed_addr]]` because the search results for unnamed_addr already explain what it should do. Perhaps naming consistency is better than picking the most descriptive name.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158223/new/

https://reviews.llvm.org/D158223



More information about the cfe-commits mailing list