Make nomerge attribute a function attribute as well as a statement attribute to extend the functionality of nomerge attribute.
For functions already have nomerge attribute, don't add nomerge attribute at the call-site of this function.
Paths
| Differential D92800
[Clang] Make nomerge attribute a function attribute as well as a statement attribute. ClosedPublic Authored by zequanwu on Dec 7 2020, 4:53 PM.
Details Summary Make nomerge attribute a function attribute as well as a statement attribute to extend the functionality of nomerge attribute. For functions already have nomerge attribute, don't add nomerge attribute at the call-site of this function.
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 7 2020, 4:53 PM Comment Actions start a new diff to make nomerge attribute a function attribute as well as a statement attribute. zequanwu retitled this revision from [Clang] Add disable-merge function attribute which generates nomerge function attribute in IR to [Clang] Make nomerge attribute a function attribute as well as a statement attribute..Dec 9 2020, 9:16 PM Comment Actions Nice, that wasn't too difficult. I had some suggestions for improving the test case, and I'd like to hear from Aaron.
zequanwu marked an inline comment as done. Comment ActionsAdd test for virutal function.
zequanwu marked an inline comment as done. Comment ActionsAdd docs.
Comment Actions In general, I think this is reasonable -- there's a bit more work to be done before it's ready to land, but this is heading in the right direction.
zequanwu marked 4 inline comments as done. Comment Actionsaddress comments.
zequanwu marked 2 inline comments as done. Comment Actionsaddress comments.
This revision is now accepted and ready to land.Dec 17 2020, 5:23 AM This revision was landed with ongoing or failed builds.Dec 17 2020, 7:46 AM Closed by commit rGfb0f7288051e: [Clang] Make nomerge attribute a function attribute as well as a statement… (authored by zequanwu). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 312498 clang/include/clang/AST/Attr.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/attr-nomerge.cpp
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-nomerge.cppclang/utils/TableGen/ClangAttrEmitter.cpp
llvm/include/llvm/IR/Attributes.td
|
I think this should be an InheritableAttr, like DeclOrTypeAttr. With type/decl attributes, those are almost always for things like calling conventions or other cases where inheritance of the attribute is really likely to be the correct default. It's less clear to me that the same is true for stmt/decl attributes aside from the observation that most decl attributes are inheritable. We may need to come up with a better approach for inheritance here at some point when we find a stmt/decl attribute that should not be inheritable.