This is an archive of the discontinued LLVM Phabricator instance.

Adds diagnostics for missing opportunities of indirect call promotion.
Needs ReviewPublic

Authored by netforce on Apr 7 2022, 10:13 AM.

Details

Reviewers
tejohnson
xur
Summary

Some indirect branches that are important for performance might not
be promoted because there are too many targets and/or they don't have enough
counts to be promoted. Let's make them easier to understand by adding
diagnostics for such opportunities.

Diff Detail

Event Timeline

netforce created this revision.Apr 7 2022, 10:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 10:13 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
netforce requested review of this revision.Apr 7 2022, 10:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 10:13 AM
xur added a comment.Apr 7 2022, 10:51 AM

Also, adding a test would be helpful.

llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
373

How about move this ilne to line 412 to ICallPromotionAnalysis? I think that's a better place for this.

380

How about NotMeetPercentThreshold. It's better to use a same terms for the whole message.

netforce updated this revision to Diff 422609.Apr 13 2022, 12:54 PM

Added a test and fixed some minor issues that I found while adding the test.

ICallPromotionAnalysis::getPromotionCandidatesForInstruction used to return only MaxNumPromotions targets even when there are more number of targets. So, added MaxNumTargets to set that number separately.

The desired coverage should be (100 - ICPMissingPercentThreshold) and not ICPMissingPercentThreshold.

Added a test. PTAL.

llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
373

Could you clarify this comment in a little more detail? Do you suggest changing the interface of ICallAnalysis.getPromotionCandidatesForInstruction() so that it could also exposed RemainingCount next to TotalCount? I don't see how it could be moved to line 412.

380

Done.