This is an archive of the discontinued LLVM Phabricator instance.

Add Annotation2MD pass to add !annotate metadata from llvm.global.annotations
ClosedPublic

Authored by fhahn on Nov 10 2020, 11:39 AM.

Details

Summary

This patch adds a new pass to add !annotation metadata for entries in
@llvm.global.anotations, which is generated using
attribute((annotate("_name"))) on functions in Clang.

This has been discussed on llvm-dev as part of

RFC: Combining Annotation Metadata and Remarks
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html

Diff Detail

Event Timeline

fhahn created this revision.Nov 10 2020, 11:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2020, 11:39 AM
fhahn requested review of this revision.Nov 10 2020, 11:39 AM
paquette added inline comments.Nov 13 2020, 1:53 PM
llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h
2

Fix filename in comment?

21

Fix comment

thegameg accepted this revision.Nov 13 2020, 3:49 PM

LGTM

llvm/test/Transforms/Util/annotation2metadata.ll
9

Will It be the frontend's job to mark the array as appending?

This revision is now accepted and ready to land.Nov 13 2020, 3:49 PM
This revision was landed with ongoing or failed builds.Nov 16 2020, 6:58 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2020, 6:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
fhahn marked an inline comment as done.Nov 16 2020, 7:17 AM

Thanks Jessica & Francis! I committed the initial version, with a small change to only run if the !annotation remarks are enabled.

llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h
2

Done in the final version, thanks!

21

Done in the final version, thanks!

arsenm added a subscriber: arsenm.Nov 27 2022, 7:35 AM
arsenm added inline comments.
llvm/lib/Transforms/IPO/Annotation2Metadata.cpp
51

This needs to handle pure Constants / direct GlobalValue references. The test added here fails when converted to opaque pointers when all of the no-op bitcasts and getelementptrs are removed

Herald added a project: Restricted Project. · View Herald TranscriptNov 27 2022, 7:35 AM