This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] Fix slowdown in dwarfdump statistics.
AbandonedPublic

Authored by rdhindsa on Apr 7 2021, 2:01 PM.

Details

Summary

Fixed slowdown that happened after https://reviews.llvm.org/D96045,

While running dwarfdump --statistics, it spends more than 50% of the time in collectZeroCovInlinedVars function.

In function collectStatsForObjectFile, variable InlinedFnsToBeProcessed is being created outside the for loop. The inline functions to be processed are appended and processed multiple times. Hence, moving the creation of that variable into the for loop which fixes the slowdown.

Diff Detail

Event Timeline

rdhindsa created this revision.Apr 7 2021, 2:01 PM
rdhindsa requested review of this revision.Apr 7 2021, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2021, 2:01 PM

If there are cases where this causes the wrong/different answer (@rdhindsa you mentioned in some targets with this patch the statistics changed?) perhaps this patch could include a test demonstrating that bug/fix?

rdhindsa abandoned this revision.Apr 8 2021, 3:56 PM

This change is causing a difference in 2 dwarfdump statistics for a large binary with fission=yes.

I have commented on the original patch and will let the author of the patch look at it, since I am not very familiar with it.