[PATCH] D72797: [llvm-dwarfdump][Statistics] Distinguish functions/variables with same name across different CUs
Kristina Bessonova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 12:05:07 PST 2020
krisb created this revision.
krisb added reviewers: djtodoro, aprantl.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Different variables and functions might have the same name in different CU.
To calculate 'Availability' metric more accurate (i.e. to avoid getting
availability above 100%), we need to have some additional logic to
distinguish between them.
The patch introduces a DIE identification that consists of
a function/variable name and declaration information:
a filename and a line number. This allows distinguishing different
functions/variables (different means declared in different files/lines)
with the same name, keeping duplicates counted as duplicates.
The patch uses line tables to resolve the name of the file, so this
slows down the statistics by ~5-10% (tested on several binaries with
~10-100k variables processed).
This patch is the first one from a set of 5 that aims to improve availability
statistics. I'm going to submit 4 more:
- Allow being more than one concrete out-of-line instance of a function.
- Stop counting DW_TAG_subroutine_type in statistics (it includes
DW_TAG_formal_parameter's w/o a name or location info, so they not
really useful).
- Distinguish parameters with the same name or w/o a name.
- Change a way of calculations of TotalVars in 'global' scope.
This five patches reduces 'total availability' metric of clang binary
(debug build) from 126% to 87%.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72797
Files:
llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll
llvm/tools/llvm-dwarfdump/Statistics.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72797.238329.patch
Type: text/x-patch
Size: 7611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200115/68c7f50b/attachment.bin>
More information about the llvm-commits
mailing list