This is an archive of the discontinued LLVM Phabricator instance.

Add an option to print out annotation remark count.
ClosedPublic

Authored by zjaffal on Apr 6 2023, 7:13 AM.

Details

Summary

This adds a annotation-count option to llvm-remarkutil.

llvm-remarkutil annotation-count -remark=REMARK

This will print out the remark count for a pass that uses annotation remarks.

Diff Detail

Event Timeline

zjaffal created this revision.Apr 6 2023, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2023, 7:13 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
zjaffal requested review of this revision.Apr 6 2023, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2023, 7:13 AM
thegameg added inline comments.Apr 6 2023, 9:14 AM
llvm/tools/llvm-remarkutil/RemarkUtil.cpp
88

I think --remark is too vague. It is very specific to the type of the annotation remark, so maybe --annotation-type?

303

Why assert? The type can be anything right? If it doesn't match --remark it should just print nothing, no?

paquette added inline comments.Apr 6 2023, 9:30 AM
llvm/test/tools/llvm-remarkutil/Inputs/annotation-count.yaml
28

probably need a newline here to make all YAML parsers work (I've had problems with MIR tests missing newlines at the end)

llvm/tools/llvm-remarkutil/RemarkUtil.cpp
88

+1

290

comment is incorrect

306

I think the message on this assert is incorrect

paquette added inline comments.Apr 6 2023, 9:36 AM
llvm/tools/llvm-remarkutil/RemarkUtil.cpp
306

And yeah these probably shouldn't be asserts. IIUC this should only happen if you provide a file without annotation remarks. In which case, either print nothing, or provide an error which says "file did not contain any annotation remarks" or something.

jroelofs added inline comments.Apr 6 2023, 9:39 AM
llvm/test/tools/llvm-remarkutil/no-annotation-count.test
6

Missing colon (to make it a FileCheck directive)

llvm/tools/llvm-remarkutil/RemarkUtil.cpp
57

s/consisten/consistent/

paquette added inline comments.Apr 6 2023, 9:39 AM
llvm/tools/llvm-remarkutil/RemarkUtil.cpp
43

Make it explicit here that this is only from annotation remarks?

57

typos

thegameg added inline comments.Apr 6 2023, 9:43 AM
llvm/tools/llvm-remarkutil/RemarkUtil.cpp
306

I think the latter is not a bad idea to keep as an assert or some sort of hard error: it's technically a malformed annotation remark to not have a count field (is that true, @zjaffal?). But yes, the message is wrong

Thanks all for your comments I will update the patch accordingly

llvm/tools/llvm-remarkutil/RemarkUtil.cpp
306

All annotation remarks should have a count so I think this assert should still be there.

paquette added inline comments.Apr 6 2023, 2:23 PM
llvm/docs/CommandGuide/llvm-remarkutil.rst
23

Can you also add some documentation with a summary, like the other options have below?

zjaffal updated this revision to Diff 511651.Apr 7 2023, 3:17 AM
zjaffal marked 10 inline comments as done.

Address comments.

zjaffal marked 3 inline comments as done.Apr 7 2023, 3:18 AM
zjaffal updated this revision to Diff 511653.Apr 7 2023, 3:19 AM

add new lines at the end yaml and rst files

jroelofs added inline comments.Apr 7 2023, 10:10 AM
llvm/test/tools/llvm-remarkutil/no-annotation-count.test
6

still missing

zjaffal marked an inline comment as done.Apr 7 2023, 2:33 PM
zjaffal added inline comments.
llvm/test/tools/llvm-remarkutil/no-annotation-count.test
6

I will update it when committing

thegameg accepted this revision.Apr 7 2023, 2:36 PM

LGTM

This revision is now accepted and ready to land.Apr 7 2023, 2:36 PM
This revision was automatically updated to reflect the committed changes.
zjaffal marked an inline comment as done.

It seems like when this commit relanded there was a dangling reference left in the documentation (llvm-remarkutils.rst, with annotation-count_subcommand not pointing to anything. This was breaking my sphinx builds. I've committed b4ba5c7984d29841ac92ef54a6bac44fb1eeab9b to fix the dangling reference and fix the builds. Let me know if anything needs to be adjusted. Thanks.