Page MenuHomePhabricator

llvm-dwarfdump][Statistics] Make calculations of vars in global scope more accurate
ClosedPublic

Authored by krisb on Jan 19 2020, 8:53 AM.

Details

Summary
It isn't known how many times we've seen the same variable or member in
the global scope (unlike in functions), but there still can be some duplicates
among different CUs.
So, this patch proposes to count variables in the global scope just as a sum of
the number of vars, constant members and artificial entities.

Diff Detail

Event Timeline

krisb created this revision.Jan 19 2020, 8:53 AM
Herald added a project: Restricted Project. · View Herald Transcript
aprantl added inline comments.Jan 21 2020, 10:16 AM
llvm/tools/llvm-dwarfdump/Statistics.cpp
324–325

How does this condition ensure that this is a constant member now?

krisb updated this revision to Diff 239658.Jan 22 2020, 11:37 AM
krisb marked an inline comment as done.

Refactor checks for constant members a bit.

llvm/tools/llvm-dwarfdump/Statistics.cpp
324–325

The function returns on lines 259-262 (of original code) if Die is a member, but not a constant one, so it's not possible to reach this 'if' for a non-constant member.
But, yeah, it's a bit unclear. I moved the check for constantness to the top of the function, to be clear we do not consider non-constant members at all. This looks better to me.

aprantl accepted this revision.Jan 24 2020, 2:26 PM

Nice.

This revision is now accepted and ready to land.Jan 24 2020, 2:26 PM
This revision was automatically updated to reflect the committed changes.