Page MenuHomePhabricator

Add !annotation metadata and remarks pass.
ClosedPublic

Authored by fhahn on Nov 10 2020, 10:25 AM.

Details

Summary

This patch adds a new !annotation metadata kind which can be used to
attach annotation strings to instructions.

It also adds a new pass that emits summary remarks per function with the
counts for each annotation kind.

The intended uses cases for this new metadata is annotating
'interesting' instructions and the remarks should provide additional
insight into transformations applied to a program.

To motivate this, consider these specific questions we would like to get answered:

  • How many stores added for automatic variable initialization remain after optimizations? Where are they?
  • How many runtime checks inserted by a frontend could be eliminated? Where are the ones that did not get eliminated?

Diff Detail

Event Timeline

fhahn created this revision.Nov 10 2020, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2020, 10:25 AM
fhahn requested review of this revision.Nov 10 2020, 10:25 AM
paquette added inline comments.Nov 10 2020, 11:15 AM
llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
48

Can this be const?

50

Pull out of the loop?

Makes sense to me.

llvm/lib/Passes/PassBuilder.cpp
1691

Helper function for this?

thegameg accepted this revision.Nov 10 2020, 3:01 PM

Looks great, thanks!

llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
49

Any reason this is a "missed" remark and not "analysis"?

This revision is now accepted and ready to land.Nov 10 2020, 3:01 PM
jdoerfert added inline comments.Nov 10 2020, 5:24 PM
llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
49

Yeah, I didn't notice this. Missed is not good.

fhahn updated this revision to Diff 304510.Nov 11 2020, 7:07 AM

Address comments, thanks!

fhahn marked 2 inline comments as done.Nov 11 2020, 7:08 AM
fhahn added inline comments.
llvm/lib/Passes/PassBuilder.cpp
1691

Yep, that's much better, thanks!

llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
48

Yep, done!

49

Any reason this is a "missed" remark and not "analysis"?

Nope, should be "analysis". Fixed, thanks!

50

done, thanks!

This revision was landed with ongoing or failed builds.Nov 13 2020, 5:26 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked 2 inline comments as done.