This is an archive of the discontinued LLVM Phabricator instance.

llvm-dwarfdump: Add new variable, parameter and inlining statistics; also function source location statistics.
ClosedPublic

Authored by cmtice on Mar 1 2019, 2:12 PM.

Details

Summary

Add statistics for abstract origins, function, variable and parameter locations; break the 'variable' counts down into variables and parameters. Also update call site counting to check for DW_AT_call_{file,line} in addition to DW_TAG_call_site.

Diff Detail

Event Timeline

cmtice created this revision.Mar 1 2019, 2:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2019, 2:12 PM

If the new statistics are purely additive, we probably don't need to bump the version number (but it won't hurt either).

tools/llvm-dwarfdump/Statistics.cpp
181

Can you run your patch through clang-format, please?

aprantl added inline comments.Mar 1 2019, 3:01 PM
test/tools/llvm-dwarfdump/X86/Inputs/statistics-fib.s
2

Do we need this as assembler or would it be more compact if we checked in llvm IR instead and compile it with llc on the fly?

cmtice updated this revision to Diff 188984.Mar 1 2019, 3:09 PM

Ran clang-format on Statistics.cpp

dblaikie added inline comments.Mar 1 2019, 3:14 PM
test/tools/llvm-dwarfdump/X86/Inputs/statistics-fib.s
2

This was a suggestion by @echristo and myself - one we made admittedly without looking at the existing testing for statistics, but I still agree with having seen the existing tests.

The statistics tests are standout as the only tests for llvm-dwarfdump that don't use either assembly or object files (& their coverage is a bit limited because of it - note the existing tests don't test any of the instruction counts, because they could vary as LLVM changes happen).

My take on it is that testing llvm-dwarfdump shouldn't also involve/be dependent on the behavior of LLVM's DWARF emission - because it means more points of failure reflected in a single test, so the test is less actionable when it does fail (is this a bug in the test, a bug in LLVM's DWARF emission, or a mismatch between the two and the test expectations need to be updated because of it)

(In the abstract ideal, something like yaml2obj would have high level abstractions for DWARF making it easy to hand write specific inputs (potentially even corrupt inputs) to various tool tests)

aprantl accepted this revision.Mar 1 2019, 3:25 PM

Works for me; the main reason why I don't like assembler that much is because it so long and the DWARF is virtually uneditable manually, but all the other alternatives also have their own drawbacks as you all know!

This revision is now accepted and ready to land.Mar 1 2019, 3:25 PM
This revision was automatically updated to reflect the committed changes.