This is an archive of the discontinued LLVM Phabricator instance.

[NFC] [DwarfEHPrepare] Add additional stats for EH
ClosedPublic

Authored by modimo on Jun 11 2021, 5:07 PM.

Details

Summary

Stats added:

  1. NumCleanupLandingPadsUnreachable: how many cleanup landing pads were optimized as unreachable
  2. NumCleanupLandingPadsRemaining: how many cleanup landing pads remain
  3. NumNoUnwind: Number of functions with nounwind attribute
  4. NumUnwind: Number of functions with unwind attribute

DwarfEHPrepare is always run a single time as part of TargetPassConfig::addISelPasses() which makes it an ideal place near the end of the pipeline to record this information.

Example output from clang built with exceptions cumulative during thinLTO backend (NumCleanupLandingPadsUnreachable was not incremented):

"dwarfehprepare.NumCleanupLandingPadsRemaining": 123660,
"dwarfehprepare.NumNoUnwind": 323836,
"dwarfehprepare.NumUnwind": 472893,

Diff Detail

Event Timeline

modimo created this revision.Jun 11 2021, 5:07 PM
modimo requested review of this revision.Jun 11 2021, 5:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2021, 5:07 PM
wenlei added inline comments.Jun 11 2021, 8:37 PM
llvm/lib/CodeGen/DwarfEHPrepare.cpp
45

The path leading to InsertUnwindResumeCalls is unconditional for all functions. So this is essentially a total function count. All stats have flat structure, so, 1) we don't add a total function count stats for each pass; 2) The description of each stats need to be informative about what a particular pass did, "Number of functions processed" is too general. If you want to compare against NumNoUnwind, perhaps you could add NunUnwind.

46
  • " in program" is implicit for all stats.
  • This seems to be the count before pruning unreachable LP, but it's unclear from the name. Suggest name the two counter as something like "Number of cleanup landing pads removed", "Number of cleanup landing pads remained".
modimo updated this revision to Diff 352032.Jun 14 2021, 7:16 PM
modimo edited the summary of this revision. (Show Details)

Review comments

wenlei accepted this revision.Jun 14 2021, 11:17 PM

lgtm, thanks.

This revision is now accepted and ready to land.Jun 14 2021, 11:17 PM
modimo updated this revision to Diff 352202.Jun 15 2021, 11:34 AM

Clang-format

This revision was automatically updated to reflect the committed changes.